aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 16:58:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 16:58:28 -0400
commit7233e392760b3493095d3d5885cb15e44493d74a (patch)
treee2095425fe34c635ee2cf77f9ef6022f7cddfbb1 /drivers
parent4c619407b0439c59c20398b9459020c0d297f424 (diff)
parent5ef06839f50c7e5e479d3595257131edf1f84f36 (diff)
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing: staging: Pushdown bkl to easycap ioctl handlers autofs/autofs4: Move compat_ioctl handling into fs v4l: Convert v4l2-dev to unlocked_ioctl ia64/perfmon: Convert to unlocked_ioctl sunrpc: Remove duplicated #include ncpfs: Remove duplicated #include
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/v4l2-dev.c52
-rw-r--r--drivers/staging/easycap/easycap.h8
-rw-r--r--drivers/staging/easycap/easycap_ioctl.c52
-rw-r--r--drivers/staging/easycap/easycap_main.c38
4 files changed, 66 insertions, 84 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 9e89bf617790..249af6a1d56d 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -25,6 +25,7 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/kmod.h> 26#include <linux/kmod.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/smp_lock.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/system.h> 30#include <asm/system.h>
30 31
@@ -215,28 +216,24 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)
215 return vdev->fops->poll(filp, poll); 216 return vdev->fops->poll(filp, poll);
216} 217}
217 218
218static int v4l2_ioctl(struct inode *inode, struct file *filp, 219static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
219 unsigned int cmd, unsigned long arg)
220{ 220{
221 struct video_device *vdev = video_devdata(filp); 221 struct video_device *vdev = video_devdata(filp);
222 int ret;
222 223
223 if (!vdev->fops->ioctl)
224 return -ENOTTY;
225 /* Allow ioctl to continue even if the device was unregistered. 224 /* Allow ioctl to continue even if the device was unregistered.
226 Things like dequeueing buffers might still be useful. */ 225 Things like dequeueing buffers might still be useful. */
227 return vdev->fops->ioctl(filp, cmd, arg); 226 if (vdev->fops->unlocked_ioctl) {
228} 227 ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
229 228 } else if (vdev->fops->ioctl) {
230static long v4l2_unlocked_ioctl(struct file *filp, 229 /* TODO: convert all drivers to unlocked_ioctl */
231 unsigned int cmd, unsigned long arg) 230 lock_kernel();
232{ 231 ret = vdev->fops->ioctl(filp, cmd, arg);
233 struct video_device *vdev = video_devdata(filp); 232 unlock_kernel();
233 } else
234 ret = -ENOTTY;
234 235
235 if (!vdev->fops->unlocked_ioctl) 236 return ret;
236 return -ENOTTY;
237 /* Allow ioctl to continue even if the device was unregistered.
238 Things like dequeueing buffers might still be useful. */
239 return vdev->fops->unlocked_ioctl(filp, cmd, arg);
240} 237}
241 238
242#ifdef CONFIG_MMU 239#ifdef CONFIG_MMU
@@ -307,22 +304,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)
307 return ret; 304 return ret;
308} 305}
309 306
310static const struct file_operations v4l2_unlocked_fops = {
311 .owner = THIS_MODULE,
312 .read = v4l2_read,
313 .write = v4l2_write,
314 .open = v4l2_open,
315 .get_unmapped_area = v4l2_get_unmapped_area,
316 .mmap = v4l2_mmap,
317 .unlocked_ioctl = v4l2_unlocked_ioctl,
318#ifdef CONFIG_COMPAT
319 .compat_ioctl = v4l2_compat_ioctl32,
320#endif
321 .release = v4l2_release,
322 .poll = v4l2_poll,
323 .llseek = no_llseek,
324};
325
326static const struct file_operations v4l2_fops = { 307static const struct file_operations v4l2_fops = {
327 .owner = THIS_MODULE, 308 .owner = THIS_MODULE,
328 .read = v4l2_read, 309 .read = v4l2_read,
@@ -330,7 +311,7 @@ static const struct file_operations v4l2_fops = {
330 .open = v4l2_open, 311 .open = v4l2_open,
331 .get_unmapped_area = v4l2_get_unmapped_area, 312 .get_unmapped_area = v4l2_get_unmapped_area,
332 .mmap = v4l2_mmap, 313 .mmap = v4l2_mmap,
333 .ioctl = v4l2_ioctl, 314 .unlocked_ioctl = v4l2_ioctl,
334#ifdef CONFIG_COMPAT 315#ifdef CONFIG_COMPAT
335 .compat_ioctl = v4l2_compat_ioctl32, 316 .compat_ioctl = v4l2_compat_ioctl32,
336#endif 317#endif
@@ -521,10 +502,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
521 ret = -ENOMEM; 502 ret = -ENOMEM;
522 goto cleanup; 503 goto cleanup;
523 } 504 }
524 if (vdev->fops->unlocked_ioctl) 505 vdev->cdev->ops = &v4l2_fops;
525 vdev->cdev->ops = &v4l2_unlocked_fops;
526 else
527 vdev->cdev->ops = &v4l2_fops;
528 vdev->cdev->owner = vdev->fops->owner; 506 vdev->cdev->owner = vdev->fops->owner;
529 ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1); 507 ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1);
530 if (ret < 0) { 508 if (ret < 0) {
diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h
index ad836d2d26fe..f3c827eb0abe 100644
--- a/drivers/staging/easycap/easycap.h
+++ b/drivers/staging/easycap/easycap.h
@@ -463,15 +463,12 @@ struct data_buffer audio_buffer[];
463void easycap_complete(struct urb *); 463void easycap_complete(struct urb *);
464int easycap_open(struct inode *, struct file *); 464int easycap_open(struct inode *, struct file *);
465int easycap_release(struct inode *, struct file *); 465int easycap_release(struct inode *, struct file *);
466int easycap_ioctl(struct inode *, struct file *, \ 466long easycap_ioctl(struct file *, unsigned int, unsigned long);
467 unsigned int, unsigned long);
468 467
469/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ 468/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
470#if defined(EASYCAP_IS_VIDEODEV_CLIENT) 469#if defined(EASYCAP_IS_VIDEODEV_CLIENT)
471int easycap_open_noinode(struct file *); 470int easycap_open_noinode(struct file *);
472int easycap_release_noinode(struct file *); 471int easycap_release_noinode(struct file *);
473long easycap_ioctl_noinode(struct file *, \
474 unsigned int, unsigned long);
475int videodev_release(struct video_device *); 472int videodev_release(struct video_device *);
476#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ 473#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
477/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ 474/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
@@ -515,8 +512,7 @@ void easysnd_complete(struct urb *);
515ssize_t easysnd_read(struct file *, char __user *, size_t, loff_t *); 512ssize_t easysnd_read(struct file *, char __user *, size_t, loff_t *);
516int easysnd_open(struct inode *, struct file *); 513int easysnd_open(struct inode *, struct file *);
517int easysnd_release(struct inode *, struct file *); 514int easysnd_release(struct inode *, struct file *);
518int easysnd_ioctl(struct inode *, struct file *, \ 515long easysnd_ioctl(struct file *, unsigned int, unsigned long);
519 unsigned int, unsigned long);
520unsigned int easysnd_poll(struct file *, poll_table *); 516unsigned int easysnd_poll(struct file *, poll_table *);
521void easysnd_delete(struct kref *); 517void easysnd_delete(struct kref *);
522int submit_audio_urbs(struct easycap *); 518int submit_audio_urbs(struct easycap *);
diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c
index 276b63dfe27e..9a42ae02cd5d 100644
--- a/drivers/staging/easycap/easycap_ioctl.c
+++ b/drivers/staging/easycap/easycap_ioctl.c
@@ -25,6 +25,7 @@
25*/ 25*/
26/*****************************************************************************/ 26/*****************************************************************************/
27 27
28#include <linux/smp_lock.h>
28#include "easycap.h" 29#include "easycap.h"
29#include "easycap_debug.h" 30#include "easycap_debug.h"
30#include "easycap_standard.h" 31#include "easycap_standard.h"
@@ -773,19 +774,10 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
773SAY("WARNING: failed to adjust mute: control not found\n"); 774SAY("WARNING: failed to adjust mute: control not found\n");
774return -ENOENT; 775return -ENOENT;
775} 776}
776/****************************************************************************/ 777
777/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
778#if defined(EASYCAP_IS_VIDEODEV_CLIENT)
779long
780easycap_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg)\
781 {
782 return easycap_ioctl((struct inode *)NULL, file, cmd, arg);
783}
784#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
785/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
786/*--------------------------------------------------------------------------*/ 778/*--------------------------------------------------------------------------*/
787int easycap_ioctl(struct inode *inode, struct file *file, \ 779static int easycap_ioctl_bkl(struct inode *inode, struct file *file,
788 unsigned int cmd, unsigned long arg) 780 unsigned int cmd, unsigned long arg)
789{ 781{
790static struct easycap *peasycap; 782static struct easycap *peasycap;
791static struct usb_device *p; 783static struct usb_device *p;
@@ -1956,19 +1948,22 @@ default: {
1956} 1948}
1957return 0; 1949return 0;
1958} 1950}
1959/****************************************************************************/ 1951
1960/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ 1952long easycap_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1961#if defined(EASYCAP_IS_VIDEODEV_CLIENT)
1962long
1963easysnd_ioctl_noinode(struct file *file, unsigned int cmd, unsigned long arg)
1964{ 1953{
1965 return easysnd_ioctl((struct inode *)NULL, file, cmd, arg); 1954 struct inode *inode = file->f_dentry->d_inode;
1955 long ret;
1956
1957 lock_kernel();
1958 ret = easycap_ioctl_bkl(inode, file, cmd, arg);
1959 unlock_kernel();
1960
1961 return ret;
1966} 1962}
1967#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ 1963
1968/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
1969/*--------------------------------------------------------------------------*/ 1964/*--------------------------------------------------------------------------*/
1970int easysnd_ioctl(struct inode *inode, struct file *file, \ 1965static int easysnd_ioctl_bkl(struct inode *inode, struct file *file,
1971 unsigned int cmd, unsigned long arg) 1966 unsigned int cmd, unsigned long arg)
1972{ 1967{
1973struct easycap *peasycap; 1968struct easycap *peasycap;
1974struct usb_device *p; 1969struct usb_device *p;
@@ -2158,6 +2153,19 @@ default: {
2158} 2153}
2159return 0; 2154return 0;
2160} 2155}
2156
2157long easysnd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2158{
2159 struct inode *inode = file->f_dentry->d_inode;
2160 long ret;
2161
2162 lock_kernel();
2163 ret = easysnd_ioctl_bkl(inode, file, cmd, arg);
2164 unlock_kernel();
2165
2166 return ret;
2167}
2168
2161/*****************************************************************************/ 2169/*****************************************************************************/
2162int explain_ioctl(__u32 wot) 2170int explain_ioctl(__u32 wot)
2163{ 2171{
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index 09c194ce10a3..5a4bbd9b453f 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -60,13 +60,13 @@ struct usb_driver easycap_usb_driver = {
60 */ 60 */
61/*---------------------------------------------------------------------------*/ 61/*---------------------------------------------------------------------------*/
62const struct file_operations easycap_fops = { 62const struct file_operations easycap_fops = {
63.owner = THIS_MODULE, 63 .owner = THIS_MODULE,
64.open = easycap_open, 64 .open = easycap_open,
65.release = easycap_release, 65 .release = easycap_release,
66.ioctl = easycap_ioctl, 66 .unlocked_ioctl = easycap_ioctl,
67.poll = easycap_poll, 67 .poll = easycap_poll,
68.mmap = easycap_mmap, 68 .mmap = easycap_mmap,
69.llseek = no_llseek, 69 .llseek = no_llseek,
70}; 70};
71struct vm_operations_struct easycap_vm_ops = { 71struct vm_operations_struct easycap_vm_ops = {
72.open = easycap_vma_open, 72.open = easycap_vma_open,
@@ -83,12 +83,12 @@ struct usb_class_driver easycap_class = {
83#if defined(EASYCAP_IS_VIDEODEV_CLIENT) 83#if defined(EASYCAP_IS_VIDEODEV_CLIENT)
84#if defined(EASYCAP_NEEDS_V4L2_FOPS) 84#if defined(EASYCAP_NEEDS_V4L2_FOPS)
85const struct v4l2_file_operations v4l2_fops = { 85const struct v4l2_file_operations v4l2_fops = {
86.owner = THIS_MODULE, 86 .owner = THIS_MODULE,
87.open = easycap_open_noinode, 87 .open = easycap_open_noinode,
88.release = easycap_release_noinode, 88 .release = easycap_release_noinode,
89.ioctl = easycap_ioctl_noinode, 89 .unlocked_ioctl = easycap_ioctl,
90.poll = easycap_poll, 90 .poll = easycap_poll,
91.mmap = easycap_mmap, 91 .mmap = easycap_mmap,
92}; 92};
93#endif /*EASYCAP_NEEDS_V4L2_FOPS*/ 93#endif /*EASYCAP_NEEDS_V4L2_FOPS*/
94int video_device_many /*=0*/; 94int video_device_many /*=0*/;
@@ -102,12 +102,12 @@ struct video_device *pvideo_array[VIDEO_DEVICE_MANY], *pvideo_device;
102 */ 102 */
103/*--------------------------------------------------------------------------*/ 103/*--------------------------------------------------------------------------*/
104const struct file_operations easysnd_fops = { 104const struct file_operations easysnd_fops = {
105.owner = THIS_MODULE, 105 .owner = THIS_MODULE,
106.open = easysnd_open, 106 .open = easysnd_open,
107.release = easysnd_release, 107 .release = easysnd_release,
108.ioctl = easysnd_ioctl, 108 .unlocked_ioctl = easysnd_ioctl,
109.read = easysnd_read, 109 .read = easysnd_read,
110.llseek = no_llseek, 110 .llseek = no_llseek,
111}; 111};
112struct usb_class_driver easysnd_class = { 112struct usb_class_driver easysnd_class = {
113.name = "usb/easysnd%d", 113.name = "usb/easysnd%d",