deliverable/linux.git
8 years agoVMW_PVSCSI: Fix the issue of DMA-API related warnings.
Josh Boyer [Thu, 3 Dec 2015 13:27:59 +0000 (08:27 -0500)] 
VMW_PVSCSI: Fix the issue of DMA-API related warnings.

The driver is missing calls to pci_dma_mapping_error() after
performing the DMA mapping, which caused DMA-API warning to
show up in dmesg's output. Though that happens only when
DMA_API_DEBUG option is enabled. This change fixes the issue
and makes pvscsi_map_buffers() function more robust.

Signed-off-by: Arvind Kumar <arvindkumar@vmware.com>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agocxlflash: drop unlikely before IS_ERR_OR_NULL
Geliang Tang [Thu, 3 Dec 2015 21:18:49 +0000 (15:18 -0600)] 
cxlflash: drop unlikely before IS_ERR_OR_NULL

IS_ERR_OR_NULL already contain an unlikely compiler flag. Drop it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agocxlflash: a couple off by one bugs
Dan Carpenter [Wed, 2 Dec 2015 23:26:28 +0000 (17:26 -0600)] 
cxlflash: a couple off by one bugs

The "> MAX_CONTEXT" should be ">= MAX_CONTEXT".  Otherwise we go one
step beyond the end of the cfg->ctx_tbl[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: Remove stale variables
Hannes Reinecke [Thu, 3 Dec 2015 06:57:35 +0000 (07:57 +0100)] 
scsi_dh_alua: Remove stale variables

With commit 83ea0e5e3501 ("scsi_dh_alua: use scsi_vpd_tpg_id()") these
variables became obsolete, but weren't removed.

[mkp: Fixed checkpatch warning]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobfa: Update driver version to 3.2.25.0
Anil Gurumurthy [Thu, 26 Nov 2015 08:54:47 +0000 (03:54 -0500)] 
bfa: Update driver version to 3.2.25.0

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobfa: File header and user visible string changes
Anil Gurumurthy [Thu, 26 Nov 2015 08:54:46 +0000 (03:54 -0500)] 
bfa: File header and user visible string changes

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobfa: Fix for crash when bfa_itnim is NULL
Anil Gurumurthy [Thu, 26 Nov 2015 08:54:00 +0000 (03:54 -0500)] 
bfa: Fix for crash when bfa_itnim is NULL

Fix a very corner case when the port gets disconnected and the BFA and
FCS layers clean up references to the IT nexus.  During this window if a
task management command is issued by the SCSI-ML and ends up referencing
a NULL itnim, it could lead to a crash.

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agobfa: Update copyright messages
Anil Gurumurthy [Thu, 26 Nov 2015 08:54:45 +0000 (03:54 -0500)] 
bfa: Update copyright messages

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: use scsi_vpd_tpg_id()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:58 +0000 (10:16 +0100)] 
scsi_dh_alua: use scsi_vpd_tpg_id()

Use the common function 'scsi_vpd_tpg_id()' instead of open-coding
it in scsi_dh_alua.

[mkp: Applied by hand]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: Add scsi_vpd_tpg_id()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:57 +0000 (10:16 +0100)] 
scsi: Add scsi_vpd_tpg_id()

Implement scsi_vpd_tpg_id() to extract the target
port group id and the relative port id from
SCSI VPD page 0x83.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: export 'wwid' to sysfs
Hannes Reinecke [Tue, 1 Dec 2015 09:16:56 +0000 (10:16 +0100)] 
scsi: export 'wwid' to sysfs

Use scsi_vpd_lun_id() to export the world-wide unique id (wwid) to
sysfs.  Note that this is the 'best' wwid according to the rules in
scsi_vpd_lun_id(), not every possible wwid presented by the drive.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: Add scsi_vpd_lun_id()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:55 +0000 (10:16 +0100)] 
scsi: Add scsi_vpd_lun_id()

Add a function scsi_vpd_lun_id() to return a unique device
identifcation based on the designation descriptors of
VPD page 0x83.

