diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-07-19 14:45:00 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:52:10 -0400 |
commit | dd9c426e92d0cbd710c8df5b84afe9a2eeda3918 (patch) | |
tree | 55e41244dc36cf448112131d657e33547bc112f8 /drivers/block/cciss.c | |
parent | 6539fa9b2e2e7fc3b3fe819e54aa7be83f0370fa (diff) |
cciss: factor out cciss_board_disabled
cciss: factor out cciss_board_disabled
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index d4167c29213d..808d2a5b46bb 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4002,9 +4002,16 @@ static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id) | |||
4002 | return -ENODEV; | 4002 | return -ENODEV; |
4003 | } | 4003 | } |
4004 | 4004 | ||
4005 | static inline bool cciss_board_disabled(ctlr_info_t *h) | ||
4006 | { | ||
4007 | u16 command; | ||
4008 | |||
4009 | (void) pci_read_config_word(h->pdev, PCI_COMMAND, &command); | ||
4010 | return ((command & PCI_COMMAND_MEMORY) == 0); | ||
4011 | } | ||
4012 | |||
4005 | static int __devinit cciss_pci_init(ctlr_info_t *c) | 4013 | static int __devinit cciss_pci_init(ctlr_info_t *c) |
4006 | { | 4014 | { |
4007 | ushort command; | ||
4008 | __u32 scratchpad = 0; | 4015 | __u32 scratchpad = 0; |
4009 | __u64 cfg_offset; | 4016 | __u64 cfg_offset; |
4010 | __u32 cfg_base_addr; | 4017 | __u32 cfg_base_addr; |
@@ -4018,15 +4025,11 @@ static int __devinit cciss_pci_init(ctlr_info_t *c) | |||
4018 | c->product_name = products[prod_index].product_name; | 4025 | c->product_name = products[prod_index].product_name; |
4019 | c->access = *(products[prod_index].access); | 4026 | c->access = *(products[prod_index].access); |
4020 | 4027 | ||
4021 | /* check to see if controller has been disabled */ | 4028 | if (cciss_board_disabled(c)) { |
4022 | /* BEFORE trying to enable it */ | ||
4023 | (void)pci_read_config_word(c->pdev, PCI_COMMAND, &command); | ||
4024 | if (!(command & 0x02)) { | ||
4025 | printk(KERN_WARNING | 4029 | printk(KERN_WARNING |
4026 | "cciss: controller appears to be disabled\n"); | 4030 | "cciss: controller appears to be disabled\n"); |
4027 | return -ENODEV; | 4031 | return -ENODEV; |
4028 | } | 4032 | } |
4029 | |||
4030 | err = pci_enable_device(c->pdev); | 4033 | err = pci_enable_device(c->pdev); |
4031 | if (err) { | 4034 | if (err) { |
4032 | printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); | 4035 | printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); |