public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: axboe@kernel.dk, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, mikem@beardog.cce.hp.com,
	achiang@hp.com, brace@beardog.cce.hp.com
Subject: [PATCH 05/11] cciss: clean up code in cciss_shutdown
Date: Thu, 12 Nov 2009 12:49:35 -0600	[thread overview]
Message-ID: <20091112184935.23389.14125.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20091112184542.23389.36220.stgit@beardog.cce.hp.com>

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

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>
---
 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 4321c94..f804542 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4376,30 +4376,28 @@ clean_no_release_regions:
 
 static void cciss_shutdown(struct pci_dev *pdev)
 {
-	ctlr_info_t *tmp_ptr;
-	int i;
-	char flush_buf[4];
+	ctlr_info_t *h;
+	char *flush_buf;
 	int return_code;
 
-	tmp_ptr = pci_get_drvdata(pdev);
-	if (tmp_ptr == NULL)
-		return;
-	i = tmp_ptr->ctlr;
-	if (hba[i] == NULL)
+	h = pci_get_drvdata(pdev);
+	flush_buf = kzalloc(4, GFP_KERNEL);
+	if (!flush_buf) {
+		printk(KERN_WARNING
+			"cciss:%d cache not flushed, out of memory.\n",
+			h->ctlr);
 		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)


  parent reply	other threads:[~2009-11-12 18:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12 18:49 [PATCH 00/11] cciss: driver updates Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 01/11] cciss: Make device attributes static Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 02/11] cciss: Fix problem with remove_from_scan_list on driver unload Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 03/11] cciss: Retry driver initiated cmds with unit attention condition Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 04/11] cciss: Remove the "withirq" parameter from various functions where possible Stephen M. Cameron
2009-11-12 18:49 ` Stephen M. Cameron [this message]
2009-11-12 18:49 ` [PATCH 06/11] cciss: remove sendcmd() as it is no longer used Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 07/11] cciss: fix typo that causes scsi status to be lost Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 08/11] cciss: Remove unnecessary check in scan_thread Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 09/11] cciss: Do not automatically rescan on UNIT ATTENTION/LUN DATA CHANGED Stephen M. Cameron
2009-11-12 18:50 ` [PATCH 10/11] cciss: Add enhanced scatter-gather support Stephen M. Cameron
2009-11-12 18:50 ` [PATCH 11/11] cciss: Fix weird usage of ENXIO in cciss_scsi.c Stephen M. Cameron
2009-11-13  7:46 ` [PATCH 00/11] cciss: driver updates Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091112184935.23389.14125.stgit@beardog.cce.hp.com \
    --to=scameron@beardog.cce.hp.com \
    --cc=achiang@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=brace@beardog.cce.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikem@beardog.cce.hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox