mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Arnd Bergmann <arndbergmann@googlemail.com>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH] sony_pi: Remove the BKL from sonypi_misc_open
Date: Mon, 19 Oct 2009 20:20:30 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0910192019420.3563@localhost.localdomain> (raw)
In-Reply-To: <200910190619.48037.arnd@arndb.de>



On Mon, 19 Oct 2009, Arnd Bergmann wrote:

> On Sunday 18 October 2009, John Kacur wrote:
> > The BKL is in this function because of the BKL pushdown
> > (see commit f8f2c79d594463427f7114cedb1555110d547d89)
> > 
> > It is not needed here because the mutex_lock sonypi_device.lock
> > provides the necessary locking.
> 
> The driver still uses the BKL in the ioctl function, which can
> probably be removed at the same time.
> 
> 	Arnd <><
> 

How does this look? (Version 2 of the patch follows)

>From efd07cfcd021b4438d83d383ab81f9b35cb41eb9 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Sun, 18 Oct 2009 23:49:49 +0200
Subject: [PATCH] sony_pi: Remove the BKL from sonypi_misc_open

The BKL is in this function because of the BKL pushdown
(see commit f8f2c79d594463427f7114cedb1555110d547d89)

It is not needed here because the mutex_lock sonypi_device.lock
provides the necessary locking.

sonpi_misc_ioctl can be converted to unlocked ioctls since it relies on
its own locking (the mutex sonypi_device.lock) and not the bkl

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

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 8c262aa..593cbb5 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -50,7 +50,6 @@
 #include <linux/err.h>
 #include <linux/kfifo.h>
 #include <linux/platform_device.h>
-#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -902,14 +901,13 @@ static int sonypi_misc_release(struct inode *inode, struct file *file)
 
 static int sonypi_misc_open(struct inode *inode, struct file *file)
 {
-	lock_kernel();
 	mutex_lock(&sonypi_device.lock);
 	/* Flush input queue on first open */
 	if (!sonypi_device.open_count)
 		kfifo_reset(sonypi_device.fifo);
 	sonypi_device.open_count++;
 	mutex_unlock(&sonypi_device.lock);
-	unlock_kernel();
+
 	return 0;
 }
 
@@ -951,10 +949,10 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait)
 	return 0;
 }
 
-static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
+static long sonypi_misc_ioctl(struct file *fp,
 			     unsigned int cmd, unsigned long arg)
 {
-	int ret = 0;
+	long ret = 0;
 	void __user *argp = (void __user *)arg;
 	u8 val8;
 	u16 val16;
@@ -1070,7 +1068,7 @@ static const struct file_operations sonypi_misc_fops = {
 	.open		= sonypi_misc_open,
 	.release	= sonypi_misc_release,
 	.fasync		= sonypi_misc_fasync,
-	.ioctl		= sonypi_misc_ioctl,
+	.unlocked_ioctl	= sonypi_misc_ioctl,
 };
 
 static struct miscdevice sonypi_misc_device = {
-- 
1.6.0.6



  reply	other threads:[~2009-10-19 18:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 21:54 John Kacur
2009-10-19  4:19 ` Arnd Bergmann
2009-10-19 18:20   ` John Kacur [this message]
2009-10-19 22:00     ` Arnd Bergmann
2009-10-19 22:08       ` Arnd Bergmann
2009-10-21  0:06         ` John Kacur
2009-10-21  8:29           ` Arnd Bergmann
2009-10-21 10:27             ` John Kacur
2009-10-21 13:16               ` Arnd Bergmann
2009-10-22  2:52             ` Christoph Hellwig
2009-10-21 21:31         ` Frederic Weisbecker
2009-10-21 21:41           ` John Kacur
2009-10-21 21:55             ` Frederic Weisbecker
2009-10-21 22:06               ` John Kacur
2009-10-21 22:27                 ` Frederic Weisbecker
2009-10-22  2:55           ` Christoph Hellwig
2009-10-22 13:50             ` Arnd Bergmann
2009-10-25  7:30               ` Christoph Hellwig
2009-10-19 22:30       ` Mattia Dongili

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=alpine.LFD.2.00.0910192019420.3563@localhost.localdomain \
    --to=jkacur@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arndbergmann@googlemail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®