diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2009-11-12 13:49:35 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-11-13 02:45:53 -0500 |
commit | 29009a036f2feb07d8a9b3c715a6365dddd82a7a (patch) | |
tree | ad6034e5b3272144e1277687ffce089aace1a558 /drivers/block | |
parent | 7b838bde922730b9cfeaa93ba80bd31173941495 (diff) |
cciss: clean up code in cciss_shutdown
cciss: clean up code in cciss_shutdown. Send the flush cache
command down with interrupts still enabled, and do not do DMA
from the stack.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4321c94b5525..f804542c1cf2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4376,30 +4376,28 @@ clean_no_release_regions: | |||
4376 | 4376 | ||
4377 | static void cciss_shutdown(struct pci_dev *pdev) | 4377 | static void cciss_shutdown(struct pci_dev *pdev) |
4378 | { | 4378 | { |
4379 | ctlr_info_t *tmp_ptr; | 4379 | ctlr_info_t *h; |
4380 | int i; | 4380 | char *flush_buf; |
4381 | char flush_buf[4]; | ||
4382 | int return_code; | 4381 | int return_code; |
4383 | 4382 | ||
4384 | tmp_ptr = pci_get_drvdata(pdev); | 4383 | h = pci_get_drvdata(pdev); |
4385 | if (tmp_ptr == NULL) | 4384 | flush_buf = kzalloc(4, GFP_KERNEL); |
4386 | return; | 4385 | if (!flush_buf) { |
4387 | i = tmp_ptr->ctlr; | 4386 | printk(KERN_WARNING |
4388 | if (hba[i] == NULL) | 4387 | "cciss:%d cache not flushed, out of memory.\n", |
4388 | h->ctlr); | ||
4389 | return; | 4389 | return; |
4390 | |||
4391 | /* Turn board interrupts off and send the flush cache command */ | ||
4392 | /* sendcmd will turn off interrupt, and send the flush... | ||
4393 | * To write all data in the battery backed cache to disks */ | ||
4394 | memset(flush_buf, 0, 4); | ||
4395 | return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0, | ||
4396 | CTLR_LUNID, TYPE_CMD); | ||
4397 | if (return_code == IO_OK) { | ||
4398 | printk(KERN_INFO "Completed flushing cache on controller %d\n", i); | ||
4399 | } else { | ||
4400 | printk(KERN_WARNING "Error flushing cache on controller %d\n", i); | ||
4401 | } | 4390 | } |
4402 | free_irq(hba[i]->intr[2], hba[i]); | 4391 | /* write all data in the battery backed cache to disk */ |
4392 | memset(flush_buf, 0, 4); | ||
4393 | return_code = sendcmd_withirq(CCISS_CACHE_FLUSH, h->ctlr, flush_buf, | ||
4394 | 4, 0, CTLR_LUNID, TYPE_CMD); | ||
4395 | kfree(flush_buf); | ||
4396 | if (return_code != IO_OK) | ||
4397 | printk(KERN_WARNING "cciss%d: Error flushing cache\n", | ||
4398 | h->ctlr); | ||
4399 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | ||
4400 | free_irq(h->intr[2], h); | ||
4403 | } | 4401 | } |
4404 | 4402 | ||
4405 | static void __devexit cciss_remove_one(struct pci_dev *pdev) | 4403 | static void __devexit cciss_remove_one(struct pci_dev *pdev) |