From: Arnd Bergmann <arnd@arndb.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 16/18] dvb-core: kill the big kernel lock
Date: Tue, 14 Sep 2010 21:55:22 +0200 [thread overview]
Message-ID: <1284494124-7384-7-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1284493213-7263-1-git-send-email-arnd@arndb.de>
The dvb core only uses the big kernel lock in the open
and ioctl functions, which means it can be replaced with
a dvb specific mutex. Fortunately, all the ioctl functions
go through dvb_usercopy, so we can move the serialization
in there.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: linux-media@vger.kernel.org
---
drivers/media/dvb/dvb-core/dmxdev.c | 17 ++---------------
drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 8 +-------
drivers/media/dvb/dvb-core/dvb_net.c | 9 +--------
drivers/media/dvb/dvb-core/dvbdev.c | 17 +++++++----------
4 files changed, 11 insertions(+), 40 deletions(-)
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 0042306..2de13b0 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -25,7 +25,6 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <linux/poll.h>
#include <linux/ioctl.h>
#include <linux/wait.h>
@@ -1088,13 +1087,7 @@ static int dvb_demux_do_ioctl(struct file *file,
static long dvb_demux_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
- int ret;
-
- lock_kernel();
- ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
- unlock_kernel();
-
- return ret;
+ return dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
}
static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
@@ -1186,13 +1179,7 @@ static int dvb_dvr_do_ioctl(struct file *file,
static long dvb_dvr_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
- int ret;
-
- lock_kernel();
- ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
- unlock_kernel();
-
- return ret;
+ return dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
}
static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index cb97e6b..1723a98 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -1259,13 +1259,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
static long dvb_ca_en50221_io_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
- int ret;
-
- lock_kernel();
- ret = dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
- unlock_kernel();
-
- return ret;
+ return dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
}
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index 6c3a8a0..a080322 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -59,7 +59,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/dvb/net.h>
-#include <linux/smp_lock.h>
#include <linux/uio.h>
#include <asm/uaccess.h>
#include <linux/crc32.h>
@@ -1445,13 +1444,7 @@ static int dvb_net_do_ioctl(struct file *file,
static long dvb_net_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
- int ret;
-
- lock_kernel();
- ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
- unlock_kernel();
-
- return ret;
+ return dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
}
static int dvb_net_close(struct inode *inode, struct file *file)
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index b915c39..28f486e 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -32,9 +32,9 @@
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/mutex.h>
-#include <linux/smp_lock.h>
#include "dvbdev.h"
+static DEFINE_MUTEX(dvbdev_mutex);
static int dvbdev_debug;
module_param(dvbdev_debug, int, 0644);
@@ -68,7 +68,7 @@ static int dvb_device_open(struct inode *inode, struct file *file)
{
struct dvb_device *dvbdev;
- lock_kernel();
+ mutex_lock(&dvbdev_mutex);
down_read(&minor_rwsem);
dvbdev = dvb_minors[iminor(inode)];
@@ -91,12 +91,12 @@ static int dvb_device_open(struct inode *inode, struct file *file)
}
fops_put(old_fops);
up_read(&minor_rwsem);
- unlock_kernel();
+ mutex_unlock(&dvbdev_mutex);
return err;
}
fail:
up_read(&minor_rwsem);
- unlock_kernel();
+ mutex_unlock(&dvbdev_mutex);
return -ENODEV;
}
@@ -158,7 +158,6 @@ long dvb_generic_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct dvb_device *dvbdev = file->private_data;
- int ret;
if (!dvbdev)
return -ENODEV;
@@ -166,11 +165,7 @@ long dvb_generic_ioctl(struct file *file,
if (!dvbdev->kernel_ioctl)
return -EINVAL;
- lock_kernel();
- ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
- unlock_kernel();
-
- return ret;
+ return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
}
EXPORT_SYMBOL(dvb_generic_ioctl);
@@ -421,8 +416,10 @@ int dvb_usercopy(struct file *file,
}
/* call driver */
+ mutex_lock(&dvbdev_mutex);
if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL;
+ mutex_unlock(&dvbdev_mutex);
if (err < 0)
goto out;
--
1.7.1
next prev parent reply other threads:[~2010-09-14 19:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1284493139-7233-1-git-send-email-arnd@arndb.de>
2010-09-14 19:40 ` [PATCH 00/18] Make the big kernel lock optional Arnd Bergmann
2010-09-14 19:55 ` [PATCH 10/18] uml: kill big kernel lock Arnd Bergmann
2010-09-14 19:55 ` [PATCH 11/18] fix rawctl compat ioctls breakage on amd64 and itanic Arnd Bergmann
2010-09-14 19:55 ` [PATCH 12/18] tlclk: remove big kernel lock Arnd Bergmann
2010-09-14 19:55 ` [PATCH 13/18] i4l: kill " Arnd Bergmann
2010-09-14 19:55 ` [PATCH 14/18] misdn: " Arnd Bergmann
2010-09-14 19:55 ` [PATCH 15/18] dvb/bt8xx: kill the " Arnd Bergmann
2010-09-14 19:55 ` Arnd Bergmann [this message]
2010-09-14 19:55 ` [PATCH 17/18] rtmutex-tester: make it build without BKL Arnd Bergmann
2010-09-14 19:55 ` [PATCH 18/18] BKL: introduce CONFIG_BKL Arnd Bergmann
2010-09-14 19:40 ` [PATCH 01/18] hpet: kill BKL, add compat_ioctl Arnd Bergmann
2010-09-14 19:40 ` [PATCH 02/18] proc/pci: kill BKL Arnd Bergmann
2010-09-14 19:40 ` [PATCH 03/18] s390/block: kill the big kernel lock Arnd Bergmann
2010-09-14 19:40 ` [PATCH 04/18] isapnp: BKL removal Arnd Bergmann
2010-09-15 9:31 ` Will Newton
2010-09-14 19:40 ` [PATCH 05/18] alpha: kill big kernel lock Arnd Bergmann
2010-09-14 19:40 ` [PATCH 06/18] cris: autoconvert trivial BKL users Arnd Bergmann
2010-09-14 19:40 ` [PATCH 07/18] m68k: remove big kernel lock Arnd Bergmann
2010-09-14 19:40 ` [PATCH 08/18] parisc: " Arnd Bergmann
2010-09-14 19:40 ` [PATCH 09/18] sh: kill " Arnd Bergmann
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=1284494124-7384-7-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome