Commit 29009a03 authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by Jens Axboe

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: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 7b838bde
...@@ -4376,30 +4376,28 @@ clean_no_release_regions: ...@@ -4376,30 +4376,28 @@ clean_no_release_regions:
static void cciss_shutdown(struct pci_dev *pdev) static void cciss_shutdown(struct pci_dev *pdev)
{ {
ctlr_info_t *tmp_ptr; ctlr_info_t *h;
int i; char *flush_buf;
char flush_buf[4];
int return_code; int return_code;
tmp_ptr = pci_get_drvdata(pdev); h = pci_get_drvdata(pdev);
if (tmp_ptr == NULL) flush_buf = kzalloc(4, GFP_KERNEL);
return; if (!flush_buf) {
i = tmp_ptr->ctlr; printk(KERN_WARNING
if (hba[i] == NULL) "cciss:%d cache not flushed, out of memory.\n",
h->ctlr);
return; return;
/* Turn board interrupts off and send the flush cache command */
/* sendcmd will turn off interrupt, and send the flush...
* To write all data in the battery backed cache to disks */
memset(flush_buf, 0, 4);
return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0,
CTLR_LUNID, TYPE_CMD);
if (return_code == IO_OK) {
printk(KERN_INFO "Completed flushing cache on controller %d\n", i);
} else {
printk(KERN_WARNING "Error flushing cache on controller %d\n", i);
} }
free_irq(hba[i]->intr[2], hba[i]); /* write all data in the battery backed cache to disk */
memset(flush_buf, 0, 4);
return_code = sendcmd_withirq(CCISS_CACHE_FLUSH, h->ctlr, flush_buf,
4, 0, CTLR_LUNID, TYPE_CMD);
kfree(flush_buf);
if (return_code != IO_OK)
printk(KERN_WARNING "cciss%d: Error flushing cache\n",
h->ctlr);
h->access.set_intr_mask(h, CCISS_INTR_OFF);
free_irq(h->intr[2], h);
} }
static void __devexit cciss_remove_one(struct pci_dev *pdev) static void __devexit cciss_remove_one(struct pci_dev *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment