LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Linus Torvalds <torvalds@osdl.org>,
	James Bottomley <James.Bottomley@steeleye.com>,
	Al Viro <viro@ftp.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Sparse fix for scsi_request_fn
Date: Mon, 22 Oct 2007 19:48:45 -0600	[thread overview]
Message-ID: <20071023014845.GN27248@parisc-linux.org> (raw)

Introduce new __holds() macro to tell sparse it's OK to drop and then
reacquire a lock within a function.  Use it in scsi_request_fn.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 207f1aa..5e0583a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1374,6 +1372,7 @@ static void scsi_softirq_done(struct request *rq)
  * Lock status: IO request lock assumed to be held when called.
  */
 static void scsi_request_fn(struct request_queue *q)
+		__holds(q->queue_lock)
 {
 	struct scsi_device *sdev = q->queuedata;
 	struct Scsi_Host *shost;
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 86f9a3a..1611ac6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -12,6 +12,7 @@
 # define __iomem	__attribute__((noderef, address_space(2)))
 # define __acquires(x)	__attribute__((context(x,0,1)))
 # define __releases(x)	__attribute__((context(x,1,0)))
+# define __holds(x)	__attribute__((context(x,1,1)))
 # define __acquire(x)	__context__(x,1)
 # define __release(x)	__context__(x,-1)
 # define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
@@ -29,6 +30,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 # define __builtin_warning(x, y...) (1)
 # define __acquires(x)
 # define __releases(x)
+# define __holds(x)
 # define __acquire(x) (void)0
 # define __release(x) (void)0
 # define __cond_lock(x,c) (c)

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

             reply	other threads:[~2007-10-23  1:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  1:48 Matthew Wilcox [this message]
2007-10-23  2:09 ` Linus Torvalds
2007-10-23 21:13   ` Matthew Wilcox

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=20071023014845.GN27248@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    --subject='Re: Sparse fix for scsi_request_fn' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).