As devices might implement several descriptors the order
of preference is:
- NAA IEE Registered Extended
- EUI-64 based 16-byte
- EUI-64 based 12-byte
- NAA IEEE Registered
- NAA IEEE Extended
A SCSI name string descriptor is preferred to all of them
if the identification is longer than 16 bytes.

The returned unique device identification will be formatted
as a SCSI Name string to avoid clashes between different
designator types.

[mkp: Fixed up kernel doc comment from Johannes]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: simplify sense code handling
Hannes Reinecke [Tue, 1 Dec 2015 09:16:54 +0000 (10:16 +0100)] 
scsi_dh_alua: simplify sense code handling

Most sense code is already handled in the generic
code, so we shouldn't be adding special cases here.
However, when doing so we need to check for
unit attention whenever we're sending an internal
command.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: rework alua_check_tpgs() to return the tpgs mode
Hannes Reinecke [Tue, 1 Dec 2015 09:16:53 +0000 (10:16 +0100)] 
scsi_dh_alua: rework alua_check_tpgs() to return the tpgs mode

Instead of returning an error code in alua_check_tpgs() we should
rather return the tpgs mode directly and have a cleaner syntax.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: use unaligned access macros
Hannes Reinecke [Tue, 1 Dec 2015 09:16:52 +0000 (10:16 +0100)] 
scsi_dh_alua: use unaligned access macros

Use 'get_unaligned_XX' and 'put_unaligned_XX' instead of
open-coding it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: use flag for RTPG extended header
Hannes Reinecke [Tue, 1 Dec 2015 09:16:51 +0000 (10:16 +0100)] 
scsi_dh_alua: use flag for RTPG extended header

We should be using a flag when RTPG extended header is not
supported, that saves us sending RTPG twice for older arrays.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: remove scsi_show_sense_hdr()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:50 +0000 (10:16 +0100)] 
scsi: remove scsi_show_sense_hdr()

Last caller is gone, so remove it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: fixup description of stpg_endio()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:49 +0000 (10:16 +0100)] 
scsi_dh_alua: fixup description of stpg_endio()

Fixup copy-and-paste error in the description of stpg_endio().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: return standard SCSI return codes in submit_rtpg
Hannes Reinecke [Tue, 1 Dec 2015 09:16:48 +0000 (10:16 +0100)] 
scsi_dh_alua: return standard SCSI return codes in submit_rtpg

Fixup submit_rtpg() to always return a standard SCSI return code.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: use standard logging functions
Hannes Reinecke [Tue, 1 Dec 2015 09:16:47 +0000 (10:16 +0100)] 
scsi_dh_alua: use standard logging functions

Use standard logging functions instead of hand-crafted ones.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: sanitze sense code handling
Hannes Reinecke [Tue, 1 Dec 2015 09:16:46 +0000 (10:16 +0100)] 
scsi_dh_alua: sanitze sense code handling

The only check for a valid sense code is calling scsi_normalize_sense()
and check the return value. So drop the pointless checks and rely on
scsi_normalize_sense() to figure out if the sense code is valid.
With that we can also remove the 'senselen' field.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Bart van Assche <bvanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: improved logging
Hannes Reinecke [Tue, 1 Dec 2015 09:16:45 +0000 (10:16 +0100)] 
scsi_dh_alua: improved logging

Issue different logging messages if ALUA is not supported
or the TPGS setting is invalid.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: Use vpd_pg83 information
Hannes Reinecke [Tue, 1 Dec 2015 09:16:44 +0000 (10:16 +0100)] 
scsi_dh_alua: Use vpd_pg83 information

The SCSI device now has the VPD page 0x83 information attached,
so there is no need to query it again.

[mkp: Fixed a checkpatch warning]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh_alua: Disable ALUA handling for non-disk devices
Hannes Reinecke [Tue, 1 Dec 2015 09:16:43 +0000 (10:16 +0100)] 
scsi_dh_alua: Disable ALUA handling for non-disk devices

Non-disk devices might support ALUA, but the firmware
implementation is untested and frequently broken.
As we're don't actually need it disable ALUA support
for non-disk device for now.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: ignore errors from scsi_dh_add_device()
Hannes Reinecke [Tue, 1 Dec 2015 09:16:42 +0000 (10:16 +0100)] 
scsi: ignore errors from scsi_dh_add_device()

