aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-05-27 16:12:57 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:03 -0400
commit85bdbabbd97ff797f91e6ec839ab053776bc72b4 (patch)
treea2dd933c3b0aae1e7467b30cae4dfefb5dad0846 /drivers/scsi/hpsa.c
parente5c880d1d5923c341ac7ba537fb1e6b73c5977a2 (diff)
[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)
3278 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */ 3278 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
3279} 3279}
3280 3280
3281static inline bool hpsa_board_disabled(struct pci_dev *pdev)
3282{
3283 u16 command;
3284
3285 (void) pci_read_config_word(pdev, PCI_COMMAND, &command);
3286 return ((command & PCI_COMMAND_MEMORY) == 0);
3287}
3288
3281static int __devinit hpsa_pci_init(struct ctlr_info *h) 3289static int __devinit hpsa_pci_init(struct ctlr_info *h)
3282{ 3290{
3283 ushort command;
3284 u32 scratchpad = 0; 3291 u32 scratchpad = 0;
3285 u64 cfg_offset; 3292 u64 cfg_offset;
3286 u32 cfg_base_addr; 3293 u32 cfg_base_addr;
@@ -3294,15 +3301,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
3294 h->product_name = products[prod_index].product_name; 3301 h->product_name = products[prod_index].product_name;
3295 h->access = *(products[prod_index].access); 3302 h->access = *(products[prod_index].access);
3296 3303
3297 /* check to see if controller has been disabled 3304 if (hpsa_board_disabled(h->pdev)) {
3298 * BEFORE trying to enable it
3299 */
3300 (void)pci_read_config_word(h->pdev, PCI_COMMAND, &command);
3301 if (!(command & 0x02)) {
3302 dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); 3305 dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
3303 return -ENODEV; 3306 return -ENODEV;
3304 } 3307 }
3305
3306 err = pci_enable_device(h->pdev); 3308 err = pci_enable_device(h->pdev);
3307 if (err) { 3309 if (err) {
3308 dev_warn(&h->pdev->dev, "unable to enable PCI device\n"); 3310 dev_warn(&h->pdev->dev, "unable to enable PCI device\n");