mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC] [PATCH] drivers/scsi/ch.c: Remove BKL in ch_open
@ 2009-10-11 13:45 John Kacur
  2009-10-11 14:37 ` Alan Cox
  2009-10-12 13:03 ` Stefan Richter
  0 siblings, 2 replies; 9+ messages in thread
From: John Kacur @ 2009-10-11 13:45 UTC (permalink / raw)
  To: linux-kernel, Thomas Gleixner
  Cc: Frederic Weisbecker, Ingo Molnar, Christoph Hellwig,
	Jonathan Corbet, Andrew Morton, Vincent Sanders, Alan Cox


Locking in ch_open is covered by the spin_lock, it serializes the calls
to idr_find and scsi_device_get. The BKL appears redundant to me here.

>From b385c85bb5c2579e542cfe55475b729325eb65e1 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Sun, 11 Oct 2009 13:06:54 +0200
Subject: [PATCH] drivers/scsi/ch.c: Remove BKL in ch_open

Everything in ch_open is covered by a spin_lock, so the lock_kernel is redundant
Remove it.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 drivers/scsi/ch.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index fe11c1d..4ba8b67 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -579,19 +579,16 @@ ch_open(struct inode *inode, struct file *file)
 	scsi_changer *ch;
 	int minor = iminor(inode);
 
-	lock_kernel();
 	spin_lock(&ch_index_lock);
 	ch = idr_find(&ch_index_idr, minor);
 
 	if (NULL == ch || scsi_device_get(ch->device)) {
 		spin_unlock(&ch_index_lock);
-		unlock_kernel();
 		return -ENXIO;
 	}
+	file->private_data = ch;
 	spin_unlock(&ch_index_lock);
 
-	file->private_data = ch;
-	unlock_kernel();
 	return 0;
 }
 
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-10-12 13:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-11 13:45 [PATCH RFC] [PATCH] drivers/scsi/ch.c: Remove BKL in ch_open John Kacur
2009-10-11 14:37 ` Alan Cox
2009-10-11 15:29   ` Arjan van de Ven
2009-10-11 15:54     ` Alan Cox
2009-10-11 16:03       ` Arjan van de Ven
2009-10-11 16:14         ` Alan Cox
2009-10-11 16:19           ` Arjan van de Ven
2009-10-11 17:09             ` Jonathan Corbet
2009-10-12 13:03 ` Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®