diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-07-19 20:45:15 +0200 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 18:52:11 +0200 |
commit | e99ba1362723df14bbe36da6eeaadf81d95782e6 (patch) | |
tree | 5bf701fa79a250f1fde71b1b22cf6e35b21e9c59 /drivers/block/cciss.c | |
parent | cciss: factor out cciss_find_memory_BAR() (diff) | |
download | linux-e99ba1362723df14bbe36da6eeaadf81d95782e6.tar.xz linux-e99ba1362723df14bbe36da6eeaadf81d95782e6.zip |
cciss: factor out cciss_wait_for_board_ready()
cciss: factor out cciss_wait_for_board_ready()
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 | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 9c9c79c0aa98..286c81d70818 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -4026,9 +4026,23 @@ static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, return -ENODEV; } +static int __devinit cciss_wait_for_board_ready(ctlr_info_t *h) +{ + int i; + u32 scratchpad; + + for (i = 0; i < CCISS_BOARD_READY_ITERATIONS; i++) { + scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); + if (scratchpad == CCISS_FIRMWARE_READY) + return 0; + msleep(CCISS_BOARD_READY_POLL_INTERVAL_MSECS); + } + dev_warn(&h->pdev->dev, "board not ready, timed out.\n"); + return -ENODEV; +} + static int __devinit cciss_pci_init(ctlr_info_t *c) { - __u32 scratchpad = 0; __u64 cfg_offset; __u32 cfg_base_addr; __u64 cfg_base_addr_index; @@ -4073,21 +4087,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c) if (err) goto err_out_free_res; c->vaddr = remap_pci_mem(c->paddr, 0x250); - - /* Wait for the board to become ready. (PCI hotplug needs this.) - * We poll for up to 120 secs, once per 100ms. */ - for (i = 0; i < 1200; i++) { - scratchpad = readl(c->vaddr + SA5_SCRATCHPAD_OFFSET); - if (scratchpad == CCISS_FIRMWARE_READY) - break; - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(msecs_to_jiffies(100)); /* wait 100ms */ - } - if (scratchpad != CCISS_FIRMWARE_READY) { - printk(KERN_WARNING "cciss: Board not ready. Timed out.\n"); - err = -ENODEV; + err = cciss_wait_for_board_ready(c); + if (err) goto err_out_free_res; - } /* get the address index number */ cfg_base_addr = readl(c->vaddr + SA5_CTCFG_OFFSET); |