diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 15:13:12 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 12:01:06 -0500 |
commit | 2c4c8c8b662286230a798c60408d217aeab55f7f (patch) | |
tree | 03bf7c1c2b8dd74056d0f6ce1cda8228a735db00 /drivers/scsi/hpsa.c | |
parent | 3a7774ceb89f02f78e269b5c900096b066b66c3c (diff) | |
download | linux-2c4c8c8b662286230a798c60408d217aeab55f7f.tar.bz2 |
[SCSI] hpsa: factor out hpsa_wait_for_board_ready
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.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 0582f2fc11f0..66c4fc306f2c 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -3302,9 +3302,23 @@ static int __devinit hpsa_pci_find_memory_BAR(struct ctlr_info *h, return -ENODEV; } +static int __devinit hpsa_wait_for_board_ready(struct ctlr_info *h) +{ + int i; + u32 scratchpad; + + for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) { + scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); + if (scratchpad == HPSA_FIRMWARE_READY) + return 0; + msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS); + } + dev_warn(&h->pdev->dev, "board not ready, timed out.\n"); + return -ENODEV; +} + static int __devinit hpsa_pci_init(struct ctlr_info *h) { - u32 scratchpad = 0; u64 cfg_offset; u32 cfg_base_addr; u64 cfg_base_addr_index; @@ -3339,18 +3353,9 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h) goto err_out_free_res; h->vaddr = remap_pci_mem(h->paddr, 0x250); - /* Wait for the board to become ready. */ - for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) { - scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); - if (scratchpad == HPSA_FIRMWARE_READY) - break; - msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS); - } - if (scratchpad != HPSA_FIRMWARE_READY) { - dev_warn(&h->pdev->dev, "board not ready, timed out.\n"); - err = -ENODEV; + err = hpsa_wait_for_board_ready(h); + if (err) goto err_out_free_res; - } /* get the address index number */ cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET); |