diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-09-11 13:56:45 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-19 05:29:56 -0400 |
commit | 72024f1ec5164a70d84dd8cf4458fe4064a6b692 (patch) | |
tree | fb0848c2bb91af16f46e2fca8de55675f9b1e3d2 /drivers/media | |
parent | adfedd216d9f0bc3f5bfa8aab42932301d4edc31 (diff) |
dvb-core: kill the big kernel lock
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
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-core/dmxdev.c | 17 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 8 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_net.c | 9 | ||||
-rw-r--r-- | 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 0042306ea11b..2de13b04b09d 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
30 | #include <linux/ioctl.h> | 29 | #include <linux/ioctl.h> |
31 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
@@ -1088,13 +1087,7 @@ static int dvb_demux_do_ioctl(struct file *file, | |||
1088 | static long dvb_demux_ioctl(struct file *file, unsigned int cmd, | 1087 | static long dvb_demux_ioctl(struct file *file, unsigned int cmd, |
1089 | unsigned long arg) | 1088 | unsigned long arg) |
1090 | { | 1089 | { |
1091 | int ret; | 1090 | return dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl); |
1092 | |||
1093 | lock_kernel(); | ||
1094 | ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl); | ||
1095 | unlock_kernel(); | ||
1096 | |||
1097 | return ret; | ||
1098 | } | 1091 | } |
1099 | 1092 | ||
1100 | static unsigned int dvb_demux_poll(struct file *file, poll_table *wait) | 1093 | 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, | |||
1186 | static long dvb_dvr_ioctl(struct file *file, | 1179 | static long dvb_dvr_ioctl(struct file *file, |
1187 | unsigned int cmd, unsigned long arg) | 1180 | unsigned int cmd, unsigned long arg) |
1188 | { | 1181 | { |
1189 | int ret; | 1182 | return dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl); |
1190 | |||
1191 | lock_kernel(); | ||
1192 | ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl); | ||
1193 | unlock_kernel(); | ||
1194 | |||
1195 | return ret; | ||
1196 | } | 1183 | } |
1197 | 1184 | ||
1198 | static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) | 1185 | 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 cb97e6b85432..1723a984a522 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, | |||
1259 | static long dvb_ca_en50221_io_ioctl(struct file *file, | 1259 | static long dvb_ca_en50221_io_ioctl(struct file *file, |
1260 | unsigned int cmd, unsigned long arg) | 1260 | unsigned int cmd, unsigned long arg) |
1261 | { | 1261 | { |
1262 | int ret; | 1262 | return dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl); |
1263 | |||
1264 | lock_kernel(); | ||
1265 | ret = dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl); | ||
1266 | unlock_kernel(); | ||
1267 | |||
1268 | return ret; | ||
1269 | } | 1263 | } |
1270 | 1264 | ||
1271 | 1265 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 6c3a8a06ccab..a08032284cbf 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include <linux/netdevice.h> | 59 | #include <linux/netdevice.h> |
60 | #include <linux/etherdevice.h> | 60 | #include <linux/etherdevice.h> |
61 | #include <linux/dvb/net.h> | 61 | #include <linux/dvb/net.h> |
62 | #include <linux/smp_lock.h> | ||
63 | #include <linux/uio.h> | 62 | #include <linux/uio.h> |
64 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
65 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
@@ -1445,13 +1444,7 @@ static int dvb_net_do_ioctl(struct file *file, | |||
1445 | static long dvb_net_ioctl(struct file *file, | 1444 | static long dvb_net_ioctl(struct file *file, |
1446 | unsigned int cmd, unsigned long arg) | 1445 | unsigned int cmd, unsigned long arg) |
1447 | { | 1446 | { |
1448 | int ret; | 1447 | return dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl); |
1449 | |||
1450 | lock_kernel(); | ||
1451 | ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl); | ||
1452 | unlock_kernel(); | ||
1453 | |||
1454 | return ret; | ||
1455 | } | 1448 | } |
1456 | 1449 | ||
1457 | static int dvb_net_close(struct inode *inode, struct file *file) | 1450 | 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 b915c39d782f..28f486edcaf0 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -32,9 +32,9 @@ | |||
32 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
33 | #include <linux/cdev.h> | 33 | #include <linux/cdev.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include "dvbdev.h" | 35 | #include "dvbdev.h" |
37 | 36 | ||
37 | static DEFINE_MUTEX(dvbdev_mutex); | ||
38 | static int dvbdev_debug; | 38 | static int dvbdev_debug; |
39 | 39 | ||
40 | module_param(dvbdev_debug, int, 0644); | 40 | module_param(dvbdev_debug, int, 0644); |
@@ -68,7 +68,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) | |||
68 | { | 68 | { |
69 | struct dvb_device *dvbdev; | 69 | struct dvb_device *dvbdev; |
70 | 70 | ||
71 | lock_kernel(); | 71 | mutex_lock(&dvbdev_mutex); |
72 | down_read(&minor_rwsem); | 72 | down_read(&minor_rwsem); |
73 | dvbdev = dvb_minors[iminor(inode)]; | 73 | dvbdev = dvb_minors[iminor(inode)]; |
74 | 74 | ||
@@ -91,12 +91,12 @@ static int dvb_device_open(struct inode *inode, struct file *file) | |||
91 | } | 91 | } |
92 | fops_put(old_fops); | 92 | fops_put(old_fops); |
93 | up_read(&minor_rwsem); | 93 | up_read(&minor_rwsem); |
94 | unlock_kernel(); | 94 | mutex_unlock(&dvbdev_mutex); |
95 | return err; | 95 | return err; |
96 | } | 96 | } |
97 | fail: | 97 | fail: |
98 | up_read(&minor_rwsem); | 98 | up_read(&minor_rwsem); |
99 | unlock_kernel(); | 99 | mutex_unlock(&dvbdev_mutex); |
100 | return -ENODEV; | 100 | return -ENODEV; |
101 | } | 101 | } |
102 | 102 | ||
@@ -158,7 +158,6 @@ long dvb_generic_ioctl(struct file *file, | |||
158 | unsigned int cmd, unsigned long arg) | 158 | unsigned int cmd, unsigned long arg) |
159 | { | 159 | { |
160 | struct dvb_device *dvbdev = file->private_data; | 160 | struct dvb_device *dvbdev = file->private_data; |
161 | int ret; | ||
162 | 161 | ||
163 | if (!dvbdev) | 162 | if (!dvbdev) |
164 | return -ENODEV; | 163 | return -ENODEV; |
@@ -166,11 +165,7 @@ long dvb_generic_ioctl(struct file *file, | |||
166 | if (!dvbdev->kernel_ioctl) | 165 | if (!dvbdev->kernel_ioctl) |
167 | return -EINVAL; | 166 | return -EINVAL; |
168 | 167 | ||
169 | lock_kernel(); | 168 | return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl); |
170 | ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl); | ||
171 | unlock_kernel(); | ||
172 | |||
173 | return ret; | ||
174 | } | 169 | } |
175 | EXPORT_SYMBOL(dvb_generic_ioctl); | 170 | EXPORT_SYMBOL(dvb_generic_ioctl); |
176 | 171 | ||
@@ -421,8 +416,10 @@ int dvb_usercopy(struct file *file, | |||
421 | } | 416 | } |
422 | 417 | ||
423 | /* call driver */ | 418 | /* call driver */ |
419 | mutex_lock(&dvbdev_mutex); | ||
424 | if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD) | 420 | if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD) |
425 | err = -EINVAL; | 421 | err = -EINVAL; |
422 | mutex_unlock(&dvbdev_mutex); | ||
426 | 423 | ||
427 | if (err < 0) | 424 | if (err < 0) |
428 | goto out; | 425 | goto out; |