device handler initialisation might fail due to a number of
reasons. But as device_handlers are optional this shouldn't
cause us to disable the device entirely.
So just ignore errors from scsi_dh_add_device().

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_dh: move 'dh_state' sysfs attribute to generic code
Hannes Reinecke [Tue, 1 Dec 2015 09:16:41 +0000 (10:16 +0100)] 
scsi_dh: move 'dh_state' sysfs attribute to generic code

As scsi_dh.c is now always compiled in we should be moving
the 'dh_state' attribute to the generic code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agomvsas: fix misleading indentation
Luis de Bethencourt [Mon, 30 Nov 2015 14:32:17 +0000 (14:32 +0000)] 
mvsas: fix misleading indentation

Fix a smatch warning:
drivers/scsi/mvsas/mv_sas.c:740 mvs_task_prep() warn: curly braces intended?

The code is correct, the indention is misleading. When the device is not
ready we want to return SAS_PHY_DOWN. But current indentation makes it
look like we only do so in the else branch of if (mvi_dev).

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: ufs: fix spelling mistake in error message
Colin Ian King [Sat, 28 Nov 2015 16:33:56 +0000 (16:33 +0000)] 
scsi: ufs: fix spelling mistake in error message

Minor issue, fix spelling mistake, Intialization -> Initialization

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: change driver version to v1.30.00.22-20151126
Ching Huang [Thu, 26 Nov 2015 11:44:55 +0000 (19:44 +0800)] 
arcmsr: change driver version to v1.30.00.22-20151126

Change driver version to v1.30.00.22-20151126

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: Split dma resource allocation to a new function
Ching Huang [Thu, 26 Nov 2015 11:41:15 +0000 (19:41 +0800)] 
arcmsr: Split dma resource allocation to a new function

Split dma resource allocation and io register assignment from get_config
to a new function arcmsr_alloc_io_queue.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: more readability improvements
Ching Huang [Thu, 26 Nov 2015 11:33:56 +0000 (19:33 +0800)] 
arcmsr: more readability improvements

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: changes driver version number
Ching Huang [Wed, 25 Nov 2015 11:52:15 +0000 (19:52 +0800)] 
arcmsr: changes driver version number

Changes driver version number.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: adds code to support new Areca adapter ARC1203
Ching Huang [Wed, 25 Nov 2015 11:49:33 +0000 (19:49 +0800)] 
arcmsr: adds code to support new Areca adapter ARC1203

Support Areca's new PCIe to SATA RAID adapter ARC1203.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: make code more readable
Ching Huang [Wed, 25 Nov 2015 11:45:16 +0000 (19:45 +0800)] 
arcmsr: make code more readable

[mkp: Fixed checkpatch whitespace warning]

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: fixes not release allocated resource
Ching Huang [Wed, 25 Nov 2015 11:41:23 +0000 (19:41 +0800)] 
arcmsr: fixes not release allocated resource

Releasing allocated resource if get configuration data failed.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoarcmsr: fixed getting wrong configuration data
Ching Huang [Wed, 25 Nov 2015 11:36:02 +0000 (19:36 +0800)] 
arcmsr: fixed getting wrong configuration data

Fixed getting wrong configuration data of adapter type B and type D.

Signed-off-by: Ching Huang <ching2048@areca.com.tw>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_transport_fc: Introduce scsi_host_{get,put}()
Bart Van Assche [Fri, 20 Nov 2015 21:33:04 +0000 (13:33 -0800)] 
scsi_transport_fc: Introduce scsi_host_{get,put}()

Use scsi_host_{get,put}() instead of open-coding these functions.
Compile-tested only.

