summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron2010-05-27 22:12:57 +0200
committerJames Bottomley2010-07-27 19:01:03 +0200
commit85bdbabbd97ff797f91e6ec839ab053776bc72b4 (patch)
treea2dd933c3b0aae1e7467b30cae4dfefb5dad0846 /drivers/scsi/hpsa.c
parent[SCSI] hpsa: factor out hpsa_lookup_board_id (diff)
downloadkernel-qcow2-linux-85bdbabbd97ff797f91e6ec839ab053776bc72b4.tar.gz
kernel-qcow2-linux-85bdbabbd97ff797f91e6ec839ab053776bc72b4.tar.xz
kernel-qcow2-linux-85bdbabbd97ff797f91e6ec839ab053776bc72b4.zip
[SCSI] hpsa: factor out hpsa_board_disabled
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b6c6e7f88fa4..4233b932ef55 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3278,9 +3278,16 @@ static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
}
+static inline bool hpsa_board_disabled(struct pci_dev *pdev)
+{
+ u16 command;
+
+ (void) pci_read_config_word(pdev, PCI_COMMAND, &command);
+ return ((command & PCI_COMMAND_MEMORY) == 0);
+}
+
static int __devinit hpsa_pci_init(struct ctlr_info *h)
{
- ushort command;
u32 scratchpad = 0;
u64 cfg_offset;
u32 cfg_base_addr;
@@ -3294,15 +3301,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
h->product_name = products[prod_index].product_name;
h->access = *(products[prod_index].access);
- /* check to see if controller has been disabled
- * BEFORE trying to enable it
- */
- (void)pci_read_config_word(h->pdev, PCI_COMMAND, &command);
- if (!(command & 0x02)) {
+ if (hpsa_board_disabled(h->pdev)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
return -ENODEV;
}
-
err = pci_enable_device(h->pdev);
if (err) {
dev_warn(&h->pdev->dev, "unable to enable PCI device\n");