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
Cc: akpm@linux-foundation.org, mikem@beardog.cce.hp.com,
	linux-kernel@vger.kernel.org, brace@beardog.cce.hp.com
Subject: [PATCH 03/13] cciss: factor out cciss_setintinfo
Date: Thu, 26 Aug 2010 13:55:44 -0500	[thread overview]
Message-ID: <20100826185544.9067.28636.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20100826185315.9067.25060.stgit@beardog.cce.hp.com>

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

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |   66 ++++++++++++++++++++++++-------------------------
 1 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 14380c4..5ff5a1d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1262,6 +1262,37 @@ static int cciss_getintinfo(ctlr_info_t *h, void __user *argp)
 	return 0;
 }
 
+static int cciss_setintinfo(ctlr_info_t *h, void __user *argp)
+{
+	cciss_coalint_struct intinfo;
+	unsigned long flags;
+	int i;
+
+	if (!argp)
+		return -EINVAL;
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+	if (copy_from_user(&intinfo, argp, sizeof(intinfo)))
+		return -EFAULT;
+	if ((intinfo.delay == 0) && (intinfo.count == 0))
+		return -EINVAL;
+	spin_lock_irqsave(&h->lock, flags);
+	/* Update the field, and then ring the doorbell */
+	writel(intinfo.delay, &(h->cfgtable->HostWrite.CoalIntDelay));
+	writel(intinfo.count, &(h->cfgtable->HostWrite.CoalIntCount));
+	writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
+
+	for (i = 0; i < MAX_IOCTL_CONFIG_WAIT; i++) {
+		if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
+			break;
+		udelay(1000); /* delay and try again */
+	}
+	spin_unlock_irqrestore(&h->lock, flags);
+	if (i >= MAX_IOCTL_CONFIG_WAIT)
+		return -EAGAIN;
+	return 0;
+}
+
 static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
 		       unsigned int cmd, unsigned long arg)
 {
@@ -1278,40 +1309,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
 	case CCISS_GETINTINFO:
 		return cciss_getintinfo(h, argp);
 	case CCISS_SETINTINFO:
-		{
-			cciss_coalint_struct intinfo;
-			unsigned long flags;
-			int i;
-
-			if (!arg)
-				return -EINVAL;
-			if (!capable(CAP_SYS_ADMIN))
-				return -EPERM;
-			if (copy_from_user
-			    (&intinfo, argp, sizeof(cciss_coalint_struct)))
-				return -EFAULT;
-			if ((intinfo.delay == 0) && (intinfo.count == 0))
-				return -EINVAL;
-			spin_lock_irqsave(&h->lock, flags);
-			/* Update the field, and then ring the doorbell */
-			writel(intinfo.delay,
-			       &(h->cfgtable->HostWrite.CoalIntDelay));
-			writel(intinfo.count,
-			       &(h->cfgtable->HostWrite.CoalIntCount));
-			writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
-
-			for (i = 0; i < MAX_IOCTL_CONFIG_WAIT; i++) {
-				if (!(readl(h->vaddr + SA5_DOORBELL)
-				      & CFGTBL_ChangeReq))
-					break;
-				/* delay and try again */
-				udelay(1000);
-			}
-			spin_unlock_irqrestore(&h->lock, flags);
-			if (i >= MAX_IOCTL_CONFIG_WAIT)
-				return -EAGAIN;
-			return 0;
-		}
+		return cciss_setintinfo(h, argp);
 	case CCISS_GETNODENAME:
 		{
 			NodeName_type NodeName;


  parent reply	other threads:[~2010-08-26 18:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 18:55 [PATCH 00/13] cciss: clean up cciss_ioctl() Stephen M. Cameron
2010-08-26 18:55 ` [PATCH 01/13] cciss: factor out cciss_getpciinfo Stephen M. Cameron
2010-08-26 18:55 ` [PATCH 02/13] cciss: factor out cciss_getintinfo Stephen M. Cameron
2010-08-26 18:55 ` Stephen M. Cameron [this message]
2010-08-26 18:55 ` [PATCH 04/13] cciss: factor out cciss_getnodename Stephen M. Cameron
2010-08-26 18:55 ` [PATCH 05/13] cciss: factor out cciss_setnodename Stephen M. Cameron
2010-08-26 18:55 ` [PATCH 06/13] cciss: factor out cciss_getheartbeat Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 07/13] cciss: factor out cciss_getbustypes Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 08/13] cciss: factor out cciss_getfirmver Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 09/13] cciss: factor out cciss_getdrivver Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 10/13] cciss: factor out cciss_getluninfo Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 11/13] cciss: factor out cciss_passthru Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 12/13] cciss: factor out cciss_big_passthru Stephen M. Cameron
2010-08-26 18:56 ` [PATCH 13/13] cciss: remove some superfluous tests from cciss_bigpassthru() Stephen M. Cameron
2010-09-10 10:13 ` [PATCH 00/13] cciss: clean up cciss_ioctl() 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=20100826185544.9067.28636.stgit@beardog.cce.hp.com \
    --to=scameron@beardog.cce.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