[mkp: Dropped CC:stable and fixed James Smart's email address]

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: James Smart <james.smart@avagotech.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi_debug: check for bigger value first
Andy Shevchenko [Thu, 26 Nov 2015 18:22:50 +0000 (20:22 +0200)] 
scsi_debug: check for bigger value first

Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: rescan VPD attributes
Hannes Reinecke [Mon, 9 Nov 2015 12:24:28 +0000 (13:24 +0100)] 
scsi: rescan VPD attributes

The VPD page information might change, so we need to be able to update
it. This patch implements a VPD page rescan whenever the 'rescan' sysfs
attribute is triggered.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoaacraid: aac_release_resources() can be static
Fengguang Wu [Tue, 10 Nov 2015 05:59:06 +0000 (13:59 +0800)] 
aacraid: aac_release_resources() can be static

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: use sector_div instead of do_div
Arnd Bergmann [Fri, 20 Nov 2015 16:38:28 +0000 (17:38 +0100)] 
scsi: use sector_div instead of do_div

do_div is the wrong way to divide a sector_t, as it is less efficient
when sector_t is 32-bit wide. With the upcoming do_div optimizations,
the kernel starts warning about this:

drivers/scsi/scsi_debug.c: In function 'dif_store':
include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast

This changes the code to use sector_div instead, which always produces
optimal code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Remove dependency on of_irq_count
John Garry [Thu, 19 Nov 2015 12:23:59 +0000 (20:23 +0800)] 
hisi_sas: Remove dependency on of_irq_count

Originally the driver would use of_irq_count to calculate how much
memory is required for storing the interrupt names, since the number of
interrupt sources for the controller is variable.  Since of_irq_count
cannot be used by the driver, use fixed names.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoMAINTAINERS: Add maintainer for HiSi SAS driver
John Garry [Tue, 17 Nov 2015 16:50:59 +0000 (00:50 +0800)] 
MAINTAINERS: Add maintainer for HiSi SAS driver

Add maintainer for HiSilicon SAS driver.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add fatal irq handler
John Garry [Tue, 17 Nov 2015 16:50:58 +0000 (00:50 +0800)] 
hisi_sas: Add fatal irq handler

Add handlers for fatal interrupts.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add control phy handler
John Garry [Tue, 17 Nov 2015 16:50:57 +0000 (00:50 +0800)] 
hisi_sas: Add control phy handler

Add method for lldd_control_phy. Currently link rate control and spinup
hold is unsupported.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add tmf methods
John Garry [Tue, 17 Nov 2015 16:50:56 +0000 (00:50 +0800)] 
hisi_sas: Add tmf methods

Add function methods for tmf's.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add scan finished and start
John Garry [Tue, 17 Nov 2015 16:50:55 +0000 (00:50 +0800)] 
hisi_sas: Add scan finished and start

Add functions for scsi host template scan_finished and scan_start
methods.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add smp protocol support
John Garry [Tue, 17 Nov 2015 16:50:54 +0000 (00:50 +0800)] 
hisi_sas: Add smp protocol support

Add support for smp function, which allows devices attached by expander
to be controlled.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add bcast interrupt handler
John Garry [Tue, 17 Nov 2015 16:50:53 +0000 (00:50 +0800)] 
hisi_sas: Add bcast interrupt handler

This is for expander broadcast event.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add abnormal irq handler
John Garry [Tue, 17 Nov 2015 16:50:52 +0000 (00:50 +0800)] 
hisi_sas: Add abnormal irq handler

Add abnormal irq handler. This handler is concerned with phy down event.
Also add port formed and port deformed handlers.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add dev_found and dev_gone
John Garry [Tue, 17 Nov 2015 16:50:51 +0000 (00:50 +0800)] 
hisi_sas: Add dev_found and dev_gone

Add functions to deal with lldd_dev_found and lldd_dev_gone.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add cq interrupt handler
John Garry [Tue, 17 Nov 2015 16:50:50 +0000 (00:50 +0800)] 
hisi_sas: Add cq interrupt handler

Add cq interrupt handler and also slot error handler function.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add ssp command function
John Garry [Tue, 17 Nov 2015 16:50:49 +0000 (00:50 +0800)] 
hisi_sas: Add ssp command function

Add path to send ssp command to HW.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add path from phyup irq to SAS framework
John Garry [Tue, 17 Nov 2015 16:50:48 +0000 (00:50 +0800)] 
hisi_sas: Add path from phyup irq to SAS framework

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add v1 hardware interrupt init
John Garry [Tue, 17 Nov 2015 16:50:47 +0000 (00:50 +0800)] 
hisi_sas: Add v1 hardware interrupt init

Add code to interrupts, so now we can get a phy up interrupt when a disk
is connected.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add v1 hardware initialisation code
John Garry [Tue, 17 Nov 2015 16:50:46 +0000 (00:50 +0800)] 
hisi_sas: Add v1 hardware initialisation code

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add v1 hardware register definitions
John Garry [Tue, 17 Nov 2015 16:50:45 +0000 (00:50 +0800)] 
hisi_sas: Add v1 hardware register definitions

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add v1 hw module init
John Garry [Tue, 17 Nov 2015 16:50:44 +0000 (00:50 +0800)] 
hisi_sas: Add v1 hw module init

Add module init code for v1 hw.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add timer and spinlock init
John Garry [Tue, 17 Nov 2015 16:50:43 +0000 (00:50 +0800)] 
hisi_sas: Add timer and spinlock init

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add phy and port init
John Garry [Tue, 17 Nov 2015 16:50:42 +0000 (00:50 +0800)] 
hisi_sas: Add phy and port init

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add hisi sas device type
John Garry [Tue, 17 Nov 2015 16:50:41 +0000 (00:50 +0800)] 
hisi_sas: Add hisi sas device type

Include initialisation.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add hisi_hba workqueue
John Garry [Tue, 17 Nov 2015 16:50:40 +0000 (00:50 +0800)] 
hisi_sas: Add hisi_hba workqueue

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Set dev DMA mask
John Garry [Tue, 17 Nov 2015 16:50:39 +0000 (00:50 +0800)] 
hisi_sas: Set dev DMA mask

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add phy SAS ADDR initialization
John Garry [Tue, 17 Nov 2015 16:50:38 +0000 (00:50 +0800)] 
hisi_sas: Add phy SAS ADDR initialization

The SAS address for the HBA comes from the device tree.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add cq structure initialization
John Garry [Tue, 17 Nov 2015 16:50:37 +0000 (00:50 +0800)] 
hisi_sas: Add cq structure initialization

Each completion queue has a structure. This is mainly for passing to irq
handler so we know which queue the irq occured on.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add slot init code
John Garry [Tue, 17 Nov 2015 16:50:36 +0000 (00:50 +0800)] 
hisi_sas: Add slot init code

Add functionality to init slot indexing.

Slot indexing is for the host to track which slots (or tags) are free
and which are used.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add hisi_sas_remove
John Garry [Tue, 17 Nov 2015 16:50:35 +0000 (00:50 +0800)] 
hisi_sas: Add hisi_sas_remove

This patch also includes relevant memory/pool freeing and sas/scsi host
removal.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Allocate memories and create pools
John Garry [Tue, 17 Nov 2015 16:50:34 +0000 (00:50 +0800)] 
hisi_sas: Allocate memories and create pools

Allocate DMA and non-DMA memories for the controller. Also create DMA
pools.

These include:

- Delivery queues
- Completion queues
- Command status buffer
- Command table
- ITCT (For device context)
- Host slot info
- IO status
- Breakpoint
- host slot indexing
- SG data
- FIS
- interrupts names

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add HW DMA structures
John Garry [Tue, 17 Nov 2015 16:50:33 +0000 (00:50 +0800)] 
hisi_sas: Add HW DMA structures

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Scan device tree
John Garry [Tue, 17 Nov 2015 16:50:32 +0000 (00:50 +0800)] 
hisi_sas: Scan device tree

Scan the device tree for all properties. Also do this:

- do ioremap for SAS registers
- allocate memory for interrupt names

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add scsi host registration
John Garry [Tue, 17 Nov 2015 16:50:31 +0000 (00:50 +0800)] 
hisi_sas: Add scsi host registration

Add functionality to register device as a scsi host.

The SAS domain transport ops are empty at this point.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agohisi_sas: Add initial bare main driver
John Garry [Tue, 17 Nov 2015 16:50:30 +0000 (00:50 +0800)] 
hisi_sas: Add initial bare main driver

This patch adds the initial bare main driver for the HiSilicon SAS
HBA. This only introduces the changes to build and load the main driver
module.

The complete driver consists of the core main module and also a module
platform driver for driving the hw.

The HBA is a platform device.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agodevicetree: bindings: scsi: HiSi SAS
John Garry [Tue, 17 Nov 2015 16:50:29 +0000 (00:50 +0800)] 
devicetree: bindings: scsi: HiSi SAS

Add devicetree bindings for HiSilicon SAS driver.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoscsi: Centralise ssp frame information units
John Garry [Tue, 17 Nov 2015 16:50:28 +0000 (00:50 +0800)] 
scsi: Centralise ssp frame information units

The xfer_rdy, command, and task frame's iu structures are not available
in <scsi/sas.h>, but only aic94xx driver folder.  Add them to
include/scsi/sas.h

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Introduce atp870_init()
Ondrej Zary [Tue, 17 Nov 2015 18:24:28 +0000 (19:24 +0100)] 
atp870u: Introduce atp870_init()

Move 870-specific init code to a separate function atp870_init()

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Introduce atp885_init()
Ondrej Zary [Tue, 17 Nov 2015 18:24:27 +0000 (19:24 +0100)] 
atp870u: Introduce atp885_init()

Move 885-specific init code to a separate function atp885_init()

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Introduce atp880_init()
Ondrej Zary [Tue, 17 Nov 2015 18:24:26 +0000 (19:24 +0100)] 
atp870u: Introduce atp880_init()

Move 880-specific init code to a separate function atp880_init()

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Initialize tables earlier
Ondrej Zary [Tue, 17 Nov 2015 18:24:25 +0000 (19:24 +0100)] 
atp870u: Initialize tables earlier

Call _init_tables before chip-specific initialization. This avoids code
duplication and fixes a bug(?) in 880 init where the values read from flash
into atpdev->sp are then overwritten by calling init_tables.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove scam_on from struct atp_unit
Ondrej Zary [Tue, 17 Nov 2015 18:24:24 +0000 (19:24 +0100)] 
atp870u: Remove scam_on from struct atp_unit

scam_on is used only during probe, no need to keep it later.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Request IRQ later, remove weird locking
Ondrej Zary [Tue, 17 Nov 2015 18:24:23 +0000 (19:24 +0100)] 
atp870u: Request IRQ later, remove weird locking

Allocate IRQ later during probe to avoid code duplication and also
remove the need for weird locking in _probe.
(It was probably there to prevent race with the IRQ handler?)

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Use pci_request_regions
Ondrej Zary [Tue, 17 Nov 2015 18:24:22 +0000 (19:24 +0100)] 
atp870u: Use pci_request_regions

Use pci_request_regions and do it before accessing the I/O ports.
Also add missing pci_disable_device() call to atp870u_remove().

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Introduce is880(), is885() and remove dev_id
Ondrej Zary [Tue, 17 Nov 2015 18:24:21 +0000 (19:24 +0100)] 
atp870u: Introduce is880(), is885() and remove dev_id

Introduce chip type inline functions to simplify code, allowing to delete
dev_id from struct atp_unit.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Simplify _probe()
Ondrej Zary [Tue, 17 Nov 2015 18:24:20 +0000 (19:24 +0100)] 
atp870u: Simplify _probe()

Move shpnt common code to the top, remove base_io, use pci_resource_len.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove chip_ver from struct atp_unit
Ondrej Zary [Tue, 17 Nov 2015 18:24:19 +0000 (19:24 +0100)] 
atp870u: Remove chip_ver from struct atp_unit

chip_ver is used for wide chip detection only. Remove it and use a local
variable instead (for 870; 880 and 885 are always wide).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Improve unsupported chip detection
Ondrej Zary [Tue, 17 Nov 2015 18:24:18 +0000 (19:24 +0100)] 
atp870u: Improve unsupported chip detection

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Improve _probe()
Ondrej Zary [Tue, 17 Nov 2015 18:24:17 +0000 (19:24 +0100)] 
atp870u: Improve _probe()

Move scsi_host_alloc() to the top of _probe() to remove code duplication,
*p and unneeded atpdev (de)allocation and copying.  While at it, fix the
error paths to return real error codes and also add missing
pci_disble_device() call.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove unused irq from struct atp_unit
Ondrej Zary [Tue, 17 Nov 2015 18:24:16 +0000 (19:24 +0100)] 
atp870u: Remove unused irq from struct atp_unit

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove useless and broken card counting
Ondrej Zary [Tue, 17 Nov 2015 18:24:15 +0000 (19:24 +0100)] 
atp870u: Remove useless and broken card counting

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Use n_io_port in request_region and release_region
Ondrej Zary [Tue, 17 Nov 2015 18:24:14 +0000 (19:24 +0100)] 
atp870u: Use n_io_port in request_region and release_region

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Use module_pci_driver
Ondrej Zary [Tue, 17 Nov 2015 18:24:13 +0000 (19:24 +0100)] 
atp870u: Use module_pci_driver

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove empty tscam_885()
Ondrej Zary [Tue, 17 Nov 2015 18:24:12 +0000 (19:24 +0100)] 
atp870u: Remove empty tscam_885()

tscam_885() is empty (except a delay) so remove it.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Reduce log spam on module load/unload
Ondrej Zary [Tue, 17 Nov 2015 18:24:11 +0000 (19:24 +0100)] 
atp870u: Reduce log spam on module load/unload

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Introduce atp_set_host_id
Ondrej Zary [Tue, 17 Nov 2015 18:24:10 +0000 (19:24 +0100)] 
atp870u: Introduce atp_set_host_id

The code for setting host adapter ID is the same for all chips.
Move it to a common function.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Fix incorrect writeb_io access to register 0x3a
Ondrej Zary [Tue, 17 Nov 2015 18:24:09 +0000 (19:24 +0100)] 
atp870u: Fix incorrect writeb_io access to register 0x3a

The ioport region is 0x20 bytes long so accessing 0x3a register using
writeb_io is incorrect. Use writeb_base instead.
There's no change in behavior as 870 chips have ioport = baseport.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Replace port 0x80 delay by udelay
Ondrej Zary [Tue, 17 Nov 2015 18:24:08 +0000 (19:24 +0100)] 
atp870u: Replace port 0x80 delay by udelay

tscam() is using port 0x80 access for delays but that's x86-only.
Use udelay(2) instead.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Convert remaining in[bwl] and out[bwl] to wrappers
Ondrej Zary [Tue, 17 Nov 2015 18:24:07 +0000 (19:24 +0100)] 
atp870u: Convert remaining in[bwl] and out[bwl] to wrappers

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Rename is885() to atp_is()
Ondrej Zary [Tue, 17 Nov 2015 18:24:06 +0000 (19:24 +0100)] 
atp870u: Rename is885() to atp_is()

Now that all the is* functions except is885() are gone, rename is885() to
atp_is() to avoid confusion. Don't know what "is" means, though...

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Remove is870()
Ondrej Zary [Tue, 17 Nov 2015 18:24:05 +0000 (19:24 +0100)] 
atp870u: Remove is870()

Now that is885() supports everything from is870() and the rest of the code
is almost identical, remove is870() and use is885() instead.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Move 870-specific code out of is870()
Ondrej Zary [Tue, 17 Nov 2015 18:24:04 +0000 (19:24 +0100)] 
atp870u: Move 870-specific code out of is870()

Move few remaining 870-specific code lines out of is870()

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 years agoatp870u: Add remaining 870 support to is885()
Ondrej Zary [Tue, 17 Nov 2015 18:24:03 +0000 (19:24 +0100)] 
atp870u: Add remaining 870 support to is885()

Add remaining 870 support to is885():
 - different synw, no synuw
 - synu[4] = 0x0c
 - atp_writeb_io(dev, c, 0x04, 0x00); instead of
   atp_writeb_io(dev, c, 0x14, 0x00); (isn't that a bug?)
 - atp_writeb_io(dev, c, 0x14, 0xff); instead of
   atp_writeb_io(dev, c, 0x14, 0x06);
 - different mbuf[3] and mbuf[4] checks

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This page took 0.04814 seconds and 5 git commands to generate.