bkl: pushdowns from Arnd, and compile fixes
Subsystems (35)
cover bkl: pushdowns from Arnd, and compile fixes
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing on x86_64 I found a number of issues that I fixed-up
I pushed these to my own new linus-bkl tree.git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.git linux-bkl
Frederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Presented separately here for everyone's easy perusal.
Arnd Bergmann (6):
dvb: push down BKL into ioctl functions
scsi: push down BKL into ioctl functions
isdn: push down BKL into ioctl functions
staging: push down BKL into ioctl functions
v4l: always use unlocked_ioctl
drivers: push down BKL into various drivers
John Kacur (4):
bkl: Fix up compile problems in megaraid from bkl push-down
bkl: Fix missing inode tw_chrdev_ioctl due to bkl pushdown
bkl: Fix missing inode in twl_chrdev_ioctl resulting from bkl
pushdown
bkl: Fix-up compile problems as a result of the bkl-pushdown.
drivers/block/pktcdvd.c | 13 ++++++-- drivers/char/apm-emulation.c | 8 +++-- drivers/char/applicom.c | 13 +++++--- drivers/char/ds1620.c | 16 ++++++++- drivers/char/dtlk.c | 15 +++++---- drivers/char/generic_nvram.c | 17 ++++++++-- drivers/char/genrtc.c | 16 ++++++++- drivers/char/hpet.c | 14 +++++--- drivers/char/i8k.c | 21 ++++++++++-- drivers/char/ipmi/ipmi_devintf.c | 26 +++++++++++++--- drivers/char/ipmi/ipmi_watchdog.c | 17 +++++++++- drivers/char/nvram.c | 10 ++++-- drivers/char/nwflash.c | 7 +++- drivers/char/raw.c | 42 ++++++++++++++----------- drivers/hwmon/fschmd.c | 9 +++-- drivers/hwmon/w83793.c | 10 ++++-- drivers/input/misc/hp_sdc_rtc.c | 34 ++++++++++++++------ drivers/isdn/capi/capi.c | 17 ++++++++-- drivers/isdn/divert/divert_procfs.c | 19 ++++++++++-- drivers/isdn/i4l/isdn_common.c | 18 +++++++++-- drivers/isdn/mISDN/timerdev.c | 10 ++++-- drivers/macintosh/nvram.c | 2 +- drivers/macintosh/via-pmu.c | 17 ++++++++-- drivers/media/dvb/dvb-core/dmxdev.c | 31 +++++++++++++----- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 17 +++++++--- drivers/media/dvb/dvb-core/dvb_frontend.c | 30 +++++++++--------- drivers/media/dvb/dvb-core/dvb_net.c | 15 +++++++-- drivers/media/dvb/dvb-core/dvbdev.c | 17 +++++++---- drivers/media/dvb/dvb-core/dvbdev.h | 11 ++---- drivers/media/dvb/firewire/firedtv-ci.c | 5 +-- drivers/media/dvb/ttpci/av7110.c | 4 +- drivers/media/dvb/ttpci/av7110_av.c | 8 ++-- drivers/media/dvb/ttpci/av7110_ca.c | 5 +-- drivers/media/video/v4l2-dev.c | 19 +++++++++-- drivers/mtd/mtdchar.c | 19 ++++++++--- drivers/pcmcia/pcmcia_ioctl.c | 17 ++++++++-- drivers/rtc/rtc-m41t80.c | 16 ++++++++- drivers/sbus/char/openprom.c | 44 +++++++++++++++----------- drivers/scsi/3w-9xxx.c | 10 ++++-- drivers/scsi/3w-sas.c | 8 ++++- drivers/scsi/3w-xxxx.c | 11 +++++-- drivers/scsi/aacraid/linit.c | 11 +++++-- drivers/scsi/dpt_i2o.c | 20 ++++++++++-- drivers/scsi/gdth.c | 20 +++++++++--- drivers/scsi/megaraid.c | 20 ++++++++++-- drivers/scsi/megaraid.h | 4 +- drivers/scsi/megaraid/megaraid_mm.c | 22 ++++++++++--- drivers/scsi/osst.c | 14 ++++++-- drivers/scsi/sg.c | 17 ++++++++-- drivers/staging/crystalhd/crystalhd_lnx.c | 13 +++++-- drivers/staging/dt3155/dt3155_drv.c | 24 +++++++++++---- drivers/staging/poch/poch.c | 17 +++++++++- drivers/staging/vme/devices/vme_user.c | 18 +++++++++-- drivers/usb/mon/mon_bin.c | 23 ++++++++++---- drivers/usb/mon/mon_stat.c | 3 +- 55 files changed, 636 insertions(+), 248 deletions(-)
PATCH 1/10 dvb: push down BKL into ioctl functions
From: Arnd Bergmann <[email protected]>
This requires changing all users of dvb_usercopy to omit the inode argument.
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/media/dvb/dvb-core/dmxdev.c | 31 +++++++++++++++++++------- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 17 ++++++++++---- drivers/media/dvb/dvb-core/dvb_frontend.c | 30 +++++++++++++------------- drivers/media/dvb/dvb-core/dvb_net.c | 15 +++++++++--- drivers/media/dvb/dvb-core/dvbdev.c | 17 +++++++++----- drivers/media/dvb/dvb-core/dvbdev.h | 11 +++------ drivers/media/dvb/firewire/firedtv-ci.c | 5 +-- drivers/media/dvb/ttpci/av7110.c | 4 +- drivers/media/dvb/ttpci/av7110_av.c | 8 +++--- drivers/media/dvb/ttpci/av7110_ca.c | 5 +-- 10 files changed, 85 insertions(+), 58 deletions(-)
drivers/media/dvb/dvb-core/dmxdev.c +22 -9
@@ -25,6 +25,7 @@#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>
@@ -963,7 +964,7 @@ dvb_demux_read(struct file *file, char __user *buf, size_t count,return ret; } -static int dvb_demux_do_ioctl (struct inode *inode,struct file *file, +static int dvb_demux_do_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dmxdev_filter *dmxdevfilter = file->private_data;
@@ -1084,10 +1085,16 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,return ret; } -static int dvb_demux_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static long dvb_demux_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) { -return dvb_usercopy (inode, file, cmd, arg, dvb_demux_do_ioctl); +int ret; + +lock_kernel (); + ret =dvb_usercopy (file, cmd, arg, dvb_demux_do_ioctl); +unlock_kernel (); + +return ret; }static unsigned int dvb_demux_poll (struct file *file,poll_table *wait)
@@ -1139,7 +1146,7 @@ static int dvb_demux_release(struct inode *inode, struct file *file)static const struct file_operations dvb_demux_fops = { .owner =THIS_MODULE , .read = dvb_demux_read, - .bkl_ioctl = dvb_demux_ioctl, + .unlocked_ioctl = dvb_demux_ioctl, .open = dvb_demux_open, .release = dvb_demux_release, .poll = dvb_demux_poll,
@@ -1152,7 +1159,7 @@ static struct dvb_device dvbdev_demux = { .fops = &dvb_demux_fops }; -static int dvb_dvr_do_ioctl (struct inode *inode,struct file *file, +static int dvb_dvr_do_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1176,10 +1183,16 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file,return ret; } -static int dvb_dvr_ioctl (struct inode *inode,struct file *file, +static long dvb_dvr_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return dvb_usercopy (inode, file, cmd, arg, dvb_dvr_do_ioctl); +int ret; + +lock_kernel (); + ret =dvb_usercopy (file, cmd, arg, dvb_dvr_do_ioctl); +unlock_kernel (); + +return ret; }static unsigned int dvb_dvr_poll (struct file *file,poll_table *wait)
@@ -1208,7 +1221,7 @@ static const struct file_operations dvb_dvr_fops = { .owner = THIS_MODULE, .read = dvb_dvr_read, .write = dvb_dvr_write, - .bkl_ioctl = dvb_dvr_ioctl, + .unlocked_ioctl = dvb_dvr_ioctl, .open = dvb_dvr_open, .release = dvb_dvr_release, .poll = dvb_dvr_poll,
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +12 -5
@@ -36,6 +36,7 @@#include <linux/delay.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/smp_lock.h> #include <linux/kthread.h> #include "dvb_ca_en50221.h"
@@ -1181,7 +1182,7 @@ static int dvb_ca_en50221_thread(void *data)* * @return 0 on success, <0 on error. */ -static int dvb_ca_en50221_io_do_ioctl (struct inode *inode,struct file *file, +static int dvb_ca_en50221_io_do_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1255,10 +1256,16 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file,* * @return 0 on success, <0 on error. */ -static int dvb_ca_en50221_io_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static long dvb_ca_en50221_io_ioctl (struct file *file, +unsigned int cmd,unsigned long arg) { -return dvb_usercopy (inode, file, cmd, arg, dvb_ca_en50221_io_do_ioctl); +int ret; + +lock_kernel (); + ret =dvb_usercopy (file, cmd, arg, dvb_ca_en50221_io_do_ioctl); +unlock_kernel (); + +return ret; }
@@ -1611,7 +1618,7 @@ static const struct file_operations dvb_ca_fops = { .owner = THIS_MODULE, .read = dvb_ca_en50221_io_read, .write = dvb_ca_en50221_io_write, - .bkl_ioctl = dvb_ca_en50221_io_ioctl, + .unlocked_ioctl = dvb_ca_en50221_io_ioctl, .open = dvb_ca_en50221_io_open, .release = dvb_ca_en50221_io_release, .poll = dvb_ca_en50221_io_poll,
drivers/media/dvb/dvb-core/dvb_frontend.c +15 -15
@@ -36,6 +36,7 @@#include <linux/list.h> #include <linux/freezer.h> #include <linux/jiffies.h> +#include <linux/smp_lock.h> #include <linux/kthread.h> #include <asm/processor.h>
@@ -1188,14 +1189,14 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe) } } -static int dvb_frontend_ioctl_legacy (struct inode *inode,struct file *file, +static int dvb_frontend_ioctl_legacy (struct file *file,unsigned int cmd,void *parg); -static int dvb_frontend_ioctl_properties (struct inode *inode,struct file *file, +static int dvb_frontend_ioctl_properties (struct file *file,unsigned int cmd,void *parg);static int dtv_property_process_get (struct dvb_frontend *fe,struct dtv_property *tvp, -struct inode *inode,struct file *file) +struct file *file) {int r =0 ;
@@ -1328,7 +1329,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe,static int dtv_property_process_set (struct dvb_frontend *fe,struct dtv_property *tvp, -struct inode *inode,struct file *file) {int r =0 ;
@@ -1359,7 +1359,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,dprintk ("%s() Finalised property cache\n" , __func__);dtv_property_cache_submit (fe); - r |=dvb_frontend_ioctl_legacy (inode, file,FE_SET_FRONTEND , + r |=dvb_frontend_ioctl_legacy (file,FE_SET_FRONTEND , &fepriv->parameters);break ;case DTV_FREQUENCY :
@@ -1391,12 +1391,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe,break ;case DTV_VOLTAGE : fe->dtv_property_cache.voltage = tvp->u.data; - r =dvb_frontend_ioctl_legacy (inode, file,FE_SET_VOLTAGE , + r =dvb_frontend_ioctl_legacy (file,FE_SET_VOLTAGE , (void *)fe->dtv_property_cache.voltage);break ;case DTV_TONE : fe->dtv_property_cache.sectone = tvp->u.data; - r =dvb_frontend_ioctl_legacy (inode, file,FE_SET_TONE , + r =dvb_frontend_ioctl_legacy (file,FE_SET_TONE , (void *)fe->dtv_property_cache.sectone);break ;case DTV_CODE_RATE_HP :
@@ -1480,7 +1480,7 @@ static int dtv_property_process_set(struct dvb_frontend *fe,return r; } -static int dvb_frontend_ioctl (struct inode *inode,struct file *file, +static int dvb_frontend_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1502,17 +1502,17 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,return -ERESTARTSYS ;if ((cmd ==FE_SET_PROPERTY ) || (cmd ==FE_GET_PROPERTY )) - err =dvb_frontend_ioctl_properties (inode, file, cmd, parg); + err =dvb_frontend_ioctl_properties (file, cmd, parg);else { fe->dtv_property_cache.state =DTV_UNDEFINED ; - err =dvb_frontend_ioctl_legacy (inode, file, cmd, parg); + err =dvb_frontend_ioctl_legacy (file, cmd, parg); }up (&fepriv->sem);return err; } -static int dvb_frontend_ioctl_properties (struct inode *inode,struct file *file, +static int dvb_frontend_ioctl_properties (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1548,7 +1548,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, }for (i =0 ; i < tvps->num; i++) { - (tvp + i)->result =dtv_property_process_set (fe, tvp + i, inode, file); + (tvp + i)->result =dtv_property_process_set (fe, tvp + i, file); err |= (tvp + i)->result; }
@@ -1580,7 +1580,7 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, }for (i =0 ; i < tvps->num; i++) { - (tvp + i)->result =dtv_property_process_get (fe, tvp + i, inode, file); + (tvp + i)->result =dtv_property_process_get (fe, tvp + i, file); err |= (tvp + i)->result; }
@@ -1597,7 +1597,7 @@ out:return err; } -static int dvb_frontend_ioctl_legacy (struct inode *inode,struct file *file, +static int dvb_frontend_ioctl_legacy (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -2022,7 +2022,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)static const struct file_operations dvb_frontend_fops = { .owner =THIS_MODULE , - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release
drivers/media/dvb/dvb-core/dvb_net.c +11 -4
@@ -59,6 +59,7 @@#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>
@@ -1333,7 +1334,7 @@ static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)return 0 ; } -static int dvb_net_do_ioctl (struct inode *inode,struct file *file, +static int dvb_net_do_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1435,10 +1436,16 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,return 0 ; } -static int dvb_net_ioctl (struct inode *inode,struct file *file, +static long dvb_net_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return dvb_usercopy (inode, file, cmd, arg, dvb_net_do_ioctl); +int ret; + +lock_kernel (); + ret =dvb_usercopy (file, cmd, arg, dvb_net_do_ioctl); +unlock_kernel (); + +return ret; }static int dvb_net_close (struct inode *inode,struct file *file)
@@ -1459,7 +1466,7 @@ static int dvb_net_close(struct inode *inode, struct file *file)static const struct file_operations dvb_net_fops = { .owner =THIS_MODULE , - .bkl_ioctl = dvb_net_ioctl, + .unlocked_ioctl = dvb_net_ioctl, .open = dvb_generic_open, .release = dvb_net_close, };
drivers/media/dvb/dvb-core/dvbdev.c +11 -6
@@ -154,10 +154,11 @@ int dvb_generic_release(struct inode *inode, struct file *file)EXPORT_SYMBOL (dvb_generic_release); -int dvb_generic_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +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 ;
@@ -165,7 +166,11 @@ int dvb_generic_ioctl(struct inode *inode, struct file *file,if (!dvbdev->kernel_ioctl)return -EINVAL ; -return dvb_usercopy (inode, file, cmd, arg, dvbdev->kernel_ioctl); +lock_kernel (); + ret =dvb_usercopy (file, cmd, arg, dvbdev->kernel_ioctl); +unlock_kernel (); + +return ret; }EXPORT_SYMBOL (dvb_generic_ioctl);
@@ -377,9 +382,9 @@ EXPORT_SYMBOL(dvb_unregister_adapter);define this as video_usercopy(). this will introduce a dependecy to the v4l "videodev.o" module, which is unnecessary for some cards (ie. the budget dvb-cards don't need the v4l module...) */ -int dvb_usercopy (struct inode *inode,struct file *file, +int dvb_usercopy (struct file *file,unsigned int cmd,unsigned long arg, -int (*func)(struct inode *inode,struct file *file, +int (*func)(struct file *file,unsigned int cmd,void *arg)) {char sbuf[128 ];
@@ -416,7 +421,7 @@ int dvb_usercopy(struct inode *inode, struct file *file, }/* call driver */ -if ((err =func (inode, file, cmd, parg)) == -ENOIOCTLCMD ) +if ((err =func (file, cmd, parg)) == -ENOIOCTLCMD ) err = -EINVAL ;if (err <0 )
drivers/media/dvb/dvb-core/dvbdev.h +4 -7
@@ -116,8 +116,7 @@ struct dvb_device {wait_queue_head_t wait_queue;/* don't really need those !? -- FIXME: use video_usercopy */ -int (*kernel_ioctl)(struct inode *inode,struct file *file, -unsigned int cmd,void *arg); +int (*kernel_ioctl)(struct file *file,unsigned int cmd,void *arg);void *priv; };
@@ -138,17 +137,15 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev);extern int dvb_generic_open (struct inode *inode,struct file *file);extern int dvb_generic_release (struct inode *inode,struct file *file); -extern int dvb_generic_ioctl (struct inode *inode,struct file *file, +extern long dvb_generic_ioctl (struct file *file,unsigned int cmd,unsigned long arg);/* we don't mess with video_usercopy() any more, we simply define out own dvb_usercopy(), which will hopefully become generic_usercopy() someday... */ -extern int dvb_usercopy (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg, -int (*func)(struct inode *inode,struct file *file, -unsigned int cmd,void *arg)); +extern int dvb_usercopy (struct file *file,unsigned int cmd,unsigned long arg, +int (*func)(struct file *file,unsigned int cmd,void *arg));/** generic DVB attach function. */ #ifdef CONFIG_MEDIA_ATTACH
drivers/media/dvb/firewire/firedtv-ci.c +2 -3
@@ -175,8 +175,7 @@ static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)return err; } -static int fdtv_ca_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,void *arg) +static int fdtv_ca_ioctl (struct file *file,unsigned int cmd,void *arg) {struct dvb_device *dvbdev = file->private_data;struct firedtv *fdtv = dvbdev->priv;
@@ -217,7 +216,7 @@ static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)static const struct file_operations fdtv_ca_fops = { .owner =THIS_MODULE , - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .open = dvb_generic_open, .release = dvb_generic_release, .poll = fdtv_ca_io_poll,
drivers/media/dvb/ttpci/av7110.c +2 -2
@@ -708,7 +708,7 @@ static void gpioirq(unsigned long cookie)#ifdef CONFIG_DVB_AV7110_OSD -static int dvb_osd_ioctl (struct inode *inode,struct file *file, +static int dvb_osd_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -727,7 +727,7 @@ static int dvb_osd_ioctl(struct inode *inode, struct file *file,static const struct file_operations dvb_osd_fops = { .owner =THIS_MODULE , - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .open = dvb_generic_open, .release = dvb_generic_release, };
drivers/media/dvb/ttpci/av7110_av.c +4 -4
@@ -1089,7 +1089,7 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len } -static int dvb_video_ioctl (struct inode *inode,struct file *file, +static int dvb_video_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1297,7 +1297,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file,return ret; } -static int dvb_audio_ioctl (struct inode *inode,struct file *file, +static int dvb_audio_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;
@@ -1517,7 +1517,7 @@ static int dvb_audio_release(struct inode *inode, struct file *file)static const struct file_operations dvb_video_fops = { .owner =THIS_MODULE , .write = dvb_video_write, - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .open = dvb_video_open, .release = dvb_video_release, .poll = dvb_video_poll,
@@ -1535,7 +1535,7 @@ static struct dvb_device dvbdev_video = {static const struct file_operations dvb_audio_fops = { .owner =THIS_MODULE , .write = dvb_audio_write, - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .open = dvb_audio_open, .release = dvb_audio_release, .poll = dvb_audio_poll,
drivers/media/dvb/ttpci/av7110_ca.c +2 -3
@@ -248,8 +248,7 @@ static unsigned int dvb_ca_poll (struct file *file, poll_table *wait)return mask; } -static int dvb_ca_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,void *parg) +static int dvb_ca_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;struct av7110 *av7110 = dvbdev->priv;
@@ -350,7 +349,7 @@ static const struct file_operations dvb_ca_fops = { .owner = THIS_MODULE, .read = dvb_ca_read, .write = dvb_ca_write, - .bkl_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_generic_ioctl, .open = dvb_ca_open, .release = dvb_generic_release, .poll = dvb_ca_poll,
Signature · 1 line
1.6.6.1
PATCH 2/10 scsi: push down BKL into ioctl functions
In reply to John KacurFrom: Arnd Bergmann <[email protected]>
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/scsi/3w-9xxx.c | 10 +++++++--- drivers/scsi/3w-sas.c | 7 +++++-- drivers/scsi/3w-xxxx.c | 10 +++++++--- drivers/scsi/aacraid/linit.c | 11 ++++++++--- drivers/scsi/dpt_i2o.c | 20 +++++++++++++++++--- drivers/scsi/gdth.c | 20 +++++++++++++++----- drivers/scsi/megaraid.c | 20 +++++++++++++++++--- drivers/scsi/megaraid/megaraid_mm.c | 22 +++++++++++++++++----- drivers/scsi/osst.c | 14 ++++++++++---- drivers/scsi/sg.c | 17 ++++++++++++++--- 10 files changed, 117 insertions(+), 34 deletions(-)
drivers/scsi/3w-9xxx.c +7 -3
@@ -123,7 +123,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Hstatic int twa_aen_read_queue (TW_Device_Extension *tw_dev,int request_id);static char *twa_aen_severity_lookup (unsigned char severity_code);static void twa_aen_sync_time (TW_Device_Extension *tw_dev,int request_id); -static int twa_chrdev_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg); +static long twa_chrdev_ioctl (struct file *file,unsigned int cmd,unsigned long arg);static int twa_chrdev_open (struct inode *inode,struct file *file);static int twa_fill_sense (TW_Device_Extension *tw_dev,int request_id,int copy_sense,int print_host);static void twa_free_request_id (TW_Device_Extension *tw_dev,int request_id);
@@ -218,7 +218,7 @@ static struct device_attribute *twa_host_attrs[] = {/* File operations struct for character device */ static const struct file_operations twa_fops = { .owner =THIS_MODULE , - .bkl_ioctl = twa_chrdev_ioctl, + .unlocked_ioctl = twa_chrdev_ioctl, .open = twa_chrdev_open, .release =NULL };
@@ -635,8 +635,9 @@ out: }/* End twa_check_srl() */ /* This function handles ioctl for the character device */ -static int twa_chrdev_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +static long twa_chrdev_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +struct inode *inode = file->f_path.dentry->d_inode;long timeout;unsigned long *cpu_addr, data_buffer_length_adjusted =0 , flags =0 ;dma_addr_t dma_handle;
@@ -655,6 +656,8 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned intint retval =TW_IOCTL_ERROR_OS_EFAULT ;void __user *argp = (void __user *)arg; +lock_kernel (); +/* Only let one of these through at a time */ if (mutex_lock_interruptible (&tw_dev->ioctl_lock)) { retval =TW_IOCTL_ERROR_OS_EINTR ;
@@ -874,6 +877,7 @@ out3: out2:mutex_unlock (&tw_dev->ioctl_lock); out: +unlock_kernel ();return retval; }/* End twa_chrdev_ioctl() */
drivers/scsi/3w-sas.c +5 -2
@@ -750,7 +750,7 @@ static void twl_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm/* This function handles ioctl for the character device This interface is used by smartmontools open source software */ -static int twl_chrdev_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +static long twl_chrdev_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {long timeout;unsigned long *cpu_addr, data_buffer_length_adjusted =0 , flags =0 ;
@@ -763,6 +763,8 @@ static int twl_chrdev_ioctl(struct inode *inode, struct file *file, unsigned intint retval = -EFAULT ;void __user *argp = (void __user *)arg; +lock_kernel (); +/* Only let one of these through at a time */ if (mutex_lock_interruptible (&tw_dev->ioctl_lock)) { retval = -EINTR ;
@@ -858,6 +860,7 @@ out3: out2:mutex_unlock (&tw_dev->ioctl_lock); out: +unlock_kernel ();return retval; }/* End twl_chrdev_ioctl() */
@@ -884,7 +887,7 @@ out:/* File operations struct for character device */ static const struct file_operations twl_fops = { .owner =THIS_MODULE , - .bkl_ioctl = twl_chrdev_ioctl, + .unlocked_ioctl = twl_chrdev_ioctl, .open = twl_chrdev_open, .release =NULL };
drivers/scsi/3w-xxxx.c +7 -3
@@ -880,7 +880,7 @@ static int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which) }/* End tw_allocate_memory() */ /* This function handles ioctl for the character device */ -static int tw_chrdev_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +static long tw_chrdev_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {int request_id;dma_addr_t dma_handle;
@@ -898,9 +898,12 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned intdprintk (KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n" ); +lock_kernel ();/* Only let one of these through at a time */ -if (mutex_lock_interruptible (&tw_dev->ioctl_lock)) +if (mutex_lock_interruptible (&tw_dev->ioctl_lock)) { +unlock_kernel ();return -EINTR ; + }/* First copy down the buffer length */ if (copy_from_user (&data_buffer_length, argp,sizeof (unsigned int )))
@@ -1029,6 +1032,7 @@ out2:dma_free_coherent (&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof (TW_New_Ioctl) -1 , cpu_addr, dma_handle); out:mutex_unlock (&tw_dev->ioctl_lock); +unlock_kernel ();return retval; }/* End tw_chrdev_ioctl() */
@@ -1051,7 +1055,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)/* File operations struct for character device */ static const struct file_operations tw_fops = { .owner =THIS_MODULE , - .bkl_ioctl = tw_chrdev_ioctl, + .unlocked_ioctl = tw_chrdev_ioctl, .open = tw_chrdev_open, .release =NULL };
drivers/scsi/aacraid/linit.c +8 -3
@@ -705,12 +705,17 @@ static int aac_cfg_open(struct inode *inode, struct file *file)* Bugs: Needs to handle hot plugging */ -static int aac_cfg_ioctl (struct inode *inode,struct file *file, +static long aac_cfg_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +int ret;if (!capable (CAP_SYS_RAWIO ))return -EPERM ; -return aac_do_ioctl (file->private_data, cmd, (void __user *)arg); +lock_kernel (); + ret =aac_do_ioctl (file->private_data, cmd, (void __user *)arg); +unlock_kernel (); + +return ret; }#ifdef CONFIG_COMPAT
@@ -1029,7 +1034,7 @@ ssize_t aac_get_serial_number(struct device *device, char *buf)static const struct file_operations aac_cfg_fops = { .owner =THIS_MODULE , - .bkl_ioctl = aac_cfg_ioctl, + .unlocked_ioctl = aac_cfg_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = aac_compat_cfg_ioctl, #endif
drivers/scsi/dpt_i2o.c +17 -3
@@ -114,12 +114,13 @@ static int hba_count = 0;static struct class *adpt_sysfs_class; +static long adpt_unlocked_ioctl (struct file *,unsigned int ,unsigned long );#ifdef CONFIG_COMPAT static long compat_adpt_ioctl (struct file *,unsigned int ,unsigned long );#endif static const struct file_operations adpt_fops = { - .bkl_ioctl = adpt_ioctl, + .unlocked_ioctl = adpt_unlocked_ioctl, .open = adpt_open, .release = adpt_close, #ifdef CONFIG_COMPAT
@@ -2069,8 +2070,7 @@ static int adpt_system_info(void __user *buffer)return 0 ; } -static int adpt_ioctl (struct inode *inode,struct file *file,uint cmd, -ulong arg) +static int adpt_ioctl (struct inode *inode,struct file *file,uint cmd,ulong arg) {int minor;int error =0 ;
@@ -2153,6 +2153,20 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,return error; } +static long adpt_unlocked_ioctl (struct file *file,uint cmd,ulong arg) +{ +struct inode *inode; +long ret; + + inode = file->f_dentry->d_inode; + +lock_kernel (); + ret =adpt_ioctl (inode, file, cmd, arg); +unlock_kernel (); + +return ret; +} +#ifdef CONFIG_COMPAT static long compat_adpt_ioctl (struct file *file,unsigned int cmd,unsigned long arg)
drivers/scsi/gdth.c +15 -5
@@ -180,8 +180,8 @@ static const char *gdth_ctr_name(gdth_ha_str *ha);static int gdth_open (struct inode *inode,struct file *filep);static int gdth_close (struct inode *inode,struct file *filep); -static int gdth_ioctl (struct inode *inode,struct file *filep, -unsigned int cmd,unsigned long arg); +static long gdth_unlocked_ioctl (struct file *filep,unsigned int cmd, +unsigned long arg);static void gdth_flush (gdth_ha_str *ha);static int gdth_queuecommand (Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
@@ -369,7 +369,7 @@ MODULE_LICENSE("GPL");/* ioctl interface */ static const struct file_operations gdth_fops = { - .bkl_ioctl = gdth_ioctl, + .unlocked_ioctl = gdth_unlocked_ioctl, .open = gdth_open, .release = gdth_close, };
@@ -4462,8 +4462,7 @@ free_fail:return rc; } -static int gdth_ioctl (struct inode *inode,struct file *filep, -unsigned int cmd,unsigned long arg) +static int gdth_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) {gdth_ha_str *ha;Scsi_Cmnd *scp;
@@ -4611,6 +4610,17 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,return 0 ; } +static long gdth_unlocked_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =gdth_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +}/* flush routine */ static void gdth_flush (gdth_ha_str *ha)
drivers/scsi/megaraid.c +17 -3
@@ -91,12 +91,15 @@ static struct proc_dir_entry *mega_proc_dir_entry;/* For controller re-ordering */ static struct mega_hbas mega_hbas[MAX_CONTROLLERS ]; +static long +megadev_unlocked_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) +/* * The File Operations structure for the serial/ioctl interface of the driver */ static const struct file_operations megadev_fops = { .owner =THIS_MODULE , - .bkl_ioctl = megadev_ioctl, + .unlocked_ioctl = megadev_unlocked_ioctl, .open = megadev_open, };
@@ -3302,8 +3305,7 @@ megadev_open (struct inode *inode, struct file *filep)* controller. */ static int -megadev_ioctl (struct inode *inode,struct file *filep,unsigned int cmd, -unsigned long arg) +megadev_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) {adapter_t *adapter;nitioctl_t uioc;
@@ -3694,6 +3696,18 @@ freemem_and_return:return 0 ; } +static long +megadev_unlocked_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =megadev_ioctl (filep, cmd, arg); +unlock_kernel (); + +return ret; +} +/** * mega_m_to_n() * @arg - user address
drivers/scsi/megaraid/megaraid_mm.c +17 -5
@@ -22,7 +22,7 @@// Entry points for char node driver static int mraid_mm_open (struct inode *,struct file *); -static int mraid_mm_ioctl (struct inode *,struct file *,uint ,unsigned long ); +static long mraid_mm_unlocked_ioctl (struct file *,uint ,unsigned long );// routines to convert to and from the old the format
@@ -70,7 +70,7 @@ static wait_queue_head_t wait_q;static const struct file_operations lsi_fops = { .open = mraid_mm_open, - .bkl_ioctl = mraid_mm_ioctl, + .unlocked_ioctl = mraid_mm_unlocked_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = mraid_mm_compat_ioctl, #endif
@@ -110,8 +110,7 @@ mraid_mm_open(struct inode *inode, struct file *filep)* @arg : user ioctl packet */ static int -mraid_mm_ioctl (struct inode *inode,struct file *filep,unsigned int cmd, -unsigned long arg) +mraid_mm_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) {uioc_t *kioc;char signature[EXT_IOCTL_SIGN_SZ ] = {0 };
@@ -218,6 +217,19 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,return rval; } +static long +mraid_mm_unlocked_ioctl (struct file *filep,unsigned int cmd, +unsigned long arg) +{ +int err; + +/* inconsistant: mraid_mm_compat_ioctl doesn't take the BKL */ +lock_kernel (); + err =mraid_mm_ioctl (filep, cmd, arg); +unlock_kernel (); + +return err; +}/** * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet
@@ -1225,7 +1237,7 @@ mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, {int err; - err =mraid_mm_ioctl (NULL , filep, cmd, arg); + err =mraid_mm_ioctl (filep, cmd, arg);return err; }
drivers/scsi/osst.c +10 -4
@@ -4932,7 +4932,7 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)/* The ioctl command */ -static int osst_ioctl (struct inode * inode,struct file * file, +static long osst_ioctl (struct file * file,unsigned int cmd_in,unsigned long arg) {int i, cmd_nr, cmd_type, blk, retval =0 ;
@@ -4943,8 +4943,11 @@ static int osst_ioctl(struct inode * inode,struct file * file,char * name =tape_name (STp);void __user * p = (void __user *)arg; -if (mutex_lock_interruptible (&STp->lock)) +lock_kernel (); +if (mutex_lock_interruptible (&STp->lock)) { +unlock_kernel ();return -ERESTARTSYS ; + }#if DEBUG if (debugging && !STp->in_use) {
@@ -5256,12 +5259,15 @@ static int osst_ioctl(struct inode * inode,struct file * file,mutex_unlock (&STp->lock); -return scsi_ioctl (STp->device, cmd_in, p); + retval =scsi_ioctl (STp->device, cmd_in, p); +unlock_kernel (); +return retval; out:if (SRpnt)osst_release_request (SRpnt);mutex_unlock (&STp->lock); +unlock_kernel ();return retval; }
@@ -5613,7 +5619,7 @@ static const struct file_operations osst_fops = { .owner = THIS_MODULE, .read = osst_read, .write = osst_write, - .bkl_ioctl = osst_ioctl, + .unlocked_ioctl = osst_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = osst_compat_ioctl,#endif
drivers/scsi/sg.c +14 -3
@@ -758,8 +758,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, }static int -sg_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd_in,unsigned long arg) +sg_ioctl (struct file *filp,unsigned int cmd_in,unsigned long arg) {void __user *p = (void __user *)arg;int __user *ip = p;
@@ -1078,6 +1077,18 @@ sg_ioctl(struct inode *inode, struct file *filp, } } +static long +sg_unlocked_ioctl (struct file *filp,unsigned int cmd_in,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =sg_ioctl (filp, cmd_in, arg); +unlock_kernel (); + +return ret; +} +#ifdef CONFIG_COMPAT static long sg_compat_ioctl (struct file *filp,unsigned int cmd_in,unsigned long arg) {
@@ -1322,7 +1333,7 @@ static const struct file_operations sg_fops = { .read = sg_read, .write = sg_write, .poll = sg_poll, - .bkl_ioctl = sg_ioctl, + .unlocked_ioctl = sg_unlocked_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = sg_compat_ioctl,#endif
Signature · 1 line
1.6.6.1
PATCH 3/10 bkl: Fix up compile problems in megaraid from bkl push-down
In reply to John Kacur- Forward declaration missing ';'
- Conflicting declaraction in megaraid.h changed
--- drivers/scsi/megaraid.c | 2 +- drivers/scsi/megaraid.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/megaraid.c +1 -1
@@ -92,7 +92,7 @@ static struct proc_dir_entry *mega_proc_dir_entry;static struct mega_hbas mega_hbas[MAX_CONTROLLERS ];static long -megadev_unlocked_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) +megadev_unlocked_ioctl (struct file *filep,unsigned int cmd,unsigned long arg);/* * The File Operations structure for the serial/ioctl interface of the driver
drivers/scsi/megaraid.h +2 -2
@@ -1013,8 +1013,8 @@ static void mega_8_to_40ld (mraid_inquiry *inquiry, mega_inquiry3 *enquiry3, mega_product_info *);static int megadev_open (struct inode *,struct file *); -static int megadev_ioctl (struct inode *,struct file *,unsigned int , -unsigned long ); +static int +megadev_ioctl (struct file *filep,unsigned int cmd,unsigned long arg);static int mega_m_to_n (void __user *,nitioctl_t *);static int mega_n_to_m (void __user *,megacmd_t *);
Signature · 1 line
1.6.6.1
PATCH 4/10 bkl: Fix missing inode tw_chrdev_ioctl due to bkl pushdown
In reply to John Kacur--- drivers/scsi/3w-xxxx.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/scsi/3w-xxxx.c +1 -0
@@ -890,6 +890,7 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long aunsigned long data_buffer_length_adjusted =0 ;unsigned long *cpu_addr;long timeout; +struct inode *inode = file->f_dentry->d_inode;TW_New_Ioctl *tw_ioctl;TW_Passthru *passthru;TW_Device_Extension *tw_dev = tw_device_extension_list[iminor (inode)];
Signature · 1 line
1.6.6.1
PATCH 5/10 bkl: Fix missing inode in twl_chrdev_ioctl resulting from bkl pushdown
In reply to John KacurFix missing inode in twl_chrdev_ioctl resulting from bkl pushdown, because the ioctl is now an unlocked ioctl.
--- drivers/scsi/3w-sas.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/scsi/3w-sas.c +1 -0
@@ -756,6 +756,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned longunsigned long *cpu_addr, data_buffer_length_adjusted =0 , flags =0 ;dma_addr_t dma_handle;int request_id =0 ; +struct inode *inode = file->f_dentry->d_inode;TW_Ioctl_Driver_Command driver_command;TW_Ioctl_Buf_Apache *tw_ioctl;TW_Command_Full *full_command_packet;
Signature · 1 line
1.6.6.1
PATCH 6/10 isdn: push down BKL into ioctl functions
In reply to John KacurFrom: Arnd Bergmann <[email protected]>
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/isdn/capi/capi.c | 17 ++++++++++++++--- drivers/isdn/divert/divert_procfs.c | 19 ++++++++++++++++--- drivers/isdn/i4l/isdn_common.c | 18 +++++++++++++++--- drivers/isdn/mISDN/timerdev.c | 10 ++++++---- 4 files changed, 51 insertions(+), 13 deletions(-)
drivers/isdn/capi/capi.c +14 -3
@@ -787,8 +787,7 @@ capi_poll(struct file *file, poll_table * wait) }static int -capi_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +capi_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct capidev *cdev = file->private_data;capi_ioctl_struct data;
@@ -981,6 +980,18 @@ register_out: } } +static long +capi_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =capi_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +static int capi_open (struct inode *inode,struct file *file) {struct capidev *cdev;
@@ -1026,7 +1037,7 @@ static const struct file_operations capi_fops = .read = capi_read, .write = capi_write, .poll = capi_poll, - .bkl_ioctl = capi_ioctl, + .unlocked_ioctl = capi_unlocked_ioctl, .open = capi_open, .release = capi_release, };
drivers/isdn/divert/divert_procfs.c +16 -3
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/poll.h> +#include <linux/smp_lock.h> #include <linux/slab.h> #ifdef CONFIG_PROC_FS #include <linux/proc_fs.h>
@@ -178,8 +179,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)/* IOCTL */ /*********/ static int -isdn_divert_ioctl (struct inode *inode,struct file *file, -uint cmd,ulong arg) +isdn_divert_ioctl (struct file *file,uint cmd,ulong arg) {divert_ioctl dioctl;int i;
@@ -258,6 +258,19 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,return copy_to_user ((void __user *)arg, &dioctl,sizeof (dioctl)) ? -EFAULT :0 ; }/* isdn_divert_ioctl */ +static long +isdn_divert_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =isdn_divert_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} + +static const struct file_operations isdn_fops = { .owner =THIS_MODULE ,
@@ -265,7 +278,7 @@ static const struct file_operations isdn_fops = .read = isdn_divert_read, .write = isdn_divert_write, .poll = isdn_divert_poll, - .bkl_ioctl = isdn_divert_ioctl, + .unlocked_ioctl = isdn_divert_unlocked_ioctl, .open = isdn_divert_open, .release = isdn_divert_close, };
drivers/isdn/i4l/isdn_common.c +15 -3
@@ -1272,9 +1272,9 @@ isdn_poll(struct file *file, poll_table * wait)static int -isdn_ioctl (struct inode *inode,struct file *file,uint cmd,ulong arg) +isdn_ioctl (struct file *file,uint cmd,ulong arg) { -uint minor =iminor (inode); +uint minor =iminor (file->f_path.dentry->d_inode);isdn_ctrl c;int drvidx;int chidx;
@@ -1722,6 +1722,18 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)#undef cfg } +static long +isdn_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =isdn_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +/* * Open the device code. */
@@ -1838,7 +1850,7 @@ static const struct file_operations isdn_fops = .read = isdn_read, .write = isdn_write, .poll = isdn_poll, - .bkl_ioctl = isdn_ioctl, + .unlocked_ioctl = isdn_unlocked_ioctl, .open = isdn_open, .release = isdn_close, };
drivers/isdn/mISDN/timerdev.c +6 -4
@@ -24,6 +24,7 @@#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mISDNif.h> +#include <linux/smp_lock.h> #include "core.h" static u_int *debug;
@@ -215,9 +216,8 @@ unlock:return ret; } -static int -mISDN_ioctl (struct inode *inode,struct file *filep,unsigned int cmd, -unsigned long arg) +static long +mISDN_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) {struct mISDNtimerdev *dev = filep->private_data;int id, tout, ret =0 ;
@@ -226,6 +226,7 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,if (*debug &DEBUG_TIMER )printk (KERN_DEBUG "%s(%p, %x, %lx)\n" , __func__, filep, cmd, arg); +lock_kernel ();switch (cmd) {case IMADDTIMER :if (get_user (tout, (int __user *)arg)) {
@@ -257,13 +258,14 @@ mISDN_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,default : ret = -EINVAL ; } +unlock_kernel ();return ret; }static const struct file_operations mISDN_fops = { .read = mISDN_read, .poll = mISDN_poll, - .bkl_ioctl = mISDN_ioctl, + .unlocked_ioctl = mISDN_ioctl, .open = mISDN_open, .release = mISDN_close, };
Signature · 1 line
1.6.6.1
PATCH 7/10 staging: push down BKL into ioctl functions
In reply to John KacurFrom: Arnd Bergmann <[email protected]>
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/staging/crystalhd/crystalhd_lnx.c | 13 +++++++++---- drivers/staging/dt3155/dt3155_drv.c | 24 ++++++++++++++++++------ drivers/staging/poch/poch.c | 17 +++++++++++++++-- drivers/staging/vme/devices/vme_user.c | 18 +++++++++++++++--- 4 files changed, 57 insertions(+), 15 deletions(-)
drivers/staging/crystalhd/crystalhd_lnx.c +9 -4
@@ -16,6 +16,7 @@***************************************************************************/ #include <linux/version.h> +#include <linux/smp_lock.h> #include <linux/slab.h> #include "crystalhd_lnx.h"
@@ -261,12 +262,12 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua, }/* API interfaces */ -static int chd_dec_ioctl (struct inode *in,struct file *fd, -unsigned int cmd,unsigned long ua) +static long chd_dec_ioctl (struct file *fd,unsigned int cmd,unsigned long ua) {struct crystalhd_adp *adp =chd_get_adp ();crystalhd_cmd_proc cproc;struct crystalhd_user *uc; +int ret;if (!adp || !fd) {BCMLOG_ERR ("Invalid adp\n" );
@@ -279,13 +280,17 @@ static int chd_dec_ioctl(struct inode *in, struct file *fd,return -ENODATA ; } +lock_kernel (); cproc =crystalhd_get_cmd_proc (&adp->cmds, cmd, uc);if (!cproc) {BCMLOG_ERR ("Unhandled command: %d\n" , cmd); +unlock_kernel ();return -EINVAL ; } -return chd_dec_api_cmd (adp, ua, uc->uid, cmd, cproc); + ret =chd_dec_api_cmd (adp, ua, uc->uid, cmd, cproc); +unlock_kernel (); +return ret; }static int chd_dec_open (struct inode *in,struct file *fd)
@@ -345,7 +350,7 @@ static int chd_dec_close(struct inode *in, struct file *fd)static const struct file_operations chd_dec_fops = { .owner =THIS_MODULE , - .bkl_ioctl = chd_dec_ioctl, + .unlocked_ioctl = chd_dec_ioctl, .open = chd_dec_open, .release = chd_dec_close, };
drivers/staging/dt3155/dt3155_drv.c +18 -6
@@ -63,6 +63,7 @@ extern void printques(int);#include <linux/types.h> #include <linux/poll.h> #include <linux/sched.h> +#include <linux/smp_lock.h> #include <asm/io.h> #include <asm/uaccess.h>
@@ -835,6 +836,17 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait)return 0 ; } +static long +dt3155_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =dt3155_ioctl (file->f_path.dentry->d_inode, file, cmd, arg); +unlock_kernel (); + +return ret; +}/***************************************************** * file operations supported by DT3155 driver
@@ -842,12 +854,12 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait)* register_chrdev *****************************************************/ static struct file_operations dt3155_fops = { - read: dt3155_read, - bkl_ioctl: dt3155_ioctl, - mmap: dt3155_mmap, - poll: dt3155_poll, - open: dt3155_open, - release: dt3155_close + .read = dt3155_read, + .unlocked_ioctl = dt3155_unlocked_ioctl, + .mmap = dt3155_mmap, + .poll = dt3155_poll, + .open = dt3155_open, + .release = dt3155_close };
drivers/staging/poch/poch.c +15 -2
@@ -16,6 +16,7 @@#include <linux/sysfs.h> #include <linux/poll.h> #include <linux/idr.h> +#include <linux/smp_lock.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/ioctl.h>
@@ -911,7 +912,7 @@ static unsigned int poch_poll(struct file *filp, poll_table *pt)return ret; } -static int poch_ioctl (struct inode *inode,struct file *filp, +static int poch_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct channel_info *channel = filp->private_data;
@@ -1033,11 +1034,23 @@ static int poch_ioctl(struct inode *inode, struct file *filp,return 0 ; } +static long +poch_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =poch_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +static struct file_operations poch_fops = { .owner =THIS_MODULE , .open = poch_open, .release = poch_release, - .bkl_ioctl = poch_ioctl, + .poch_ioctl = poch_unlocked_ioctl, .poll = poch_poll, .mmap = poch_mmap };
drivers/staging/vme/devices/vme_user.c +15 -3
@@ -31,6 +31,7 @@#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/syscalls.h> +#include <linux/smp_lock.h> #include <linux/types.h> #include <asm/io.h>
@@ -130,8 +131,7 @@ static int vme_user_release(struct inode *, struct file *);static ssize_t vme_user_read (struct file *,char *,size_t ,loff_t *);static ssize_t vme_user_write (struct file *,const char *,size_t ,loff_t *);static loff_t vme_user_llseek (struct file *,loff_t ,int ); -static int vme_user_ioctl (struct inode *,struct file *,unsigned int , -unsigned long ); +static long vme_user_unlocked_ioctl (struct file *,unsigned int ,unsigned long );static int __init vme_user_probe (struct device *,int ,int ); static int __exit vme_user_remove(struct device *, int, int);
@@ -142,7 +142,7 @@ static struct file_operations vme_user_fops = { .read = vme_user_read, .write = vme_user_write, .llseek = vme_user_llseek, - .bkl_ioctl = vme_user_ioctl, + .unlocked_ioctl = vme_user_unlocked_ioctl, };
@@ -555,6 +555,18 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,return -EINVAL ; } +static long +vme_user_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =vme_user_ioctl (file->f_path.dentry->d_inode, file, cmd, arg); +unlock_kernel (); + +return ret; +} +/* * Unallocate a previously allocated buffer
Signature · 1 line
1.6.6.1
PATCH 8/10 v4l: always use unlocked_ioctl
In reply to John KacurFrom: Arnd Bergmann <[email protected]>
v4l drivers may still use a locked ioctl method, but we now always export an unlocked_ioctl and lock ourselves, so that the ->ioctl file operation can get removed.
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/media/video/v4l2-dev.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-)
drivers/media/video/v4l2-dev.c +14 -3
@@ -22,6 +22,7 @@#include <linux/mm.h> #include <linux/string.h> #include <linux/errno.h> +#include <linux/smp_lock.h> #include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h>
@@ -215,16 +216,21 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)return vdev->fops->poll (filp, poll); } -static int v4l2_ioctl (struct inode *inode,struct file *filp, +static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret;if (!vdev->fops->ioctl)return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ -return vdev->fops->ioctl (filp, cmd, arg); +lock_kernel (); + ret = vdev->fops->ioctl (filp->f_path.dentry->d_inode, filp, cmd, arg); +unlock_kernel (); + +return ret; } static long v4l2_unlocked_ioctl(struct file *filp,
@@ -323,6 +329,11 @@ static const struct file_operations v4l2_unlocked_fops = { .llseek = no_llseek, }; +/* +* Note: this should not be needed, just check +* both pointers in v4l2_ioctl, or kill +* fops->ioctl. -arnd +*/ static const struct file_operations v4l2_fops = { .owner =THIS_MODULE , .read = v4l2_read,
@@ -330,7 +341,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .bkl_ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32,#endif
Signature · 1 line
1.6.6.1
PATCH 9/10 drivers: push down BKL into various drivers
In reply to John KacurFrom: Arnd Bergmann <[email protected]>
These are the last remaining device drivers using the ->ioctl file operation in the drivers directory.
Fixed merge conflicts that result from having applied Linus's Preparation for BKL'ed ioctl removal patch first.
--- drivers/block/pktcdvd.c | 13 ++++++++-- drivers/char/apm-emulation.c | 8 ++++-- drivers/char/applicom.c | 13 ++++++---- drivers/char/ds1620.c | 16 +++++++++++- drivers/char/dtlk.c | 15 ++++++------ drivers/char/generic_nvram.c | 17 +++++++++++-- drivers/char/genrtc.c | 16 +++++++++++- drivers/char/hpet.c | 14 +++++++---- drivers/char/i8k.c | 21 ++++++++++++++--- drivers/char/ipmi/ipmi_devintf.c | 26 +++++++++++++++++---- drivers/char/ipmi/ipmi_watchdog.c | 17 ++++++++++++- drivers/char/nvram.c | 10 ++++++-- drivers/char/nwflash.c | 7 ++++- drivers/char/raw.c | 42 ++++++++++++++++++++--------------- drivers/hwmon/fschmd.c | 9 ++++--- drivers/hwmon/w83793.c | 10 +++++--- drivers/input/misc/hp_sdc_rtc.c | 34 ++++++++++++++++++++-------- drivers/macintosh/nvram.c | 2 +- drivers/macintosh/via-pmu.c | 17 +++++++++++-- drivers/mtd/mtdchar.c | 19 +++++++++++---- drivers/pcmcia/pcmcia_ioctl.c | 17 +++++++++++-- drivers/rtc/rtc-m41t80.c | 16 +++++++++++- drivers/sbus/char/openprom.c | 44 +++++++++++++++++++++---------------- drivers/usb/mon/mon_bin.c | 23 ++++++++++++++----- drivers/usb/mon/mon_stat.c | 3 +- 25 files changed, 307 insertions(+), 122 deletions(-)
drivers/block/pktcdvd.c +10 -3
@@ -55,6 +55,7 @@#include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/miscdevice.h> +#include <linux/smp_lock.h> #include <linux/freezer.h> #include <linux/mutex.h> #include <linux/slab.h>
@@ -2984,7 +2985,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd)mutex_unlock (&ctl_mutex); } -static int pkt_ctl_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +static long pkt_ctl_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {void __user *argp = (void __user *)arg;struct pkt_ctrl_command ctrl_cmd;
@@ -3001,16 +3002,22 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmcase PKT_CTRL_CMD_SETUP :if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +lock_kernel (); ret =pkt_setup_dev (new_decode_dev (ctrl_cmd.dev), &pkt_dev); +unlock_kernel (); ctrl_cmd.pkt_dev =new_encode_dev (pkt_dev);break ;case PKT_CTRL_CMD_TEARDOWN :if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +lock_kernel (); ret =pkt_remove_dev (new_decode_dev (ctrl_cmd.pkt_dev)); +unlock_kernel ();break ;case PKT_CTRL_CMD_STATUS : +lock_kernel ();pkt_get_status (&ctrl_cmd); +unlock_kernel ();break ;default :return -ENOTTY ;
@@ -3023,8 +3030,8 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmstatic const struct file_operations pkt_ctl_fops = { - .bkl_ioctl = pkt_ctl_ioctl, - .owner =THIS_MODULE , + .unlocked_ioctl = pkt_ctl_ioctl, + .owner =THIS_MODULE , };static struct miscdevice pkt_misc = {
drivers/char/apm-emulation.c +5 -3
@@ -265,8 +265,8 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)* Only when everyone who has opened /dev/apm_bios with write permission * has acknowledge does the actual suspend happen. */ -static int -apm_ioctl (struct inode * inode,struct file *filp,u_int cmd,u_long arg) +static long +apm_ioctl (struct file *filp,u_int cmd,u_long arg) {struct apm_user *as = filp->private_data;int err = -EINVAL ;
@@ -274,6 +274,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)if (!as->suser || !as->writer)return -EPERM ; +lock_kernel ();switch (cmd) {case APM_IOC_SUSPEND :mutex_lock (&state_lock);
@@ -334,6 +335,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)mutex_unlock (&state_lock);break ; } +unlock_kernel ();return err; }
@@ -397,7 +399,7 @@ static const struct file_operations apm_bios_fops = { .owner = THIS_MODULE, .read = apm_read, .poll = apm_poll, - .bkl_ioctl = apm_ioctl, + .unlocked_ioctl = apm_ioctl, .open = apm_open, .release = apm_release, };
drivers/char/applicom.c +8 -5
@@ -26,6 +26,7 @@#include <linux/sched.h> #include <linux/slab.h> #include <linux/errno.h> +#include <linux/smp_lock.h> #include <linux/miscdevice.h> #include <linux/pci.h> #include <linux/wait.h>
@@ -106,8 +107,7 @@ static unsigned int DeviceErrorCount; /* number of device error */static ssize_t ac_read (struct file *,char __user *,size_t ,loff_t *);static ssize_t ac_write (struct file *,const char __user *,size_t ,loff_t *); -static int ac_ioctl (struct inode *,struct file *,unsigned int , -unsigned long ); +static long ac_ioctl (struct file *,unsigned int ,unsigned long );static irqreturn_t ac_interrupt (int ,void *);static const struct file_operations ac_fops = {
@@ -115,7 +115,7 @@ static const struct file_operations ac_fops = { .llseek = no_llseek, .read = ac_read, .write = ac_write, - .bkl_ioctl = ac_ioctl, + .unlocked_ioctl = ac_ioctl, };static struct miscdevice ac_miscdev = {
@@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance) -static int ac_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +static long ac_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {/* @ ADG ou ATO selon le cas */ int i;
@@ -711,7 +711,8 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unkfree (adgl);return -EFAULT ; } - + +lock_kernel (); IndexCard = adgl->num_card-1 ;if (cmd !=6 && ((IndexCard >=MAX_BOARD ) || !apbs[IndexCard].RamIO)) {
@@ -721,6 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un warncount--; }kfree (adgl); +unlock_kernel ();return -EINVAL ; }
@@ -838,6 +840,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } Dummy =readb (apbs[IndexCard].RamIO +VERS );kfree (adgl); +unlock_kernel ();return 0 ; }
drivers/char/ds1620.c +14 -2
@@ -232,7 +232,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr) }static int -ds1620_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg) +ds1620_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct therm therm;union {
@@ -316,6 +316,18 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsignedreturn 0 ; } +static long +ds1620_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =ds1620_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +#ifdef THERM_USE_PROC static int proc_therm_ds1620_read(char *buf, char **start, off_t offset,
@@ -344,7 +356,7 @@ static const struct file_operations ds1620_fops = { .owner = THIS_MODULE, .open = ds1620_open, .read = ds1620_read, - .bkl_ioctl = ds1620_ioctl, + .unlocked_ioctl = ds1620_unlocked_ioctl, };static struct miscdevice ds1620_miscdev = {
drivers/char/dtlk.c +8 -7
@@ -93,8 +93,8 @@ static ssize_t dtlk_write(struct file *, const char __user *,static unsigned int dtlk_poll (struct file *,poll_table *);static int dtlk_open (struct inode *,struct file *);static int dtlk_release (struct inode *,struct file *); -static int dtlk_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg); +static long dtlk_ioctl (struct file *file, +unsigned int cmd,unsigned long arg);static const struct file_operations dtlk_fops = {
@@ -102,7 +102,7 @@ static const struct file_operations dtlk_fops = .read = dtlk_read, .write = dtlk_write, .poll = dtlk_poll, - .bkl_ioctl = dtlk_ioctl, + .unlocked_ioctl = dtlk_ioctl, .open = dtlk_open, .release = dtlk_release, };
@@ -263,10 +263,9 @@ static void dtlk_timer_tick(unsigned long data)wake_up_interruptible (&dtlk_process_list); } -static int dtlk_ioctl (struct inode *inode, -struct file *file, -unsigned int cmd, -unsigned long arg) +static long dtlk_ioctl (struct file *file, +unsigned int cmd, +unsigned long arg) {char __user *argp = (char __user *)arg;struct dtlk_settings *sp;
@@ -276,7 +275,9 @@ static int dtlk_ioctl(struct inode *inode,switch (cmd) {case DTLK_INTERROGATE : +lock_kernel (); sp =dtlk_interrogate (); +unlock_kernel ();if (copy_to_user (argp, sp,sizeof (struct dtlk_settings )))return -EINVAL ;return 0 ;
drivers/char/generic_nvram.c +14 -3
@@ -19,6 +19,7 @@#include <linux/miscdevice.h> #include <linux/fcntl.h> #include <linux/init.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/nvram.h> #ifdef CONFIG_PPC_PMAC
@@ -84,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,return p - buf; } -static int nvram_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static int nvram_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {switch (cmd) {#ifdef CONFIG_PPC_PMAC
@@ -116,12 +116,23 @@ static int nvram_ioctl(struct inode *inode, struct file *file,return 0 ; } +static long nvram_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =nvram_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +const struct file_operations nvram_fops = { .owner =THIS_MODULE , .llseek = nvram_llseek, .read = read_nvram, .write = write_nvram, - .bkl_ioctl = nvram_ioctl, + .unlocked_ioctl = nvram_unlocked_ioctl, };static struct miscdevice nvram_dev = {
drivers/char/genrtc.c +14 -2
@@ -262,7 +262,7 @@ static inline int gen_set_rtc_irq_bit(unsigned char bit)#endif } -static int gen_rtc_ioctl (struct inode *inode,struct file *file, +static int gen_rtc_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct rtc_time wtime;
@@ -332,6 +332,18 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,return -EINVAL ; } +static long gen_rtc_unlocked_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =gen_rtc_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +/* * We enforce only one user at a time here with the open/close. * Also clear the previous interrupt data on an open, and clean
@@ -482,7 +494,7 @@ static const struct file_operations gen_rtc_fops = { .read = gen_rtc_read, .poll = gen_rtc_poll, #endif - .bkl_ioctl = gen_rtc_ioctl, + .unlocked_ioctl = gen_rtc_unlocked_ioctl, .open = gen_rtc_open, .release = gen_rtc_release, };
drivers/char/hpet.c +9 -5
@@ -431,14 +431,18 @@ static int hpet_release(struct inode *inode, struct file *file)static int hpet_ioctl_common (struct hpet_dev *,int ,unsigned long ,int ); -static int -hpet_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg) +static long hpet_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) {struct hpet_dev *devp; +int ret; devp = file->private_data; -return hpet_ioctl_common (devp, cmd, arg,0 ); +lock_kernel (); + ret =hpet_ioctl_common (devp, cmd, arg,0 ); +unlock_kernel (); + +return ret; }static int hpet_ioctl_ieon (struct hpet_dev *devp)
@@ -654,7 +658,7 @@ static const struct file_operations hpet_fops = { .llseek = no_llseek, .read = hpet_read, .poll = hpet_poll, - .bkl_ioctl = hpet_ioctl, + .unlocked_ioctl = hpet_ioctl, .open = hpet_open, .release = hpet_release, .fasync = hpet_fasync,
drivers/char/i8k.c +17 -4
@@ -21,6 +21,7 @@#include <linux/init.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> +#include <linux/smp_lock.h> #include <linux/dmi.h> #include <linux/capability.h> #include <asm/uaccess.h>
@@ -82,8 +83,8 @@ module_param(fan_mult, int, 0);MODULE_PARM_DESC (fan_mult,"Factor to multiply fan speed with" );static int i8k_open_fs (struct inode *inode,struct file *file); -static int i8k_ioctl (struct inode *,struct file *,unsigned int , -unsigned long ); +static long i8k_unlocked_ioctl (struct file *,unsigned int , +unsigned long );static const struct file_operations i8k_fops = { .owner =THIS_MODULE ,
@@ -91,7 +92,7 @@ static const struct file_operations i8k_fops = { .read = seq_read, .llseek = seq_lseek, .release = single_release, - .bkl_ioctl = i8k_ioctl, + .unlocked_ioctl = i8k_unlocked_ioctl, };struct smm_regs {
@@ -307,7 +308,7 @@ static int i8k_get_dell_signature(int req_fn)return regs.eax ==1145651527 && regs.edx ==1145392204 ?0 :-1 ; } -static int i8k_ioctl (struct inode *ip,struct file *fp,unsigned int cmd, +static int i8k_ioctl (struct file *fp,unsigned int cmd,unsigned long arg) {int val =0 ;
@@ -395,6 +396,18 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,return 0 ; } +static long +i8k_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =i8k_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +/* * Print the information for /proc/i8k. */
drivers/char/ipmi/ipmi_devintf.c +21 -5
@@ -228,8 +228,7 @@ static int handle_send_req(ipmi_user_t user,return rv; } -static int ipmi_ioctl (struct inode *inode, -struct file *file, +static int ipmi_ioctl (struct file *file,unsigned int cmd,unsigned long data) {
@@ -630,6 +629,23 @@ static int ipmi_ioctl(struct inode *inode,return rv; } +/* +* Note: it doesn't make sense to take the BKL here but +* not in compat_ipmi_ioctl. -arnd +*/ +static long ipmi_unlocked_ioctl (struct file *file, +unsigned int cmd, +unsigned long data) +{ +int ret; + +lock_kernel (); + ret =ipmi_ioctl (file, cmd, data); +unlock_kernel (); + +return ret; +} +#ifdef CONFIG_COMPAT /*
@@ -802,7 +818,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,if (copy_to_user (precv64, &recv64,sizeof (recv64)))return -EFAULT ; - rc = ipmi_ioctl(filep->f_path.dentry->d_inode, filep, + rc = ipmi_ioctl(filep, ((cmd == COMPAT_IPMICTL_RECEIVE_MSG) ? IPMICTL_RECEIVE_MSG : IPMICTL_RECEIVE_MSG_TRUNC),
@@ -819,14 +835,14 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, return rc; }default : -return ipmi_ioctl (filep->f_path.dentry->d_inode, filep, cmd, arg); +return ipmi_ioctl (filep, cmd, arg); } }#endif static const struct file_operations ipmi_fops = { .owner =THIS_MODULE , - .bkl_ioctl = ipmi_ioctl, + .unlocked_ioctl = ipmi_unlocked_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = compat_ipmi_ioctl, #endif
drivers/char/ipmi/ipmi_watchdog.c +15 -2
@@ -659,7 +659,7 @@ static struct watchdog_info ident = { .identity = "IPMI" }; -static int ipmi_ioctl (struct inode *inode,struct file *file, +static int ipmi_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {void __user *argp = (void __user *)arg;
@@ -730,6 +730,19 @@ static int ipmi_ioctl(struct inode *inode, struct file *file, } } +static long ipmi_unlocked_ioctl (struct file *file, +unsigned int cmd, +unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =ipmi_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} + static ssize_t ipmi_write(struct file *file, const char __user *buf, size_t len,
@@ -880,7 +893,7 @@ static const struct file_operations ipmi_wdog_fops = { .read = ipmi_read, .poll = ipmi_poll, .write = ipmi_write, - .bkl_ioctl = ipmi_ioctl, + .unlocked_ioctl = ipmi_unlocked_ioctl, .open = ipmi_open, .release = ipmi_close, .fasync = ipmi_fasync,
drivers/char/nvram.c +7 -3
@@ -296,8 +296,8 @@ checksum_err:return -EIO ; } -static int nvram_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static long nvram_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) {int i;
@@ -308,6 +308,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,if (!capable (CAP_SYS_ADMIN ))return -EACCES ; +lock_kernel ();spin_lock_irq (&rtc_lock);for (i =0 ; i <NVRAM_BYTES ; ++i)
@@ -315,6 +316,7 @@ static int nvram_ioctl(struct inode *inode, struct file *file,__nvram_set_checksum ();spin_unlock_irq (&rtc_lock); +unlock_kernel ();return 0 ;case NVRAM_SETCKS :
@@ -323,9 +325,11 @@ static int nvram_ioctl(struct inode *inode, struct file *file,if (!capable (CAP_SYS_ADMIN ))return -EACCES ; +lock_kernel ();spin_lock_irq (&rtc_lock);__nvram_set_checksum ();spin_unlock_irq (&rtc_lock); +unlock_kernel ();return 0 ;default :
@@ -422,7 +426,7 @@ static const struct file_operations nvram_fops = { .llseek = nvram_llseek, .read = nvram_read, .write = nvram_write, - .bkl_ioctl = nvram_ioctl, + .unlocked_ioctl = nvram_ioctl, .open = nvram_open, .release = nvram_release, };
drivers/char/nwflash.c +5 -2
@@ -94,8 +94,9 @@ static int get_flash_id(void)return c2; } -static int flash_ioctl (struct inode *inodep,struct file *filep,unsigned int cmd,unsigned long arg) +static long flash_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) { +lock_kernel ();switch (cmd) {case CMD_WRITE_DISABLE : gbWriteBase64Enable =0 ;
@@ -113,8 +114,10 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmdefault : gbWriteBase64Enable =0 ; gbWriteEnable =0 ; +unlock_kernel ();return -EINVAL ; } +unlock_kernel ();return 0 ; }
@@ -631,7 +634,7 @@ static const struct file_operations flash_fops = .llseek = flash_llseek, .read = flash_read, .write = flash_write, - .bkl_ioctl = flash_ioctl, + .unlocked_ioctl = flash_ioctl, }; static struct miscdevice flash_miscdev =
drivers/char/raw.c +24 -18
75 lines not on this page · raw message
drivers/hwmon/fschmd.c +5 -4
@@ -38,6 +38,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> +#include <linux/smp_lock.h> #include <linux/err.h> #include <linux/mutex.h> #include <linux/sysfs.h>
@@ -847,8 +848,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,return count; } -static int watchdog_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
@@ -858,6 +858,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,int i, ret =0 ;struct fschmd_data *data = filp->private_data; +lock_kernel ();switch (cmd) {case WDIOC_GETSUPPORT : ident.firmware_version = data->revision;
@@ -914,7 +915,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,default : ret = -ENOTTY ; } - +unlock_kernel ();return ret; }
@@ -924,7 +925,7 @@ static const struct file_operations watchdog_fops = { .open = watchdog_open, .release = watchdog_release, .write = watchdog_write, - .bkl_ioctl = watchdog_ioctl, + .unlocked_ioctl = watchdog_ioctl, };
drivers/hwmon/w83793.c +6 -4
@@ -35,6 +35,7 @@#include <linux/slab.h> #include <linux/i2c.h> #include <linux/hwmon.h> +#include <linux/smp_lock.h> #include <linux/hwmon-vid.h> #include <linux/hwmon-sysfs.h> #include <linux/err.h>
@@ -1319,8 +1320,8 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,return count; } -static int watchdog_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static long watchdog_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) { static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING |
@@ -1332,6 +1333,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,int val, ret =0 ;struct w83793_data *data = filp->private_data; +lock_kernel ();switch (cmd) {case WDIOC_GETSUPPORT :if (!nowayout)
@@ -1385,7 +1387,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *filp,default : ret = -ENOTTY ; } - +unlock_kernel ();return ret; }
@@ -1395,7 +1397,7 @@ static const struct file_operations watchdog_fops = { .open = watchdog_open, .release = watchdog_close, .write = watchdog_write, - .bkl_ioctl = watchdog_ioctl, + .unlocked_ioctl = watchdog_ioctl, };/*
drivers/input/misc/hp_sdc_rtc.c +24 -10
@@ -43,6 +43,7 @@#include <linux/proc_fs.h> #include <linux/poll.h> #include <linux/rtc.h> +#include <linux/smp_lock.h> #include <linux/semaphore.h> MODULE_AUTHOR ("Brian S. Julin <[email protected]>" );
@@ -64,8 +65,8 @@ static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait);static ssize_t hp_sdc_rtc_read (struct file *file,char __user *buf,size_t count,loff_t *ppos); -static int hp_sdc_rtc_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg); +static long hp_sdc_rtc_unlocked_ioctl (struct file *file, +unsigned int cmd,unsigned long arg);static unsigned int hp_sdc_rtc_poll (struct file *file,poll_table *wait);
@@ -512,7 +513,7 @@ static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,return len; } -static int hp_sdc_rtc_ioctl (struct inode *inode,struct file *file, +static int hp_sdc_rtc_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {#if 1
@@ -659,14 +660,27 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,#endif } +static long hp_sdc_rtc_unlocked_ioctl (struct file *file, +unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =hp_sdc_rtc_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} + +static const struct file_operations hp_sdc_rtc_fops = { - .owner =THIS_MODULE , - .llseek = no_llseek, - .read = hp_sdc_rtc_read, - .poll = hp_sdc_rtc_poll, - .bkl_ioctl = hp_sdc_rtc_ioctl, - .open = hp_sdc_rtc_open, - .fasync = hp_sdc_rtc_fasync, + .owner =THIS_MODULE , + .llseek = no_llseek, + .read = hp_sdc_rtc_read, + .poll = hp_sdc_rtc_poll, + .unlocked_ioctl = hp_sdc_rtc_ioctl, + .open = hp_sdc_rtc_open, + .fasync = hp_sdc_rtc_fasync, };static struct miscdevice hp_sdc_rtc_dev = {
drivers/macintosh/nvram.c +1 -1
@@ -100,7 +100,7 @@ const struct file_operations nvram_fops = { .llseek = nvram_llseek, .read = read_nvram, .write = write_nvram, - .bkl_ioctl = nvram_ioctl, + .unlocked_ioctl = nvram_ioctl, };static struct miscdevice nvram_dev = {
drivers/macintosh/via-pmu.c +14 -3
@@ -2273,8 +2273,7 @@ static int register_pmu_pm_ops(void)device_initcall (register_pmu_pm_ops);#endif -static int -pmu_ioctl (struct inode * inode,struct file *filp, +static int pmu_ioctl (struct file *filp,u_int cmd,u_long arg) {__u32 __user *argp = (__u32 __user *)arg;
@@ -2337,11 +2336,23 @@ pmu_ioctl(struct inode * inode, struct file *filp,return error; } +static long pmu_unlocked_ioctl (struct file *filp, +u_int cmd,u_long arg) +{ +int ret; + +lock_kernel (); + ret =pmu_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static const struct file_operations pmu_device_fops = { .read = pmu_read, .write = pmu_write, .poll = pmu_fpoll, - .bkl_ioctl = pmu_ioctl, + .unlocked_ioctl = pmu_unlocked_ioctl, .open = pmu_open, .release = pmu_release, };
drivers/mtd/mtdchar.c +14 -5
@@ -450,8 +450,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,return ret; } -static int mtd_ioctl (struct inode *inode,struct file *file, -u_int cmd,u_long arg) +static int mtd_ioctl (struct file *file,u_int cmd,u_long arg) {struct mtd_file_info *mfi = file->private_data;struct mtd_info *mtd = mfi->mtd;
@@ -822,6 +821,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,return ret; }/* memory_ioctl */ +static long mtd_unlocked_ioctl (struct file *file,u_int cmd,u_long arg) +{ +int ret; + +lock_kernel (); + ret =mtd_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +#ifdef CONFIG_COMPAT struct mtd_oob_buf32 {
@@ -836,7 +846,6 @@ struct mtd_oob_buf32 {static long mtd_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -struct inode *inode = file->f_path.dentry->d_inode;struct mtd_file_info *mfi = file->private_data;struct mtd_info *mtd = mfi->mtd;void __user *argp =compat_ptr (arg);
@@ -874,7 +883,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,break ; }default : - ret =mtd_ioctl (inode, file, cmd, (unsigned long )argp); + ret =mtd_ioctl (file, cmd, (unsigned long )argp); }unlock_kernel ();
@@ -942,7 +951,7 @@ static const struct file_operations mtd_fops = { .llseek = mtd_lseek, .read = mtd_read, .write = mtd_write, - .bkl_ioctl = mtd_ioctl, + .unlocked_ioctl = mtd_unlocked_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = mtd_compat_ioctl,#endif
drivers/pcmcia/pcmcia_ioctl.c +14 -3
@@ -821,8 +821,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)/*====================================================================*/ -static int ds_ioctl (struct inode *inode,struct file *file, -u_int cmd,u_long arg) +static int ds_ioctl (struct file *file,u_int cmd,u_long arg) {struct pcmcia_socket *s;void __user *uarg = (char __user *)arg;
@@ -1031,13 +1030,25 @@ free_out:return err; }/* ds_ioctl */ +static long ds_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =ds_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} + +/*====================================================================*/ static const struct file_operations ds_fops = { .owner =THIS_MODULE , .open = ds_open, .release = ds_release, - .bkl_ioctl = ds_ioctl, + .unlocked_ioctl = ds_unlocked_ioctl, .read = ds_read, .write = ds_write, .poll = ds_poll,
drivers/rtc/rtc-m41t80.c +14 -2
@@ -623,7 +623,7 @@ static ssize_t wdt_read(struct file *file, char __user *buf,* according to their available features. We only actually usefully support * querying capabilities and current status. */ -static int wdt_ioctl (struct inode *inode,struct file *file,unsigned int cmd, +static int wdt_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {int new_margin, rv;
@@ -676,6 +676,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,return -ENOTTY ; } +static long wdt_unlocked_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =wdt_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +/** * wdt_open: * @inode: inode of device
@@ -736,7 +748,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code,static const struct file_operations wdt_fops = { .owner =THIS_MODULE , .read = wdt_read, - .bkl_ioctl = wdt_ioctl, + .unlocked_ioctl = wdt_unlocked_ioctl, .write = wdt_write, .open = wdt_open, .release = wdt_release,
drivers/sbus/char/openprom.c +25 -19
140 lines not on this page · raw message
drivers/usb/mon/mon_bin.c +17 -6
@@ -954,8 +954,7 @@ static int mon_bin_queued(struct mon_reader_bin *rp)/* */ -static int mon_bin_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static int mon_bin_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct mon_reader_bin *rp = file->private_data;// struct mon_bus* mbus = rp->r.m_bus;
@@ -1095,6 +1094,19 @@ static int mon_bin_ioctl(struct inode *inode, struct file *file,return ret; } +static long mon_bin_unlocked_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =mon_bin_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} + +#ifdef CONFIG_COMPAT static long mon_bin_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg)
@@ -1148,14 +1160,13 @@ static long mon_bin_compat_ioctl(struct file *file,return 0 ;case MON_IOCG_STATS : -return mon_bin_ioctl (NULL , file, cmd, - (unsigned long )compat_ptr (arg)); +return mon_bin_ioctl (file, cmd, (unsigned long )compat_ptr (arg));case MON_IOCQ_URB_LEN :case MON_IOCQ_RING_SIZE :case MON_IOCT_RING_SIZE :case MON_IOCH_MFLUSH : -return mon_bin_ioctl (NULL , file, cmd, arg); +return mon_bin_ioctl (file, cmd, arg);default : ;
@@ -1239,7 +1250,7 @@ static const struct file_operations mon_fops_binary = { .read = mon_bin_read, /* .write = mon_text_write, */ .poll = mon_bin_poll, - .bkl_ioctl = mon_bin_ioctl, + .unlocked_ioctl = mon_bin_unlocked_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = mon_bin_compat_ioctl,#endif
drivers/usb/mon/mon_stat.c +2 -1
@@ -11,6 +11,7 @@#include <linux/slab.h> #include <linux/usb.h> #include <linux/fs.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include "usb_mon.h"
@@ -63,6 +64,6 @@ const struct file_operations mon_fops_stat = { .read = mon_stat_read,/* .write = mon_stat_write, */ /* .poll = mon_stat_poll, */ -/* .bkl_ioctl = mon_stat_ioctl, */ +/* .unlocked_ioctl = mon_stat_ioctl, */ .release = mon_stat_release, };
Signature · 1 line
1.6.6.1
PATCH 10/10 bkl: Fix-up compile problems as a result of the bkl-pushdown.
In reply to John KacurFix-up compile problems as a result of the bkl-pushdown. In particular, the v4l2_ioctl should call an unlocked_ioctl
--- drivers/media/video/v4l2-dev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/video/v4l2-dev.c +2 -2
@@ -222,12 +222,12 @@ static long v4l2_ioctl(struct file *filp,struct video_device *vdev =video_devdata (filp);int ret; -if (!vdev->fops->ioctl) +if (!vdev->fops->unlocked_ioctl)return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ lock_kernel (); - ret = vdev->fops->ioctl (filp->f_path.dentry->d_inode, filp, cmd, arg); + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg);unlock_kernel ();return ret;
Signature · 1 line
1.6.6.1
Arnd Bergmann
maintainerRe: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 17 lines · John Kacur
Fix-up compile problems as a result of the bkl-pushdown. In particular, the
v4l2_ioctlshould call anunlocked_ioctlSigned-off-by John Kacur <[email protected]>--- drivers/media/video/v4l2-dev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/media/video/v4l2-dev.c +0
-1@@ -222,12 +222,12 @@ static long v4l2_ioctl(struct file *filp,struct video_device *vdev =video_devdata (filp);int ret; -if (!vdev->fops->ioctl)
drivers/media/video/v4l2-dev.c static long v4l2_ioctl(struct file *filp, · line 233
Quoted 10 lines
drivers/media/video/v4l2-dev.c +2
-1+if (!vdev->fops->unlocked_ioctl)return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ lock_kernel (); - ret = vdev->fops->ioctl (filp->f_path.dentry->d_inode, filp, cmd, arg); + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg);unlock_kernel ();return ret;
No, this is what I thought as well, at first, but the version I posted is actually correct.
vdev->fops is not struct file_operations but struct v4l2_file_operations, and the v4l2_ioctl function is used only when fops->ioctl is set, see __video_register_device.
The v4l2 ioctl stuff probably can use a lot of cleanup itself, but so far I think we're not making it worse with my patch.
Arnd
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 32 lines · Arnd Bergmann
Quoted 17 lines · John Kacur
Fix-up compile problems as a result of the bkl-pushdown. In particular, the
v4l2_ioctlshould call anunlocked_ioctlSigned-off-by John Kacur <[email protected]>--- drivers/media/video/v4l2-dev.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/media/video/v4l2-dev.c +0
-1@@ -222,12 +222,12 @@ static long v4l2_ioctl(struct file *filp,struct video_device *vdev =video_devdata (filp);int ret; -if (!vdev->fops->ioctl)drivers/media/video/v4l2-dev.c static long v4l2_ioctl(struct file *filp, · line 233
Quoted 10 lines
drivers/media/video/v4l2-dev.c +2
-1+if (!vdev->fops->unlocked_ioctl)return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ lock_kernel (); - ret = vdev->fops->ioctl (filp->f_path.dentry->d_inode, filp, cmd, arg); + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg);unlock_kernel ();return ret;No, this is what I thought as well, at first, but the version I posted is actually correct.
Quoted 7 lines
vdev->fopsis not structfile_operationsbut structv4l2_file_operations, and thev4l2_ioctlfunction is used only whenfops->ioctlis set, see__video_register_device.The v4l2 ioctl stuff probably can use a lot of cleanup itself, but so far I think we're not making it worse with my patch.
Hi Arnd
Well it is certainly possible that my fixup is not correct too - your patch cannot be correct, because it doesn't compile! Here is what I get when I apply your patch to a recent linus/master
make O=/bld/arnd/ drivers/media/video/v4l2-dev.o
-----CUT A BUNCH OF STUFF OUT ---
CC drivers/media/video/v4l2-dev.o/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c: In function ‘v4l2_ioctl’:/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: warning: passing argument 1 of ‘vdev->fops->ioctl’ from incompatible pointer type /home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: note: expected ‘struct file *’ but argument is of type ‘struct inode *’ /home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: warning: passing argument 2 of ‘vdev->fops->ioctl’ makes integer from pointer without a cast/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: note: expected ‘unsigned int’ but argument is of type ‘struct file *’ /home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: error: too many arguments to function ‘vdev->fops->ioctl’
make[2]: *** [drivers/media/video/v4l2-dev.o] Error 1 make[1]: *** [drivers/media/video/v4l2-dev.o] Error 2
make: *** [sub-make] Error 2
Thanks
Arnd Bergmann
maintainerRe: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 3 lines · John Kacur
Well it is certainly possible that my fixup is not correct too - your patch cannot be correct, because it doesn't compile! Here is what I get when I apply your patch to a recent linus/master
Ah, I see.
Quoted 9 lines
make O=/bld/arnd/
drivers/media/video/v4l2-dev.o
-----CUT A BUNCH OF STUFF OUT ---
CCdrivers/media/video/v4l2-dev.o/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c: In function ‘v4l2_ioctl’:/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: warning: passing argument 1 of ‘vdev->fops->ioctl’ from incompatible pointer type/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: note: expected ‘struct file *’ but argument is of type ‘struct inode *’
I didn't realize that the prototype for the locked ->ioctl function in v4l2 does not take the inode argument, so that needs to be dropped from my patch (i.e. not added).
Or we do it slightly better and clean up the code a bit in the process.
Mauro, does this patch make sense to you? It would be good to have your Ack so we can queue this in the series leading to the removal of the ->ioctl file operation. We can also do the minimal change and let you take care of fixing this up in a different way in your own tree.
---
Subject: v4l: convert v4l2-dev to unlocked_ioctl
v4l2 implements two separate file operations for drivers that use locked and unlocked ioctl callbacks. Since we want to remove the ioctl file operation in favor of the unlocked variant, this separation no longer seems helpful.
Unfortunately, there are still 77 drivers with locked ioctl functions in their v4l2_file_operations, which need to be taken care of separately.
--- drivers/media/video/v4l2-dev.c | 52 +++++++++++---------------------------- 1 files changed, 15 insertions(+), 37 deletions(-)
drivers/media/video/v4l2-dev.c +15 -37
@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/system.h>
@@ -215,28 +216,24 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)return vdev->fops->poll (filp, poll); } -static int v4l2_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret; -if (!vdev->fops->ioctl) -return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ -return vdev->fops->ioctl (filp, cmd, arg); -} - -static long v4l2_unlocked_ioctl (struct file *filp, -unsigned int cmd,unsigned long arg) -{ -struct video_device *vdev =video_devdata (filp); +if (vdev->fops->unlocked_ioctl) { + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg); + }else if (vdev->fops->ioctl) { +/* TODO: convert all drivers to unlocked_ioctl */ +lock_kernel (); + ret = vdev->fops->ioctl (filp, cmd, arg); +unlock_kernel (); + }else + ret = -ENOTTY ; -if (!vdev->fops->unlocked_ioctl) -return -ENOTTY ; -/* Allow ioctl to continue even if the device was unregistered. -Things like dequeueing buffers might still be useful. */ -return vdev->fops->unlocked_ioctl (filp, cmd, arg); +return ret; }#ifdef CONFIG_MMU
@@ -307,22 +304,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)return ret; } -static const struct file_operations v4l2_unlocked_fops = { - .owner =THIS_MODULE , - .read = v4l2_read, - .write = v4l2_write, - .open = v4l2_open, - .get_unmapped_area = v4l2_get_unmapped_area, - .mmap = v4l2_mmap, - .unlocked_ioctl = v4l2_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = v4l2_compat_ioctl32, -#endif - .release = v4l2_release, - .poll = v4l2_poll, - .llseek = no_llseek, -}; -static const struct file_operations v4l2_fops = { .owner =THIS_MODULE , .read = v4l2_read,
@@ -330,7 +311,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32,#endif
@@ -517,10 +498,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, ret = -ENOMEM ; goto cleanup; } -if (vdev->fops->unlocked_ioctl) - vdev->cdev->ops = &v4l2_unlocked_fops; -else - vdev->cdev->ops = &v4l2_fops; + vdev->cdev->ops = &v4l2_fops; vdev->cdev->owner = vdev->fops->owner; ret =cdev_add (vdev->cdev,MKDEV (VIDEO_MAJOR , vdev->minor),1 );if (ret <0 ) {
Mauro Carvalho Chehab
Acked-byRe: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Hi Arnd,
Quoted 21 lines · Arnd Bergmann
Quoted 3 lines · John Kacur
Well it is certainly possible that my fixup is not correct too - your patch cannot be correct, because it doesn't compile! Here is what I get when I apply your patch to a recent linus/master
Ah, I see.
Quoted 9 lines
make O=/bld/arnd/
drivers/media/video/v4l2-dev.o
-----CUT A BUNCH OF STUFF OUT ---
CCdrivers/media/video/v4l2-dev.o/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c: In function ‘v4l2_ioctl’:/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: warning: passing argument 1 of ‘vdev->fops->ioctl’ from incompatible pointer type/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: note: expected ‘struct file *’ but argument is of type ‘struct inode *’I didn't realize that the prototype for the locked ->ioctl function in v4l2 does not take the inode argument, so that needs to be dropped from my patch (i.e. not added).
Quoted 6 lines
Or we do it slightly better and clean up the code a bit in the process.
Mauro, does this patch make sense to you? It would be good to have your Ack so we can queue this in the series leading to the removal of the ->ioctl file operation. We can also do the minimal change and let you take care of fixing this up in a different way in your own tree.
We had a similar discussion a while ago at linux-media. The idea is to do it on a deeper level, changing the drivers to not need to use KBL. Hans is working on those patches. Not sure about the current status.
Anyway, I think that the better is to apply first your patch, to avoid breaking your patch series, and then ours, as we may otherwise have some conflicts between your tree and drivers/media git tree.
So,
Quoted 113 lines
---
Subject: v4l: convert v4l2-dev tounlocked_ioctlv4l2 implements two separate file operations for drivers that use locked and unlocked ioctl callbacks. Since we want to remove the ioctl file operation in favor of the unlocked variant, this separation no longer seems helpful.
Unfortunately, there are still 77 drivers with locked ioctl functions in their
v4l2_file_operations, which need to be taken care of separately.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/media/video/v4l2-dev.c | 52 +++++++++++---------------------------- 1 files changed, 15 insertions(+), 37 deletions(-)drivers/media/video/v4l2-dev.c +15
-37@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/system.h> @@ -215,28 +216,24 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)return vdev->fops->poll (filp, poll); } -static int v4l2_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret; -if (!vdev->fops->ioctl) -return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ -return vdev->fops->ioctl (filp, cmd, arg); -} - -static long v4l2_unlocked_ioctl (struct file *filp, -unsigned int cmd,unsigned long arg) -{ -struct video_device *vdev =video_devdata (filp); +if (vdev->fops->unlocked_ioctl) { + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg); + }else if (vdev->fops->ioctl) { +/* TODO: convert all drivers to unlocked_ioctl */ +lock_kernel (); + ret = vdev->fops->ioctl (filp, cmd, arg); +unlock_kernel (); + }else + ret = -ENOTTY ; -if (!vdev->fops->unlocked_ioctl) -return -ENOTTY ; -/* Allow ioctl to continue even if the device was unregistered. -Things like dequeueing buffers might still be useful. */ -return vdev->fops->unlocked_ioctl (filp, cmd, arg); +return ret; }#ifdef CONFIG_MMU @@ -307,22 +304,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)return ret; } -static const struct file_operations v4l2_unlocked_fops = { - .owner =THIS_MODULE , - .read = v4l2_read, - .write = v4l2_write, - .open = v4l2_open, - .get_unmapped_area = v4l2_get_unmapped_area, - .mmap = v4l2_mmap, - .unlocked_ioctl = v4l2_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = v4l2_compat_ioctl32, -#endif - .release = v4l2_release, - .poll = v4l2_poll, - .llseek = no_llseek, -}; -static const struct file_operations v4l2_fops = { .owner =THIS_MODULE , .read = v4l2_read,@@ -330,7 +311,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32,#endif @@ -517,10 +498,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, ret = -ENOMEM ; goto cleanup; } -if (vdev->fops->unlocked_ioctl) - vdev->cdev->ops = &v4l2_unlocked_fops; -else - vdev->cdev->ops = &v4l2_fops; + vdev->cdev->ops = &v4l2_fops; vdev->cdev->owner = vdev->fops->owner; ret =cdev_add (vdev->cdev,MKDEV (VIDEO_MAJOR , vdev->minor),1 );if (ret <0 ) {
Signature · 2 lines
Cheers, Mauro
Hans Verkuil
Acked-byRe: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 28 lines
Hi Arnd,
Quoted 24 lines · Arnd Bergmann
Quoted 3 lines · John Kacur
Well it is certainly possible that my fixup is not correct too - your patch cannot be correct, because it doesn't compile! Here is what I get when I apply your patch to a recent linus/master
Ah, I see.
Quoted 10 lines
make O=/bld/arnd/
drivers/media/video/v4l2-dev.o
-----CUT A BUNCH OF STUFF OUT ---
CCdrivers/media/video/v4l2-dev.o/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c: In function ‘v4l2_ioctl’:/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: warning:
passing
argument 1 of ‘vdev->fops->ioctl’ from incompatible pointer type/home/jkacur/jk-2.6/drivers/media/video/v4l2-dev.c:230: note: expected ‘struct file *’ but argument is of type ‘struct inode *’I didn't realize that the prototype for the locked ->ioctl function in v4l2 does not take the inode argument, so that needs to be dropped from my patch (i.e. not added).
Or we do it slightly better and clean up the code a bit in the process.
Quoted 8 lines
Quoted 4 lines
Mauro, does this patch make sense to you? It would be good to have your Ack so we can queue this in the series leading to the removal of the ->ioctl file operation. We can also do the minimal change and let you take care of fixing this up in a different way in your own tree.
We had a similar discussion a while ago at linux-media. The idea is to do it on a deeper level, changing the drivers to not need to use KBL. Hans is working on those patches. Not sure about the current status.
I'm waiting for the event patch series from Sakari to go in before I can continue working on this.
Quoted 3 lines
Anyway, I think that the better is to apply first your patch, to avoid breaking your patch series, and then ours, as we may otherwise have some conflicts between your tree and
drivers/mediagit tree.
I have no real problem with this patch, as long as people realize that this only moves the BKL from one place to another and does not really fix any drivers.
Regards,
Hans
Quoted 133 lines
So,
Quoted 120 lines
---
Subject: v4l: convert v4l2-dev tounlocked_ioctlv4l2 implements two separate file operations for drivers that use locked and unlocked ioctl callbacks. Since we want to remove the ioctl file operation
in favor of the unlocked variant, this separation no longer seems helpful.Unfortunately, there are still 77 drivers with locked ioctl functions in their
v4l2_file_operations, which need to be taken care of separately.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/media/video/v4l2-dev.c | 52 +++++++++++---------------------------- 1 files changed, 15 insertions(+), 37 deletions(-)drivers/media/video/v4l2-dev.c +13
-16@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/system.h> @@ -215,28 +216,24 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)return vdev->fops->poll (filp, poll); } -static int v4l2_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret; -if (!vdev->fops->ioctl) -return -ENOTTY ;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ -return vdev->fops->ioctl (filp, cmd, arg); -} - -static long v4l2_unlocked_ioctl (struct file *filp, -unsigned int cmd,unsigned long arg) -{ -struct video_device *vdev =video_devdata (filp); +if (vdev->fops->unlocked_ioctl) { + ret = vdev->fops->unlocked_ioctl (filp, cmd, arg); + }else if (vdev->fops->ioctl) { +/* TODO: convert all drivers to unlocked_ioctl */ +lock_kernel (); + ret = vdev->fops->ioctl (filp, cmd, arg); +unlock_kernel (); + }else + ret = -ENOTTY ; -if (!vdev->fops->unlocked_ioctl) -return -ENOTTY ; -/* Allow ioctl to continue even if the device was unregistered. -Things like dequeueing buffers might still be useful. */ -return vdev->fops->unlocked_ioctl (filp, cmd, arg); +return ret; }#ifdef
CONFIG_MMUdrivers/media/video/v4l2-dev.c +0
-16@@ -307,22 +304,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)return ret; } -static const struct file_operations v4l2_unlocked_fops = { - .owner =THIS_MODULE , - .read = v4l2_read, - .write = v4l2_write, - .open = v4l2_open, - .get_unmapped_area = v4l2_get_unmapped_area, - .mmap = v4l2_mmap, - .unlocked_ioctl = v4l2_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = v4l2_compat_ioctl32, -#endif - .release = v4l2_release, - .poll = v4l2_poll, - .llseek = no_llseek, -}; -static const struct file_operations v4l2_fops = { .owner =THIS_MODULE ,drivers/media/video/v4l2-dev.c +2
-5.read = v4l2_read,@@ -330,7 +311,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32,#endif @@ -517,10 +498,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, ret = -ENOMEM ; goto cleanup; } -if (vdev->fops->unlocked_ioctl) - vdev->cdev->ops = &v4l2_unlocked_fops; -else - vdev->cdev->ops = &v4l2_fops; + vdev->cdev->ops = &v4l2_fops; vdev->cdev->owner = vdev->fops->owner; ret =cdev_add (vdev->cdev,MKDEV (VIDEO_MAJOR , vdev->minor),1 );Quoted 1 line
if (ret < 0) {
--
Cheers,
Mauro
Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Hi Hans,
Quoted 1 line · On Wednesday 28 April 2010 14:37:10 Hans Verkuil wrote:
Quoted 1 line
Arnd Bergmann wrote:
[snip]
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Mauro, does this patch make sense to you? It would be good to have your Ack so we can queue this in the series leading to the removal of the ->ioctl file operation. We can also do the minimal change and let you take care of fixing this up in a different way in your own tree.
We had a similar discussion a while ago at linux-media. The idea is to do it on a deeper level, changing the drivers to not need to use KBL. Hans is working on those patches. Not sure about the current status.
I'm waiting for the event patch series from Sakari to go in before I can continue working on this.
Quoted 7 lines
Quoted 3 lines
Anyway, I think that the better is to apply first your patch, to avoid breaking your patch series, and then ours, as we may otherwise have some conflicts between your tree and
drivers/mediagit tree.I have no real problem with this patch, as long as people realize that this only moves the BKL from one place to another and does not really fix any drivers.
Seems that Arnd was more convincing than me. I've submitted the exact same patch a while ago :-)
Of course this doesn't solve the BKL issue, but it pushes it one level down, closer to the drivers. Higher levels can then stop caring about it. Of course lower levels will still need to remove the BKL.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 20 lines · Laurent Pinchart
Hi Hans,
Quoted 1 line · On Wednesday 28 April 2010 14:37:10 Hans Verkuil wrote:
Quoted 1 line
Arnd Bergmann wrote:
[snip]
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines
Mauro, does this patch make sense to you? It would be good to have your Ack so we can queue this in the series leading to the removal of the ->ioctl file operation. We can also do the minimal change and let you take care of fixing this up in a different way in your own tree.
We had a similar discussion a while ago at linux-media. The idea is to do it on a deeper level, changing the drivers to not need to use KBL. Hans is working on those patches. Not sure about the current status.
I'm waiting for the event patch series from Sakari to go in before I can continue working on this.
Quoted 3 lines
Anyway, I think that the better is to apply first your patch, to avoid breaking your patch series, and then ours, as we may otherwise have some conflicts between your tree and
drivers/mediagit tree.
Quoted 6 lines
Quoted 3 lines
I have no real problem with this patch, as long as people realize that this only moves the BKL from one place to another and does not really fix any drivers.
Seems that Arnd was more convincing than me. I've submitted the exact same patch a while ago :-)
Same patch, different situation ;)
Quoted 3 lines
Of course this doesn't solve the BKL issue, but it pushes it one level down, closer to the drivers. Higher levels can then stop caring about it. Of course lower levels will still need to remove the BKL.
Yes. This patch doesn't change anything in practice, but it allows RT people to keep working on their series of changes, giving us a little more time to work on a definitive solution. If nacked, we would need to send an alternative patch for them, and, as this is not ready (and such patch applied via RT tree would likely cause merge conflicts with our patches), the better is to just ack and keep writing the patch that will solve the issue.
Your patch were very useful, as it started the discussions for the BKL removal on drivers/media drivers.
Signature · 2 lines
Cheers, Mauro
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
In reply to Arnd BergmannQuoted 8 lines · Arnd Bergmann
drivers/media/video/v4l2-dev.c +3
-0+static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ +if (vdev->fops->unlocked_ioctl) {
drivers/media/video/v4l2-dev.c static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) · line 236
Quoted 10 lines
drivers/media/video/v4l2-dev.c +9
-0+ ret = vdev->fops->unlocked_ioctl (filp, cmd, arg); + }else if (vdev->fops->ioctl) { +/* TODO: convert all drivers to unlocked_ioctl */ +lock_kernel (); + ret = vdev->fops->ioctl (filp, cmd, arg); +unlock_kernel (); + }else + ret = -ENOTTY ; +return ret;
[ Removed the '-' lines so you can see what the end result ends up being ]
Please, if you do this for the V4L2 layer, then DO NOT make the same mistake we did with the vasic VFS layer.
In other words, DO NOT keep the "bkl" version named just "ioctl". It was a horrible horrible mistake, and it has resulted in problems years afterwards.
I realize that it's so easy to just add a new ".unlocked_ioctl" member, and then as people start using it, they get rid of the BKL. But it's a mistake. It was a mistake for the VFS layer, it would be a mistake for the V4L2 layer.
Instead, spend the 15 minutes just renaming every current 'ioctl' user in the V4L2 layer. It's not that much work, the scripts I documented in my renaming patch do 95% of the work (you just need to change "file_operations" to "v4l2_file_operations"). It's not that painful. And then you don't just push the BKL down, you actually annotate the remaining users so that they can be grepped for.
So please please please, don't make the same mistake we did long ago.
Linus
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result of the bkl-pushdown.
Quoted 43 lines · Linus Torvalds
Quoted 8 lines · Arnd Bergmann
drivers/media/video/v4l2-dev.c +3
-0+static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp); +int ret;/* Allow ioctl to continue even if the device was unregistered. Things like dequeueing buffers might still be useful. */ +if (vdev->fops->unlocked_ioctl) {drivers/media/video/v4l2-dev.c static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) · line 236
Quoted 10 lines
drivers/media/video/v4l2-dev.c +9
-0+ ret = vdev->fops->unlocked_ioctl (filp, cmd, arg); + }else if (vdev->fops->ioctl) { +/* TODO: convert all drivers to unlocked_ioctl */ +lock_kernel (); + ret = vdev->fops->ioctl (filp, cmd, arg); +unlock_kernel (); + }else + ret = -ENOTTY ; +return ret;[ Removed the '-' lines so you can see what the end result ends up being ]
Please, if you do this for the V4L2 layer, then DO NOT make the same mistake we did with the vasic VFS layer.
In other words, DO NOT keep the "bkl" version named just "ioctl". It was a horrible horrible mistake, and it has resulted in problems years afterwards.
I realize that it's so easy to just add a new ".unlocked_ioctl" member, and then as people start using it, they get rid of the BKL. But it's a mistake. It was a mistake for the VFS layer, it would be a mistake for the V4L2 layer.
Instead, spend the 15 minutes just renaming every current 'ioctl' user in the V4L2 layer. It's not that much work, the scripts I documented in my renaming patch do 95% of the work (you just need to change "
file_operations" to "v4l2_file_operations"). It's not that painful. And then you don't just push the BKL down, you actually annotate the remaining users so that they can be grepped for.
Quoted 3 lines
So please please please, don't make the same mistake we did long ago.
Linus
Hmm, there are 92 struct v4l2_file_operations::ioctl but actually a lot of duplicates ioctl. In fact there are just 26 ioctl functions.
It's probably worth the whole pushdown instead of the rename.
I'm going to do this.
cover Pushdown bkl from v4l ioctls
In reply to Linus TorvaldsHi,
Linus suggested to rename struct v4l2_file_operations::ioctl into bkl_ioctl to eventually get something greppable and make its background explicit.
While at it I thought it could be a good idea to just pushdown the bkl to every v4l drivers that have an .ioctl, so that we actually remove struct v4l2_file_operations::ioctl for good.
It passed make allyesconfig on sparc.
Please tell me what you think.
Thanks.
Frederic Weisbecker (5):
v4l: Pushdown bkl into video_ioctl2
v4l: Use video_ioctl2_unlocked from drivers that don't want the bkl
v4l: Change users of video_ioctl2 to use unlocked_ioctl
v4l: Pushdown bkl to drivers that implement their own ioctl
v4l: Remove struct v4l2_file_operations::ioctl
drivers/media/common/saa7146_fops.c | 2 +- drivers/media/radio/dsbr100.c | 2 +- drivers/media/radio/radio-aimslab.c | 2 +- drivers/media/radio/radio-aztech.c | 2 +- drivers/media/radio/radio-cadet.c | 2 +- drivers/media/radio/radio-gemtek-pci.c | 2 +- drivers/media/radio/radio-gemtek.c | 2 +- drivers/media/radio/radio-maestro.c | 2 +- drivers/media/radio/radio-maxiradio.c | 2 +- drivers/media/radio/radio-miropcm20.c | 2 +- drivers/media/radio/radio-mr800.c | 2 +- drivers/media/radio/radio-rtrack2.c | 2 +- drivers/media/radio/radio-sf16fmi.c | 2 +- drivers/media/radio/radio-sf16fmr2.c | 2 +- drivers/media/radio/radio-si4713.c | 2 +- drivers/media/radio/radio-tea5764.c | 2 +- drivers/media/radio/radio-terratec.c | 2 +- drivers/media/radio/radio-timb.c | 2 +- drivers/media/radio/radio-trust.c | 2 +- drivers/media/radio/radio-typhoon.c | 2 +- drivers/media/radio/radio-zoltrix.c | 2 +- drivers/media/radio/si470x/radio-si470x-common.c | 2 +- drivers/media/video/arv.c | 2 +- drivers/media/video/au0828/au0828-video.c | 14 ++++---- drivers/media/video/bt8xx/bttv-driver.c | 26 +++++++------- drivers/media/video/bw-qcam.c | 11 +++++- drivers/media/video/c-qcam.c | 11 +++++- drivers/media/video/cafe_ccic.c | 14 ++++---- drivers/media/video/cpia.c | 11 +++++- drivers/media/video/cpia2/cpia2_v4l.c | 11 +++++- drivers/media/video/cx18/cx18-streams.c | 12 +++--- drivers/media/video/cx231xx/cx231xx-video.c | 4 +- drivers/media/video/cx23885/cx23885-417.c | 2 +- drivers/media/video/cx23885/cx23885-video.c | 4 +- drivers/media/video/cx88/cx88-blackbird.c | 2 +- drivers/media/video/cx88/cx88-video.c | 4 +- drivers/media/video/davinci/vpfe_capture.c | 2 +- drivers/media/video/davinci/vpif_capture.c | 2 +- drivers/media/video/davinci/vpif_display.c | 2 +- drivers/media/video/em28xx/em28xx-video.c | 4 +- drivers/media/video/et61x251/et61x251_core.c | 27 +++++++++++---- drivers/media/video/gspca/gspca.c | 2 +- drivers/media/video/hdpvr/hdpvr-video.c | 2 +- drivers/media/video/meye.c | 2 +- drivers/media/video/omap24xxcam.c | 10 +++--- drivers/media/video/ov511.c | 15 +++++--- drivers/media/video/pms.c | 2 +- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 20 +++++++---- drivers/media/video/pwc/pwc-if.c | 19 ++++++---- drivers/media/video/s2255drv.c | 12 +++--- drivers/media/video/saa5246a.c | 11 ++++-- drivers/media/video/saa5249.c | 6 +++- drivers/media/video/saa7134/saa7134-empress.c | 14 ++++---- drivers/media/video/saa7134/saa7134-video.c | 26 +++++++------- drivers/media/video/se401.c | 20 +++++++---- drivers/media/video/sn9c102/sn9c102_core.c | 27 +++++++++++---- drivers/media/video/soc_camera.c | 2 +- drivers/media/video/stk-webcam.c | 14 ++++---- drivers/media/video/stradis.c | 26 +++++++++++---- drivers/media/video/stv680.c | 20 +++++++---- drivers/media/video/tlg2300/pd-radio.c | 8 ++-- drivers/media/video/tlg2300/pd-video.c | 2 +- drivers/media/video/usbvideo/usbvideo.c | 21 ++++++++---- drivers/media/video/usbvideo/vicam.c | 14 +++++++- drivers/media/video/usbvision/usbvision-video.c | 4 +- drivers/media/video/uvc/uvc_v4l2.c | 11 +++++- drivers/media/video/v4l2-dev.c | 38 ++------------------- drivers/media/video/v4l2-ioctl.c | 17 ++++++++- drivers/media/video/vivi.c | 2 +- drivers/media/video/w9966.c | 2 +- drivers/media/video/w9968cf.c | 25 +++++++++++--- drivers/media/video/zc0301/zc0301_core.c | 27 +++++++++++---- drivers/media/video/zoran/zoran_driver.c | 16 ++++---- drivers/media/video/zr364xx.c | 14 ++++---- drivers/staging/cx25821/cx25821-audups11.c | 18 ++++++---- drivers/staging/cx25821/cx25821-video0.c | 14 ++++---- drivers/staging/cx25821/cx25821-video1.c | 14 ++++---- drivers/staging/cx25821/cx25821-video2.c | 14 ++++---- drivers/staging/cx25821/cx25821-video3.c | 14 ++++---- drivers/staging/cx25821/cx25821-video4.c | 14 ++++---- drivers/staging/cx25821/cx25821-video5.c | 14 ++++---- drivers/staging/cx25821/cx25821-video6.c | 14 ++++---- drivers/staging/cx25821/cx25821-video7.c | 14 ++++---- drivers/staging/cx25821/cx25821-videoioctl.c | 27 +++++++++++---- drivers/staging/cx25821/cx25821-vidups10.c | 19 +++++++---- drivers/staging/cx25821/cx25821-vidups9.c | 18 ++++++---- drivers/staging/dream/camera/msm_v4l2.c | 27 +++++++++++---- drivers/staging/go7007/go7007-v4l2.c | 2 +- drivers/staging/tm6000/tm6000-video.c | 2 +- include/media/v4l2-dev.h | 1 - include/media/v4l2-ioctl.h | 2 + sound/i2c/other/tea575x-tuner.c | 2 +- 92 files changed, 530 insertions(+), 360 deletions(-)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
Quoted 6 lines · On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
Hi,
Linus suggested to rename struct
v4l2_file_operations::ioctlintobkl_ioctlto eventually get something greppable and make its background explicit.
Quoted 6 lines
While at it I thought it could be a good idea to just pushdown the bkl to every v4l drivers that have an .ioctl, so that we actually remove struct
v4l2_file_operations::ioctlfor good.It passed make allyesconfig on sparc.
Please tell me what you think.
I much prefer to keep the bkl inside the v4l2 core. One reason is that I think that we can replace the bkl in the core with a mutex. Still not ideal of course, so the next step will be to implement proper locking in each driver. For this some additional v4l infrastructure work needs to be done. I couldn't proceed with that until the v4l events API patches went in, and that happened yesterday.
So from my point of view the timeline is this:
1) I do the infrastructure work this weekend. This will make it much easier to convert drivers to do proper locking. And it will also simplify v4l2_priority handling, so I'm killing two birds with one stone :-)
2) Wait until Arnd's patch gets merged that pushes the bkl down to v4l2-dev.c
3) Investigate what needs to be done to replace the bkl with a v4l2-dev.c global mutex. Those drivers that call the bkl themselves should probably be converted to do proper locking, but there are only about 14 drivers that do this. The other 60 or so drivers should work fine if a v4l2-dev global lock is used. At this point the bkl is effectively removed from the v4l subsystem.
4) Work on the remaining 60 drivers to do proper locking and get rid of the v4l2-dev global lock. This is probably less work than it sounds.
Since your patch moves everything down to the driver level it will actually make this work harder rather than easier. And it touches almost all drivers as well.
Regards,
Hans
Quoted 104 lines
Thanks.
Frederic Weisbecker (5):
v4l: Pushdown bkl intovideo_ioctl2
v4l: Usevideo_ioctl2_unlockedfrom drivers that don't want the bkl
v4l: Change users ofvideo_ioctl2to useunlocked_ioctl
v4l: Pushdown bkl to drivers that implement their own ioctl
v4l: Remove structv4l2_file_operations::ioctldrivers/media/common/saa7146_fops.c | 2 +- drivers/media/radio/dsbr100.c | 2 +- drivers/media/radio/radio-aimslab.c | 2 +- drivers/media/radio/radio-aztech.c | 2 +- drivers/media/radio/radio-cadet.c | 2 +- drivers/media/radio/radio-gemtek-pci.c | 2 +- drivers/media/radio/radio-gemtek.c | 2 +- drivers/media/radio/radio-maestro.c | 2 +- drivers/media/radio/radio-maxiradio.c | 2 +- drivers/media/radio/radio-miropcm20.c | 2 +- drivers/media/radio/radio-mr800.c | 2 +- drivers/media/radio/radio-rtrack2.c | 2 +- drivers/media/radio/radio-sf16fmi.c | 2 +- drivers/media/radio/radio-sf16fmr2.c | 2 +- drivers/media/radio/radio-si4713.c | 2 +- drivers/media/radio/radio-tea5764.c | 2 +- drivers/media/radio/radio-terratec.c | 2 +- drivers/media/radio/radio-timb.c | 2 +- drivers/media/radio/radio-trust.c | 2 +- drivers/media/radio/radio-typhoon.c | 2 +- drivers/media/radio/radio-zoltrix.c | 2 +- drivers/media/radio/si470x/radio-si470x-common.c | 2 +- drivers/media/video/arv.c | 2 +- drivers/media/video/au0828/au0828-video.c | 14 ++++---- drivers/media/video/bt8xx/bttv-driver.c | 26 +++++++------- drivers/media/video/bw-qcam.c | 11 +++++- drivers/media/video/c-qcam.c | 11 +++++- drivers/media/video/cafe_ccic.c | 14 ++++---- drivers/media/video/cpia.c | 11 +++++- drivers/media/video/cpia2/cpia2_v4l.c | 11 +++++- drivers/media/video/cx18/cx18-streams.c | 12 +++--- drivers/media/video/cx231xx/cx231xx-video.c | 4 +- drivers/media/video/cx23885/cx23885-417.c | 2 +- drivers/media/video/cx23885/cx23885-video.c | 4 +- drivers/media/video/cx88/cx88-blackbird.c | 2 +- drivers/media/video/cx88/cx88-video.c | 4 +- drivers/media/video/davinci/vpfe_capture.c | 2 +- drivers/media/video/davinci/vpif_capture.c | 2 +- drivers/media/video/davinci/vpif_display.c | 2 +- drivers/media/video/em28xx/em28xx-video.c | 4 +- drivers/media/video/et61x251/et61x251_core.c | 27 +++++++++++---- drivers/media/video/gspca/gspca.c | 2 +- drivers/media/video/hdpvr/hdpvr-video.c | 2 +- drivers/media/video/meye.c | 2 +- drivers/media/video/omap24xxcam.c | 10 +++--- drivers/media/video/ov511.c | 15 +++++--- drivers/media/video/pms.c | 2 +- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 20 +++++++---- drivers/media/video/pwc/pwc-if.c | 19 ++++++---- drivers/media/video/s2255drv.c | 12 +++--- drivers/media/video/saa5246a.c | 11 ++++-- drivers/media/video/saa5249.c | 6 +++- drivers/media/video/saa7134/saa7134-empress.c | 14 ++++---- drivers/media/video/saa7134/saa7134-video.c | 26 +++++++------- drivers/media/video/se401.c | 20 +++++++---- drivers/media/video/sn9c102/sn9c102_core.c | 27 +++++++++++---- drivers/media/video/soc_camera.c | 2 +- drivers/media/video/stk-webcam.c | 14 ++++---- drivers/media/video/stradis.c | 26 +++++++++++---- drivers/media/video/stv680.c | 20 +++++++---- drivers/media/video/tlg2300/pd-radio.c | 8 ++-- drivers/media/video/tlg2300/pd-video.c | 2 +- drivers/media/video/usbvideo/usbvideo.c | 21 ++++++++---- drivers/media/video/usbvideo/vicam.c | 14 +++++++- drivers/media/video/usbvision/usbvision-video.c | 4 +- drivers/media/video/uvc/uvc_v4l2.c | 11 +++++- drivers/media/video/v4l2-dev.c | 38 ++------------------- drivers/media/video/v4l2-ioctl.c | 17 ++++++++- drivers/media/video/vivi.c | 2 +- drivers/media/video/w9966.c | 2 +- drivers/media/video/w9968cf.c | 25 +++++++++++--- drivers/media/video/zc0301/zc0301_core.c | 27 +++++++++++---- drivers/media/video/zoran/zoran_driver.c | 16 ++++---- drivers/media/video/zr364xx.c | 14 ++++---- drivers/staging/cx25821/cx25821-audups11.c | 18 ++++++---- drivers/staging/cx25821/cx25821-video0.c | 14 ++++---- drivers/staging/cx25821/cx25821-video1.c | 14 ++++---- drivers/staging/cx25821/cx25821-video2.c | 14 ++++---- drivers/staging/cx25821/cx25821-video3.c | 14 ++++---- drivers/staging/cx25821/cx25821-video4.c | 14 ++++---- drivers/staging/cx25821/cx25821-video5.c | 14 ++++---- drivers/staging/cx25821/cx25821-video6.c | 14 ++++---- drivers/staging/cx25821/cx25821-video7.c | 14 ++++---- drivers/staging/cx25821/cx25821-videoioctl.c | 27 +++++++++++---- drivers/staging/cx25821/cx25821-vidups10.c | 19 +++++++---- drivers/staging/cx25821/cx25821-vidups9.c | 18 ++++++---- drivers/staging/dream/camera/msm_v4l2.c | 27 +++++++++++---- drivers/staging/go7007/go7007-v4l2.c | 2 +- drivers/staging/tm6000/tm6000-video.c | 2 +- include/media/v4l2-dev.h | 1 - include/media/v4l2-ioctl.h | 2 + sound/i2c/other/tea575x-tuner.c | 2 +- 92 files changed, 530 insertions(+), 360 deletions(-)
Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
Hi Hans,
Quoted 37 lines · On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
Quoted 6 lines · On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
Hi,
Linus suggested to rename struct
v4l2_file_operations::ioctlintobkl_ioctlto eventually get something greppable and make its background explicit.Quoted 6 lines
While at it I thought it could be a good idea to just pushdown the bkl to every v4l drivers that have an .ioctl, so that we actually remove struct
v4l2_file_operations::ioctlfor good.It passed make allyesconfig on sparc.
Please tell me what you think.I much prefer to keep the bkl inside the v4l2 core. One reason is that I think that we can replace the bkl in the core with a mutex. Still not ideal of course, so the next step will be to implement proper locking in each driver. For this some additional v4l infrastructure work needs to be done. I couldn't proceed with that until the v4l events API patches went in, and that happened yesterday.
So from my point of view the timeline is this:
1) I do the infrastructure work this weekend. This will make it much easier to convert drivers to do proper locking. And it will also simplify
v4l2_priorityhandling, so I'm killing two birds with one stone :-)2) Wait until Arnd's patch gets merged that pushes the bkl down to
v4l2-dev.c3) Investigate what needs to be done to replace the bkl with a
v4l2-dev.cglobal mutex. Those drivers that call the bkl themselves should probably be converted to do proper locking, but there are only about 14 drivers that do this. The other 60 or so drivers should work fine if a v4l2-dev global lock is used. At this point the bkl is effectively removed from the v4l subsystem.
Quoted 6 lines
4) Work on the remaining 60 drivers to do proper locking and get rid of the v4l2-dev global lock. This is probably less work than it sounds.
Since your patch moves everything down to the driver level it will actually make this work harder rather than easier. And it touches almost all drivers as well.
Every driver will need to be carefully checked to make sure the BKL can be replaced by a v4l2-dev global mutex. Why would it be more difficult to do so if the BKL is pushed down to the drivers ?
Signature · 3 lines
Regards, Laurent Pinchart
Arnd Bergmann
maintainerRe: [PATCH 0/5] Pushdown bkl from v4l ioctls
Quoted 12 lines · On Thursday 29 April 2010 09:10:42 Laurent Pinchart wrote:
Quoted 11 lines · On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
3) Investigate what needs to be done to replace the bkl with a
v4l2-dev.cglobal mutex. Those drivers that call the bkl themselves should probably be converted to do proper locking, but there are only about 14 drivers that do this. The other 60 or so drivers should work fine if a v4l2-dev global lock is used. At this point the bkl is effectively removed from the v4l subsystem.4) Work on the remaining 60 drivers to do proper locking and get rid of the v4l2-dev global lock. This is probably less work than it sounds.
Quoted 7 lines
Quoted 3 lines
Since your patch moves everything down to the driver level it will actually make this work harder rather than easier. And it touches almost all drivers as well.
Every driver will need to be carefully checked to make sure the BKL can be replaced by a v4l2-dev global mutex. Why would it be more difficult to do so if the BKL is pushed down to the drivers ?
Note that you can completely skip the step of a v4l2-dev global mutex with Frederic's patch. This is the only use of the BKL in the common v4l2 code as far as I can tell, so instead of introducing yet another global lock, you can go straight to stage 4 and look at each driver separately, possibly introducing a per driver lock.
Arnd
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
In reply to Laurent PinchartQuoted 43 lines · On Thursday 29 April 2010 09:10:42 Laurent Pinchart wrote:
Hi Hans,
Quoted 40 lines · On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
Quoted 6 lines · On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
Hi,
Linus suggested to rename struct
v4l2_file_operations::ioctlintobkl_ioctlto eventually get something greppable and make its background explicit.Quoted 6 lines
While at it I thought it could be a good idea to just pushdown the bkl to every v4l drivers that have an .ioctl, so that we actually remove struct
v4l2_file_operations::ioctlfor good.It passed make allyesconfig on sparc.
Please tell me what you think.I much prefer to keep the bkl inside the v4l2 core. One reason is that I think that we can replace the bkl in the core with a mutex. Still not ideal of course, so the next step will be to implement proper locking in each driver. For this some additional v4l infrastructure work needs to be done. I couldn't proceed with that until the v4l events API patches went in, and that happened yesterday.
So from my point of view the timeline is this:
1) I do the infrastructure work this weekend. This will make it much easier to convert drivers to do proper locking. And it will also simplify
v4l2_priorityhandling, so I'm killing two birds with one stone :-)2) Wait until Arnd's patch gets merged that pushes the bkl down to
v4l2-dev.c3) Investigate what needs to be done to replace the bkl with a
v4l2-dev.cglobal mutex. Those drivers that call the bkl themselves should probably be converted to do proper locking, but there are only about 14 drivers that do this. The other 60 or so drivers should work fine if a v4l2-dev global lock is used. At this point the bkl is effectively removed from the v4l subsystem.4) Work on the remaining 60 drivers to do proper locking and get rid of the v4l2-dev global lock. This is probably less work than it sounds.
Quoted 7 lines
Quoted 3 lines
Since your patch moves everything down to the driver level it will actually make this work harder rather than easier. And it touches almost all drivers as well.
Every driver will need to be carefully checked to make sure the BKL can be replaced by a v4l2-dev global mutex. Why would it be more difficult to do so if the BKL is pushed down to the drivers ?
The main reason is really that pushing the bkl into the v4l core makes it easier to review. I noticed for example that this patch series forgot to change the video_ioctl2 call in ivtv-ioctl.c to video_ioctl2_unlocked. And there may be other places as well that were missed. Having so many drivers changed also means a lot of careful reviewing.
But I will not block this change. However, I do think it would be better to create a video_ioctl2_bkl rather than add a video_ioctl2_unlocked. The current video_ioctl2 function *is* already unlocked. So you are subtle changing the behavior of video_ioctl2. Not a good idea IMHO. And yes, grepping for video_ioctl2_bkl is also easy to do and makes it more obvious that the BKL is used in drivers that call this.
Regards,
Hans
Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
Arnd Bergmann
maintainerRe: [PATCH 0/5] Pushdown bkl from v4l ioctls
Quoted 6 lines · On Saturday 01 May 2010 11:55:37 Hans Verkuil wrote:
However, I do think it would be better to
create avideo_ioctl2_bklrather than add avideo_ioctl2_unlocked. The currentvideo_ioctl2function is already unlocked. So you are subtle changing the behavior ofvideo_ioctl2. Not a good idea IMHO. And yes, grepping forvideo_ioctl2_bklis also easy to do and makes it more obvious that the BKL is used in drivers that call this.
Yes, that makes sense. It also allows working towards a goal of 'removing video_ioctl2_bkl', which is easier to understand than 'converting video_ioctl2 users to video_ioctl2_unlocked and later renaming that'.
Arnd
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
In reply to Hans VerkuilQuoted 52 lines · Hans Verkuil
Quoted 43 lines · On Thursday 29 April 2010 09:10:42 Laurent Pinchart wrote:
Hi Hans,
Quoted 40 lines · On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
Quoted 6 lines · On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
Hi,
Linus suggested to rename struct
v4l2_file_operations::ioctlintobkl_ioctlto eventually get something greppable and make its background explicit.Quoted 6 lines
While at it I thought it could be a good idea to just pushdown the bkl to every v4l drivers that have an .ioctl, so that we actually remove struct
v4l2_file_operations::ioctlfor good.It passed make allyesconfig on sparc.
Please tell me what you think.I much prefer to keep the bkl inside the v4l2 core. One reason is that I think that we can replace the bkl in the core with a mutex. Still not ideal of course, so the next step will be to implement proper locking in each driver. For this some additional v4l infrastructure work needs to be done. I couldn't proceed with that until the v4l events API patches went in, and that happened yesterday.
So from my point of view the timeline is this:
1) I do the infrastructure work this weekend. This will make it much easier to convert drivers to do proper locking. And it will also simplify
v4l2_priorityhandling, so I'm killing two birds with one stone :-)2) Wait until Arnd's patch gets merged that pushes the bkl down to
v4l2-dev.c3) Investigate what needs to be done to replace the bkl with a
v4l2-dev.cglobal mutex. Those drivers that call the bkl themselves should probably be converted to do proper locking, but there are only about 14 drivers that do this. The other 60 or so drivers should work fine if a v4l2-dev global lock is used. At this point the bkl is effectively removed from the v4l subsystem.4) Work on the remaining 60 drivers to do proper locking and get rid of the v4l2-dev global lock. This is probably less work than it sounds.
Quoted 7 lines
Quoted 3 lines
Since your patch moves everything down to the driver level it will actually make this work harder rather than easier. And it touches almost all drivers as well.
Every driver will need to be carefully checked to make sure the BKL can be replaced by a v4l2-dev global mutex. Why would it be more difficult to do so if the BKL is pushed down to the drivers ?
Quoted 5 lines
The main reason is really that pushing the bkl into the v4l core makes it easier to review. I noticed for example that this patch series forgot to change the
video_ioctl2call inivtv-ioctl.ctovideo_ioctl2_unlocked. And there may be other places as well that were missed. Having so many drivers changed also means a lot of careful reviewing.
Indeed, that's because I did it in a half automated way and my script didn't took the direct calls to video_ioctl2() into account, so I had to check them manually and probably missed a few, I will fix this one and double check.
Quoted 7 lines
But I will not block this change. However, I do think it would be better to create a
video_ioctl2_bklrather than add avideo_ioctl2_unlocked. The currentvideo_ioctl2function *is* already unlocked. So you are subtle changing the behavior ofvideo_ioctl2. Not a good idea IMHO. And yes, grepping forvideo_ioctl2_bklis also easy to do and makes it more obvious that the BKL is used in drivers that call this.
Totally agreed, will respin with this rename.
Thanks.
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
In reply to Hans VerkuilQuoted 3 lines
I much prefer to keep the bkl inside the v4l2 core. One reason is that I think that we can replace the bkl in the core with a mutex. Still not ideal of course, so the next step will be to implement proper locking in
I did look at this a long time ago - it doesn't really work becaue the mutex you propose then has to be dropped and taken in the sleeping parts of each ioctl to avoid app problems and in some cases threaded apps deadlocking.
I think Arnd is right on his approach to this, having tried the other way.
PATCH 1/5 v4l: Pushdown bkl into video_ioctl2
In reply to Linus Torvaldsvideo_ioctl2 is a generic ioctl helper used by a lot of drivers. Most of them put it as their bkl'ed .ioctl callback, then let's pushdown the bkl inside but also provide an unlocked version for those that use it as an unlocked ioctl.
--- drivers/media/video/v4l2-ioctl.c | 17 +++++++++++++++-- include/media/v4l2-ioctl.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/media/video/v4l2-ioctl.c +15 -2
@@ -16,6 +16,7 @@#include <linux/slab.h> #include <linux/types.h> #include <linux/kernel.h> +#include <linux/smp_lock.h> #define __OLD_VIDIOC_/* To allow fixing old calls */ #include <linux/videodev.h>
@@ -2007,8 +2008,8 @@ static unsigned long cmd_input_size(unsigned int cmd) } } -long video_ioctl2 (struct file *file, -unsigned int cmd,unsigned long arg) +long video_ioctl2_unlocked (struct file *file, +unsigned int cmd,unsigned long arg) {char sbuf[128 ];void *mbuf =NULL ;
@@ -2102,4 +2103,16 @@ out:kfree (mbuf);return err; } +EXPORT_SYMBOL (video_ioctl2_unlocked); + +long video_ioctl2 (struct file *file,unsigned int cmd,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =video_ioctl2_unlocked (file, cmd, arg); +unlock_kernel (); + +return ret; +}EXPORT_SYMBOL (video_ioctl2);
include/media/v4l2-ioctl.h +2 -0
@@ -316,5 +316,7 @@ extern long video_usercopy(struct file *file, unsigned int cmd,/* Standard handlers for V4L ioctl's */ extern long video_ioctl2 (struct file *file,unsigned int cmd,unsigned long arg); +extern long video_ioctl2_unlocked (struct file *file, +unsigned int cmd,unsigned long arg);#endif /* _V4L2_IOCTL_H */
Signature · 1 line
1.6.2.3
PATCH 2/5 v4l: Use video_ioctl2_unlocked from drivers that don't want the bkl
In reply to Linus TorvaldsThere are three drivers that use video_ioctl2() as an unlocked_ioctl, let them use the new video_ioctl2_unlocked.
--- drivers/media/video/davinci/vpfe_capture.c | 2 +- drivers/media/video/gspca/gspca.c | 2 +- drivers/media/video/hdpvr/hdpvr-video.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/video/davinci/vpfe_capture.c +1 -1
@@ -786,7 +786,7 @@ static const struct v4l2_file_operations vpfe_fops = { .owner = THIS_MODULE, .open = vpfe_open, .release = vpfe_release, - .unlocked_ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2_unlocked, .mmap = vpfe_mmap, .poll = vpfe_poll };
drivers/media/video/gspca/gspca.c +1 -1
@@ -2184,7 +2184,7 @@ static struct v4l2_file_operations dev_fops = { .release = dev_close, .read = dev_read, .mmap = dev_mmap, - .unlocked_ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2_unlocked, .poll = dev_poll, };
drivers/media/video/hdpvr/hdpvr-video.c +1 -1
@@ -559,7 +559,7 @@ static const struct v4l2_file_operations hdpvr_fops = { .release = hdpvr_release, .read = hdpvr_read, .poll = hdpvr_poll, - .unlocked_ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2_unlocked, };/*=======================================================================*/
Signature · 1 line
1.6.2.3
PATCH 3/5 v4l: Change users of video_ioctl2 to use unlocked_ioctl
In reply to Linus TorvaldsNow that video_ioctl2() got the bkl pushed down, update its users to use .unlocked_ioctl instead of ioctl.
--- drivers/media/common/saa7146_fops.c | 2 +- drivers/media/radio/dsbr100.c | 2 +- drivers/media/radio/radio-aimslab.c | 2 +- drivers/media/radio/radio-aztech.c | 2 +- drivers/media/radio/radio-cadet.c | 2 +- drivers/media/radio/radio-gemtek-pci.c | 2 +- drivers/media/radio/radio-gemtek.c | 2 +- drivers/media/radio/radio-maestro.c | 2 +- drivers/media/radio/radio-maxiradio.c | 2 +- drivers/media/radio/radio-miropcm20.c | 2 +- drivers/media/radio/radio-mr800.c | 2 +- drivers/media/radio/radio-rtrack2.c | 2 +- drivers/media/radio/radio-sf16fmi.c | 2 +- drivers/media/radio/radio-sf16fmr2.c | 2 +- drivers/media/radio/radio-si4713.c | 2 +- drivers/media/radio/radio-tea5764.c | 2 +- drivers/media/radio/radio-terratec.c | 2 +- drivers/media/radio/radio-timb.c | 2 +- drivers/media/radio/radio-trust.c | 2 +- drivers/media/radio/radio-typhoon.c | 2 +- drivers/media/radio/radio-zoltrix.c | 2 +- drivers/media/radio/si470x/radio-si470x-common.c | 2 +- drivers/media/video/arv.c | 2 +- drivers/media/video/au0828/au0828-video.c | 14 ++++++------ drivers/media/video/bt8xx/bttv-driver.c | 26 +++++++++++----------- drivers/media/video/cafe_ccic.c | 14 ++++++------ drivers/media/video/cx18/cx18-streams.c | 12 +++++----- drivers/media/video/cx231xx/cx231xx-video.c | 4 +- drivers/media/video/cx23885/cx23885-417.c | 2 +- drivers/media/video/cx23885/cx23885-video.c | 4 +- drivers/media/video/cx88/cx88-blackbird.c | 2 +- drivers/media/video/cx88/cx88-video.c | 4 +- drivers/media/video/davinci/vpif_capture.c | 2 +- drivers/media/video/davinci/vpif_display.c | 2 +- drivers/media/video/em28xx/em28xx-video.c | 4 +- drivers/media/video/meye.c | 2 +- drivers/media/video/omap24xxcam.c | 10 ++++---- drivers/media/video/pms.c | 2 +- drivers/media/video/s2255drv.c | 12 +++++----- drivers/media/video/saa7134/saa7134-empress.c | 14 ++++++------ drivers/media/video/saa7134/saa7134-video.c | 26 +++++++++++----------- drivers/media/video/soc_camera.c | 2 +- drivers/media/video/stk-webcam.c | 14 ++++++------ drivers/media/video/tlg2300/pd-radio.c | 8 +++--- drivers/media/video/tlg2300/pd-video.c | 2 +- drivers/media/video/usbvision/usbvision-video.c | 4 +- drivers/media/video/w9966.c | 2 +- drivers/media/video/zoran/zoran_driver.c | 16 ++++++------ drivers/media/video/zr364xx.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video0.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video1.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video2.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video3.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video4.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video5.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video6.c | 14 ++++++------ drivers/staging/cx25821/cx25821-video7.c | 14 ++++++------ drivers/staging/go7007/go7007-v4l2.c | 2 +- drivers/staging/tm6000/tm6000-video.c | 2 +- sound/i2c/other/tea575x-tuner.c | 2 +- 60 files changed, 191 insertions(+), 191 deletions(-)
drivers/media/common/saa7146_fops.c +1 -1
@@ -396,7 +396,7 @@ static const struct v4l2_file_operations video_fops = .write = fops_write, .poll = fops_poll, .mmap = fops_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static void vv_callback (struct saa7146_dev *dev,unsigned long status)
drivers/media/radio/dsbr100.c +1 -1
@@ -605,7 +605,7 @@ static void usb_dsbr100_video_device_release(struct video_device *videodev)/* File system interface */ static const struct v4l2_file_operations usb_dsbr100_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
drivers/media/radio/radio-aimslab.c +1 -1
@@ -361,7 +361,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations rtrack_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
drivers/media/radio/radio-aztech.c +1 -1
@@ -324,7 +324,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,static const struct v4l2_file_operations aztech_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
drivers/media/radio/radio-cadet.c +1 -1
@@ -558,7 +558,7 @@ static const struct v4l2_file_operations cadet_fops = { .open = cadet_open, .release = cadet_release, .read = cadet_read, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .poll = cadet_poll, };
drivers/media/radio/radio-gemtek-pci.c +1 -1
@@ -361,7 +361,7 @@ MODULE_DEVICE_TABLE(pci, gemtek_pci_id);static const struct v4l2_file_operations gemtek_pci_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
drivers/media/radio/radio-gemtek.c +1 -1
@@ -378,7 +378,7 @@ static int gemtek_probe(struct gemtek *gt)static const struct v4l2_file_operations gemtek_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, }; static int vidioc_querycap(struct file *file, void *priv,
drivers/media/radio/radio-maestro.c +1 -1
@@ -299,7 +299,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations maestro_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops maestro_ioctl_ops = {
drivers/media/radio/radio-maxiradio.c +1 -1
@@ -346,7 +346,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,static const struct v4l2_file_operations maxiradio_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = {
drivers/media/radio/radio-miropcm20.c +1 -1
@@ -72,7 +72,7 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)static const struct v4l2_file_operations pcm20_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, }; static int vidioc_querycap(struct file *file, void *priv,
drivers/media/radio/radio-mr800.c +1 -1
@@ -613,7 +613,7 @@ static const struct v4l2_file_operations usb_amradio_fops = { .owner = THIS_MODULE, .open = usb_amradio_open, .release = usb_amradio_close, - .ioctl = usb_amradio_ioctl, + .unlocked_ioctl = usb_amradio_ioctl, };static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = {
drivers/media/radio/radio-rtrack2.c +1 -1
@@ -266,7 +266,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations rtrack2_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
drivers/media/radio/radio-sf16fmi.c +1 -1
@@ -260,7 +260,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations fmi_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
drivers/media/radio/radio-sf16fmr2.c +1 -1
@@ -376,7 +376,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations fmr2_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
drivers/media/radio/radio-si4713.c +1 -1
@@ -53,7 +53,7 @@ struct radio_si4713_device {/* radio_si4713_fops - file operations interface */ static const struct v4l2_file_operations radio_si4713_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };/* Video4Linux Interface */
drivers/media/radio/radio-tea5764.c +1 -1
@@ -492,7 +492,7 @@ static const struct v4l2_file_operations tea5764_fops = { .owner = THIS_MODULE, .open = tea5764_open, .release = tea5764_close, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops tea5764_ioctl_ops = {
drivers/media/radio/radio-terratec.c +1 -1
@@ -338,7 +338,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations terratec_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops terratec_ioctl_ops = {
drivers/media/radio/radio-timb.c +1 -1
@@ -142,7 +142,7 @@ static const struct v4l2_ioctl_ops timbradio_ioctl_ops = {static const struct v4l2_file_operations timbradio_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static int __devinit timbradio_probe (struct platform_device *pdev)
drivers/media/radio/radio-trust.c +1 -1
@@ -344,7 +344,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations trust_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops trust_ioctl_ops = {
drivers/media/radio/radio-typhoon.c +1 -1
@@ -320,7 +320,7 @@ static int vidioc_log_status(struct file *file, void *priv)static const struct v4l2_file_operations typhoon_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops typhoon_ioctl_ops = {
drivers/media/radio/radio-zoltrix.c +1 -1
@@ -377,7 +377,7 @@ static int vidioc_s_audio(struct file *file, void *priv,static const struct v4l2_file_operations zoltrix_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = {
drivers/media/radio/si470x/radio-si470x-common.c +1 -1
@@ -516,7 +516,7 @@ static const struct v4l2_file_operations si470x_fops = { .owner = THIS_MODULE, .read = si470x_fops_read, .poll = si470x_fops_poll, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .open = si470x_fops_open, .release = si470x_fops_release, };
drivers/media/video/arv.c +1 -1
@@ -712,7 +712,7 @@ static int ar_initialize(struct ar *ar)static const struct v4l2_file_operations ar_fops = { .owner =THIS_MODULE , .read = ar_read, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops ar_ioctl_ops = {
drivers/media/video/au0828/au0828-video.c +7 -7
@@ -1512,13 +1512,13 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)#endif static struct v4l2_file_operations au0828_v4l_fops = { - .owner =THIS_MODULE , - .open = au0828_v4l2_open, - .release = au0828_v4l2_close, - .read = au0828_v4l2_read, - .poll = au0828_v4l2_poll, - .mmap = au0828_v4l2_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = au0828_v4l2_open, + .release = au0828_v4l2_close, + .read = au0828_v4l2_read, + .poll = au0828_v4l2_poll, + .mmap = au0828_v4l2_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/media/video/bt8xx/bttv-driver.c +13 -13
@@ -3338,13 +3338,13 @@ bttv_mmap(struct file *file, struct vm_area_struct *vma)static const struct v4l2_file_operations bttv_fops = { - .owner =THIS_MODULE , - .open = bttv_open, - .release = bttv_release, - .ioctl = video_ioctl2, - .read = bttv_read, - .mmap = bttv_mmap, - .poll = bttv_poll, + .owner =THIS_MODULE , + .open = bttv_open, + .release = bttv_release, + .unlocked_ioctl = video_ioctl2, + .read = bttv_read, + .mmap = bttv_mmap, + .poll = bttv_poll, };static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
@@ -3611,12 +3611,12 @@ static unsigned int radio_poll(struct file *file, poll_table *wait)static const struct v4l2_file_operations radio_fops = { - .owner =THIS_MODULE , - .open = radio_open, - .read = radio_read, - .release = radio_release, - .ioctl = video_ioctl2, - .poll = radio_poll, + .owner =THIS_MODULE , + .open = radio_open, + .read = radio_read, + .release = radio_release, + .unlocked_ioctl = video_ioctl2, + .poll = radio_poll, };static const struct v4l2_ioctl_ops radio_ioctl_ops = {
drivers/media/video/cafe_ccic.c +7 -7
@@ -1685,13 +1685,13 @@ static int cafe_vidioc_s_register(struct file *file, void *priv,*/ static const struct v4l2_file_operations cafe_v4l_fops = { - .owner =THIS_MODULE , - .open = cafe_v4l_open, - .release = cafe_v4l_release, - .read = cafe_v4l_read, - .poll = cafe_v4l_poll, - .mmap = cafe_v4l_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = cafe_v4l_open, + .release = cafe_v4l_release, + .read = cafe_v4l_read, + .poll = cafe_v4l_poll, + .mmap = cafe_v4l_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
drivers/media/video/cx18/cx18-streams.c +6 -6
@@ -37,13 +37,13 @@#define CX18_DSP0_INTERRUPT_MASK 0xd0004Cstatic struct v4l2_file_operations cx18_v4l2_enc_fops = { - .owner =THIS_MODULE , - .read = cx18_v4l2_read, - .open = cx18_v4l2_open, + .owner =THIS_MODULE , + .read = cx18_v4l2_read, + .open = cx18_v4l2_open,/* FIXME change to video_ioctl2 if serialization lock can be removed */ - .ioctl = cx18_v4l2_ioctl, - .release = cx18_v4l2_close, - .poll = cx18_v4l2_enc_poll, + .unlocked_ioctl = cx18_v4l2_ioctl, + .release = cx18_v4l2_close, + .poll = cx18_v4l2_enc_poll, };/* offset from 0 to register ts v4l2 minors on */
drivers/media/video/cx231xx/cx231xx-video.c +2 -2
@@ -2231,7 +2231,7 @@ static const struct v4l2_file_operations cx231xx_v4l_fops = { .read = cx231xx_v4l2_read, .poll = cx231xx_v4l2_poll, .mmap = cx231xx_v4l2_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -2289,7 +2289,7 @@ static const struct v4l2_file_operations radio_fops = { .owner = THIS_MODULE, .open = cx231xx_v4l2_open, .release = cx231xx_v4l2_close, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops radio_ioctl_ops = {
drivers/media/video/cx23885/cx23885-417.c +1 -1
@@ -1681,7 +1681,7 @@ static struct v4l2_file_operations mpeg_fops = { .read = mpeg_read, .poll = mpeg_poll, .mmap = mpeg_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
drivers/media/video/cx23885/cx23885-video.c +2 -2
@@ -1387,7 +1387,7 @@ static const struct v4l2_file_operations video_fops = { .read = video_read, .poll = video_poll, .mmap = video_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1439,7 +1439,7 @@ static const struct v4l2_file_operations radio_fops = { .owner = THIS_MODULE, .open = video_open, .release = video_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };
drivers/media/video/cx88/cx88-blackbird.c +1 -1
@@ -1174,7 +1174,7 @@ static const struct v4l2_file_operations mpeg_fops = .read = mpeg_read, .poll = mpeg_poll, .mmap = mpeg_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
drivers/media/video/cx88/cx88-video.c +2 -2
@@ -1683,7 +1683,7 @@ static const struct v4l2_file_operations video_fops = .read = video_read, .poll = video_poll, .mmap = video_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1736,7 +1736,7 @@ static const struct v4l2_file_operations radio_fops = .owner = THIS_MODULE, .open = video_open, .release = video_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops radio_ioctl_ops = {
drivers/media/video/davinci/vpif_capture.c +1 -1
@@ -1836,7 +1836,7 @@ static struct v4l2_file_operations vpif_fops = { .owner = THIS_MODULE, .open = vpif_open, .release = vpif_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .mmap = vpif_mmap, .poll = vpif_poll };
drivers/media/video/davinci/vpif_display.c +1 -1
@@ -1340,7 +1340,7 @@ static const struct v4l2_file_operations vpif_fops = { .owner = THIS_MODULE, .open = vpif_open, .release = vpif_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .mmap = vpif_mmap, .poll = vpif_poll };
drivers/media/video/em28xx/em28xx-video.c +2 -2
@@ -2387,7 +2387,7 @@ static const struct v4l2_file_operations em28xx_v4l_fops = { .read = em28xx_v4l2_read, .poll = em28xx_v4l2_poll, .mmap = em28xx_v4l2_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -2449,7 +2449,7 @@ static const struct v4l2_file_operations radio_fops = { .owner = THIS_MODULE, .open = em28xx_v4l2_open, .release = em28xx_v4l2_close, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops radio_ioctl_ops = {
drivers/media/video/meye.c +1 -1
@@ -1659,7 +1659,7 @@ static const struct v4l2_file_operations meye_fops = { .open = meye_open, .release = meye_release, .mmap = meye_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .poll = meye_poll, };
drivers/media/video/omap24xxcam.c +5 -5
@@ -1554,11 +1554,11 @@ static int omap24xxcam_release(struct file *file) }static struct v4l2_file_operations omap24xxcam_fops = { - .ioctl = video_ioctl2, - .poll = omap24xxcam_poll, - .mmap = omap24xxcam_mmap, - .open = omap24xxcam_open, - .release = omap24xxcam_release, + .unlocked_ioctl = video_ioctl2, + .poll = omap24xxcam_poll, + .mmap = omap24xxcam_mmap, + .open = omap24xxcam_open, + .release = omap24xxcam_release, };/*
drivers/media/video/pms.c +1 -1
@@ -932,7 +932,7 @@ static ssize_t pms_read(struct file *file, char __user *buf,static const struct v4l2_file_operations pms_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .read = pms_read, };
drivers/media/video/s2255drv.c +6 -6
@@ -1890,12 +1890,12 @@ static int s2255_mmap_v4l(struct file *file, struct vm_area_struct *vma) }static const struct v4l2_file_operations s2255_fops_v4l = { - .owner =THIS_MODULE , - .open = s2255_open, - .release = s2255_release, - .poll = s2255_poll, - .ioctl = video_ioctl2,/* V4L2 ioctl handler */ - .mmap = s2255_mmap_v4l, + .owner =THIS_MODULE , + .open = s2255_open, + .release = s2255_release, + .poll = s2255_poll, + .unlocked_ioctl = video_ioctl2,/* V4L2 ioctl handler */ + .mmap = s2255_mmap_v4l, };static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
drivers/media/video/saa7134/saa7134-empress.c +7 -7
@@ -438,13 +438,13 @@ static int empress_g_std(struct file *file, void *priv, v4l2_std_id *id)static const struct v4l2_file_operations ts_fops = { - .owner =THIS_MODULE , - .open = ts_open, - .release = ts_release, - .read = ts_read, - .poll = ts_poll, - .mmap = ts_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = ts_open, + .release = ts_release, + .read = ts_read, + .poll = ts_poll, + .mmap = ts_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops ts_ioctl_ops = {
drivers/media/video/saa7134/saa7134-video.c +13 -13
@@ -2409,13 +2409,13 @@ static int radio_queryctrl(struct file *file, void *priv,static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -2470,12 +2470,12 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { };static const struct v4l2_file_operations radio_fops = { - .owner =THIS_MODULE , - .open = video_open, - .read = radio_read, - .release = video_release, - .ioctl = video_ioctl2, - .poll = radio_poll, + .owner =THIS_MODULE , + .open = video_open, + .read = radio_read, + .release = video_release, + .unlocked_ioctl = video_ioctl2, + .poll = radio_poll, };static const struct v4l2_ioctl_ops radio_ioctl_ops = {
drivers/media/video/soc_camera.c +1 -1
@@ -513,7 +513,7 @@ static struct v4l2_file_operations soc_camera_fops = { .owner = THIS_MODULE, .open = soc_camera_open, .release = soc_camera_close, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .read = soc_camera_read, .mmap = soc_camera_mmap, .poll = soc_camera_poll,
drivers/media/video/stk-webcam.c +7 -7
@@ -1263,13 +1263,13 @@ static int stk_vidioc_enum_framesizes(struct file *filp, }static struct v4l2_file_operations v4l_stk_fops = { - .owner =THIS_MODULE , - .open = v4l_stk_open, - .release = v4l_stk_release, - .read = v4l_stk_read, - .poll = v4l_stk_poll, - .mmap = v4l_stk_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = v4l_stk_open, + .release = v4l_stk_release, + .read = v4l_stk_read, + .poll = v4l_stk_poll, + .mmap = v4l_stk_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
drivers/media/video/tlg2300/pd-radio.c +4 -4
@@ -155,10 +155,10 @@ static int vidioc_querycap(struct file *file, void *priv, }static const struct v4l2_file_operations poseidon_fm_fops = { - .owner =THIS_MODULE , - .open = poseidon_fm_open, - .release = poseidon_fm_close, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = poseidon_fm_open, + .release = poseidon_fm_close, + .unlocked_ioctl = video_ioctl2, }; static int tlg_fm_vidioc_g_tuner(struct file *file, void *priv,
drivers/media/video/tlg2300/pd-video.c +1 -1
@@ -1542,7 +1542,7 @@ static const struct v4l2_file_operations pd_video_fops = { .read = pd_video_read, .poll = pd_video_poll, .mmap = pd_video_mmap, - .ioctl = video_ioctl2, /* maybe changed in future */ + .unlocked_ioctl = video_ioctl2, /* maybe changed in future */ };static const struct v4l2_ioctl_ops pd_video_ioctl_ops = {
drivers/media/video/usbvision/usbvision-video.c +2 -2
@@ -1251,7 +1251,7 @@ static const struct v4l2_file_operations usbvision_fops = { .release = usbvision_v4l2_close, .read = usbvision_v4l2_read, .mmap = usbvision_v4l2_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2,/* .poll = video_poll, */ };
@@ -1304,7 +1304,7 @@ static const struct v4l2_file_operations usbvision_radio_fops = { .owner = THIS_MODULE, .open = usbvision_radio_open, .release = usbvision_radio_close, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = {
drivers/media/video/w9966.c +1 -1
@@ -815,7 +815,7 @@ out:static const struct v4l2_file_operations w9966_fops = { .owner =THIS_MODULE , - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .read = w9966_v4l_read, };
drivers/media/video/zoran/zoran_driver.c +8 -8
@@ -3371,14 +3371,14 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { };static const struct v4l2_file_operations zoran_fops = { - .owner =THIS_MODULE , - .open = zoran_open, - .release = zoran_close, - .ioctl = video_ioctl2, - .read = zoran_read, - .write = zoran_write, - .mmap = zoran_mmap, - .poll = zoran_poll, + .owner =THIS_MODULE , + .open = zoran_open, + .release = zoran_close, + .unlocked_ioctl = video_ioctl2, + .read = zoran_read, + .write = zoran_write, + .mmap = zoran_mmap, + .poll = zoran_poll, };struct video_device zoran_template__devinitdata = {
drivers/media/video/zr364xx.c +7 -7
@@ -1438,13 +1438,13 @@ static unsigned int zr364xx_poll(struct file *file, }static const struct v4l2_file_operations zr364xx_fops = { - .owner =THIS_MODULE , - .open = zr364xx_open, - .release = zr364xx_release, - .read = zr364xx_read, - .mmap = zr364xx_mmap, - .ioctl = video_ioctl2, - .poll = zr364xx_poll, + .owner =THIS_MODULE , + .open = zr364xx_open, + .release = zr364xx_release, + .read = zr364xx_read, + .mmap = zr364xx_mmap, + .unlocked_ioctl = video_ioctl2, + .poll = zr364xx_poll, };static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = {
drivers/staging/cx25821/cx25821-video0.c +7 -7
@@ -373,13 +373,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video1.c +7 -7
@@ -373,13 +373,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,//exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video2.c +7 -7
@@ -375,13 +375,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video3.c +7 -7
@@ -374,13 +374,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video4.c +7 -7
@@ -373,13 +373,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video5.c +7 -7
@@ -373,13 +373,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video6.c +7 -7
@@ -373,13 +373,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-video7.c +7 -7
@@ -372,13 +372,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl2, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/go7007/go7007-v4l2.c +1 -1
@@ -1743,7 +1743,7 @@ static struct v4l2_file_operations go7007_fops = { .owner = THIS_MODULE, .open = go7007_open, .release = go7007_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, .read = go7007_read, .mmap = go7007_mmap, .poll = go7007_poll,
drivers/staging/tm6000/tm6000-video.c +1 -1
@@ -1455,7 +1455,7 @@ static struct v4l2_file_operations tm6000_fops = { .owner = THIS_MODULE, .open = tm6000_open, .release = tm6000_release, - .ioctl = video_ioctl2, /* V4L2 ioctl handler */ + .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ .read = tm6000_read, .poll = tm6000_poll, .mmap = tm6000_mmap,
sound/i2c/other/tea575x-tuner.c +1 -1
@@ -265,7 +265,7 @@ static const struct v4l2_file_operations tea575x_fops = { .owner = THIS_MODULE, .open = snd_tea575x_exclusive_open, .release = snd_tea575x_exclusive_release, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, };static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
Signature · 1 line
1.6.2.3
PATCH 4/5 v4l: Pushdown bkl to drivers that implement their own ioctl
In reply to Linus TorvaldsThese are the last remaining v4l drivers that implement the ioctl callback.
--- drivers/media/video/bw-qcam.c | 11 ++++++++- drivers/media/video/c-qcam.c | 11 ++++++++- drivers/media/video/cpia.c | 11 ++++++++- drivers/media/video/cpia2/cpia2_v4l.c | 11 ++++++++- drivers/media/video/et61x251/et61x251_core.c | 27 +++++++++++++++++++------ drivers/media/video/ov511.c | 15 ++++++++----- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 20 ++++++++++++------ drivers/media/video/pwc/pwc-if.c | 19 ++++++++++------- drivers/media/video/saa5246a.c | 11 ++++++--- drivers/media/video/saa5249.c | 6 ++++- drivers/media/video/se401.c | 20 ++++++++++++------ drivers/media/video/sn9c102/sn9c102_core.c | 27 +++++++++++++++++++------ drivers/media/video/stradis.c | 26 ++++++++++++++++++------ drivers/media/video/stv680.c | 20 ++++++++++++------ drivers/media/video/usbvideo/usbvideo.c | 21 +++++++++++++------ drivers/media/video/usbvideo/vicam.c | 14 ++++++++++++- drivers/media/video/uvc/uvc_v4l2.c | 11 ++++++++- drivers/media/video/vivi.c | 2 +- drivers/media/video/w9968cf.c | 25 ++++++++++++++++++----- drivers/media/video/zc0301/zc0301_core.c | 27 +++++++++++++++++++------ drivers/staging/cx25821/cx25821-audups11.c | 18 ++++++++++------ drivers/staging/cx25821/cx25821-videoioctl.c | 27 +++++++++++++++++++------ drivers/staging/cx25821/cx25821-vidups10.c | 19 +++++++++++------ drivers/staging/cx25821/cx25821-vidups9.c | 18 ++++++++++------ drivers/staging/dream/camera/msm_v4l2.c | 27 ++++++++++++++++++------- 25 files changed, 315 insertions(+), 129 deletions(-)
drivers/media/video/bw-qcam.c +9 -2
@@ -76,6 +76,7 @@ OTHER DEALINGS IN THE SOFTWARE.#include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <linux/mutex.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include "bw-qcam.h"
@@ -831,7 +832,13 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long qcam_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, qcam_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, qcam_do_ioctl); +unlock_kernel (); + +return ret; } static ssize_t qcam_read(struct file *file, char __user *buf,
@@ -879,7 +886,7 @@ static const struct v4l2_file_operations qcam_fops = { .owner = THIS_MODULE, .open = qcam_exclusive_open, .release = qcam_exclusive_release, - .ioctl = qcam_ioctl, + .unlocked_ioctl = qcam_ioctl, .read = qcam_read, };static struct video_device qcam_template = {
drivers/media/video/c-qcam.c +9 -2
@@ -38,6 +38,7 @@#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #include <linux/jiffies.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h>
@@ -663,7 +664,13 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long qcam_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, qcam_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, qcam_do_ioctl); +unlock_kernel (); + +return ret; } static ssize_t qcam_read(struct file *file, char __user *buf,
@@ -704,7 +711,7 @@ static const struct v4l2_file_operations qcam_fops = { .owner = THIS_MODULE, .open = qcam_exclusive_open, .release = qcam_exclusive_release, - .ioctl = qcam_ioctl, + .unlocked_ioctl = qcam_ioctl, .read = qcam_read, };
drivers/media/video/cpia.c +9 -2
@@ -38,6 +38,7 @@#include <linux/ctype.h> #include <linux/pagemap.h> #include <linux/delay.h> +#include <linux/smp_lock.h> #include <asm/io.h> #include <linux/mutex.h>
@@ -3715,7 +3716,13 @@ static long cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long cpia_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, cpia_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, cpia_do_ioctl); +unlock_kernel (); + +return ret; }
@@ -3775,7 +3782,7 @@ static const struct v4l2_file_operations cpia_fops = { .release = cpia_close, .read = cpia_read, .mmap = cpia_mmap, - .ioctl = cpia_ioctl, + .unlocked_ioctl = cpia_ioctl, };static struct video_device cpia_template = {
drivers/media/video/cpia2/cpia2_v4l.c +9 -2
@@ -39,6 +39,7 @@#include <linux/init.h> #include <linux/videodev.h> #include <linux/stringify.h> +#include <linux/smp_lock.h> #include <media/v4l2-ioctl.h> #include "cpia2.h"
@@ -1840,7 +1841,13 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long cpia2_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, cpia2_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, cpia2_do_ioctl); +unlock_kernel (); + +return ret; }/******************************************************************************
@@ -1914,7 +1921,7 @@ static const struct v4l2_file_operations fops_template = { .release = cpia2_close, .read = cpia2_v4l_read, .poll = cpia2_v4l_poll, - .ioctl = cpia2_ioctl, + .unlocked_ioctl = cpia2_ioctl, .mmap = cpia2_mmap, };
drivers/media/video/et61x251/et61x251_core.c +20 -7
@@ -34,6 +34,7 @@#include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/page-flags.h> +#include <linux/smp_lock.h> #include <media/v4l2-ioctl.h> #include <asm/byteorder.h> #include <asm/page.h>
@@ -2525,15 +2526,27 @@ static long et61x251_ioctl(struct file *filp,return err; } +static long +et61x251_locked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =et61x251_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static const struct v4l2_file_operations et61x251_fops = { - .owner =THIS_MODULE , - .open = et61x251_open, - .release = et61x251_release, - .ioctl = et61x251_ioctl, - .read = et61x251_read, - .poll = et61x251_poll, - .mmap = et61x251_mmap, + .owner =THIS_MODULE , + .open = et61x251_open, + .release = et61x251_release, + .unlocked_ioctl = et61x251_locked_ioctl, + .read = et61x251_read, + .poll = et61x251_poll, + .mmap = et61x251_mmap, };/*****************************************************************************/
drivers/media/video/ov511.c +9 -6
@@ -44,6 +44,7 @@#include <asm/processor.h> #include <linux/mm.h> #include <linux/device.h> +#include <linux/smp_lock.h> #if defined (__i386__)#include <asm/cpufeature.h>
@@ -4460,7 +4461,9 @@ ov51x_v4l1_ioctl(struct file *file,if (mutex_lock_interruptible (&ov->lock))return -EINTR ; +lock_kernel (); rc =video_usercopy (file, cmd, arg, ov51x_v4l1_ioctl_internal); +unlock_kernel ();mutex_unlock (&ov->lock);return rc;
@@ -4662,12 +4665,12 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma) }static const struct v4l2_file_operations ov511_fops = { - .owner =THIS_MODULE , - .open = ov51x_v4l1_open, - .release = ov51x_v4l1_close, - .read = ov51x_v4l1_read, - .mmap = ov51x_v4l1_mmap, - .ioctl = ov51x_v4l1_ioctl, + .owner =THIS_MODULE , + .open = ov51x_v4l1_open, + .release = ov51x_v4l1_close, + .read = ov51x_v4l1_read, + .mmap = ov51x_v4l1_mmap, + .unlocked_ioctl = ov51x_v4l1_ioctl, };static struct video_device vdev_template = {
drivers/media/video/pvrusb2/pvrusb2-v4l2.c +13 -7
@@ -22,6 +22,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/version.h> +#include <linux/smp_lock.h> #include "pvrusb2-context.h" #include "pvrusb2-hdw.h" #include "pvrusb2.h"
@@ -950,8 +951,13 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)static long pvr2_v4l2_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +long ret; -return video_usercopy (file, cmd, arg, pvr2_v4l2_do_ioctl); +lock_kernel (); + ret =video_usercopy (file, cmd, arg, pvr2_v4l2_do_ioctl); +unlock_kernel (); + +return ret; }
@@ -1231,12 +1237,12 @@ static unsigned int pvr2_v4l2_poll(struct file *file, poll_table *wait)static const struct v4l2_file_operations vdev_fops = { - .owner =THIS_MODULE , - .open = pvr2_v4l2_open, - .release = pvr2_v4l2_release, - .read = pvr2_v4l2_read, - .ioctl = pvr2_v4l2_ioctl, - .poll = pvr2_v4l2_poll, + .owner =THIS_MODULE , + .open = pvr2_v4l2_open, + .release = pvr2_v4l2_release, + .read = pvr2_v4l2_read, + .unlocked_ioctl = pvr2_v4l2_ioctl, + .poll = pvr2_v4l2_poll, };
drivers/media/video/pwc/pwc-if.c +11 -8
@@ -157,13 +157,13 @@ static long pwc_video_ioctl(struct file *file,static int pwc_video_mmap (struct file *file,struct vm_area_struct *vma);static const struct v4l2_file_operations pwc_fops = { - .owner =THIS_MODULE , - .open = pwc_video_open, - .release = pwc_video_close, - .read = pwc_video_read, - .poll = pwc_video_poll, - .mmap = pwc_video_mmap, - .ioctl = pwc_video_ioctl, + .owner =THIS_MODULE , + .open = pwc_video_open, + .release = pwc_video_close, + .read = pwc_video_read, + .poll = pwc_video_poll, + .mmap = pwc_video_mmap, + .unlocked_ioctl = pwc_video_ioctl, };static struct video_device pwc_template = { .name ="Philips Webcam" ,/* Filled in later */
@@ -1424,8 +1424,11 @@ static long pwc_video_ioctl(struct file *file, pdev =video_get_drvdata (vdev);mutex_lock (&pdev->modlock); -if (!pdev->unplugged) +if (!pdev->unplugged) { +lock_kernel (); r =video_usercopy (file, cmd, arg, pwc_video_do_ioctl); +unlock_kernel (); + }mutex_unlock (&pdev->modlock); out:return r;
drivers/media/video/saa5246a.c +7 -4
@@ -47,6 +47,7 @@#include <linux/mutex.h> #include <linux/videotext.h> #include <linux/videodev2.h> +#include <linux/smp_lock.h> #include <media/v4l2-device.h> #include <media/v4l2-chip-ident.h> #include <media/v4l2-ioctl.h>
@@ -962,7 +963,9 @@ static long saa5246a_ioctl(struct file *file, cmd =vtx_fix_command (cmd);mutex_lock (&t->lock); +lock_kernel (); err =video_usercopy (file, cmd, arg, do_saa5246a_ioctl); +lock_kernel ();mutex_unlock (&t->lock);return err; }
@@ -1026,10 +1029,10 @@ static int saa5246a_release(struct file *file) }static const struct v4l2_file_operations saa_fops = { - .owner =THIS_MODULE , - .open = saa5246a_open, - .release = saa5246a_release, - .ioctl = saa5246a_ioctl, + .owner =THIS_MODULE , + .open = saa5246a_open, + .release = saa5246a_release, + .unlocked_ioctl = saa5246a_ioctl, }; static struct video_device saa_template =
drivers/media/video/saa5249.c +5 -1
@@ -51,6 +51,7 @@#include <linux/videotext.h> #include <linux/videodev2.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <media/v4l2-device.h> #include <media/v4l2-chip-ident.h> #include <media/v4l2-ioctl.h>
@@ -498,8 +499,11 @@ static long saa5249_ioctl(struct file *file, cmd =vtx_fix_command (cmd);mutex_lock (&t->lock); +lock_kernel (); err =video_usercopy (file, cmd, arg, do_saa5249_ioctl); +unlock_kernel ();mutex_unlock (&t->lock); +return err; }
@@ -551,7 +555,7 @@ static const struct v4l2_file_operations saa_fops = { .owner = THIS_MODULE, .open = saa5249_open, .release = saa5249_release, - .ioctl = saa5249_ioctl, + .unlocked_ioctl = saa5249_ioctl, }; static struct video_device saa_template =
drivers/media/video/se401.c +13 -7
@@ -1154,7 +1154,13 @@ static long se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long se401_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, se401_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, se401_do_ioctl); +unlock_kernel (); + +return ret; } static ssize_t se401_read(struct file *file, char __user *buf,
@@ -1237,12 +1243,12 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma) }static const struct v4l2_file_operations se401_fops = { - .owner =THIS_MODULE , - .open = se401_open, - .release = se401_close, - .read = se401_read, - .mmap = se401_mmap, - .ioctl = se401_ioctl, + .owner =THIS_MODULE , + .open = se401_open, + .release = se401_close, + .read = se401_read, + .mmap = se401_mmap, + .unlocked_ioctl = se401_ioctl, };static struct video_device se401_template = { .name ="se401 USB camera" ,
drivers/media/video/sn9c102/sn9c102_core.c +20 -7
@@ -34,6 +34,7 @@#include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/page-flags.h> +#include <linux/smp_lock.h> #include <asm/byteorder.h> #include <asm/page.h> #include <asm/uaccess.h>
@@ -3232,16 +3233,28 @@ static long sn9c102_ioctl(struct file *filp,return err; } +static long +sn9c102_locked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =sn9c102_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +/*****************************************************************************/ static const struct v4l2_file_operations sn9c102_fops = { - .owner =THIS_MODULE , - .open = sn9c102_open, - .release = sn9c102_release, - .ioctl = sn9c102_ioctl, - .read = sn9c102_read, - .poll = sn9c102_poll, - .mmap = sn9c102_mmap, + .owner =THIS_MODULE , + .open = sn9c102_open, + .release = sn9c102_release, + .unlocked_ioctl = sn9c102_locked_ioctl, + .read = sn9c102_read, + .poll = sn9c102_poll, + .mmap = sn9c102_mmap, };/*****************************************************************************/
drivers/media/video/stradis.c +19 -7
@@ -1739,6 +1739,18 @@ static long saa_ioctl(struct file *file,return 0 ; } +static long saa_locked_ioctl (struct file *file, +unsigned int cmd,unsigned long argl) +{ +long ret; + +lock_kernel (); + ret =saa_ioctl (file, cmd, argl); +unlock_kernel (); + +return ret; +} +static int saa_mmap (struct file *file,struct vm_area_struct *vma) {struct saa7146 *saa = file->private_data;
@@ -1908,13 +1920,13 @@ static int saa_release(struct file *file) }static const struct v4l2_file_operations saa_fops = { - .owner =THIS_MODULE , - .open = saa_open, - .release = saa_release, - .ioctl = saa_ioctl, - .read = saa_read, - .write = saa_write, - .mmap = saa_mmap, + .owner =THIS_MODULE , + .open = saa_open, + .release = saa_release, + .unlocked_ioctl = saa_locked_ioctl, + .read = saa_read, + .write = saa_write, + .mmap = saa_mmap, };/* template for video_device-structure */
drivers/media/video/stv680.c +13 -7
@@ -1304,7 +1304,13 @@ static long stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long stv680_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, stv680_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, stv680_do_ioctl); +unlock_kernel (); + +return ret; }static int stv680_mmap (struct file *file,struct vm_area_struct *vma)
@@ -1394,12 +1400,12 @@ static ssize_t stv680_read (struct file *file, char __user *buf, }/* stv680_read */ static const struct v4l2_file_operations stv680_fops = { - .owner =THIS_MODULE , - .open = stv_open, - .release = stv_close, - .read = stv680_read, - .mmap = stv680_mmap, - .ioctl = stv680_ioctl, + .owner =THIS_MODULE , + .open = stv_open, + .release = stv_close, + .read = stv680_read, + .mmap = stv680_mmap, + .unlocked_ioctl = stv680_ioctl, };static struct video_device stv680_template = { .name ="STV0680 USB camera" ,
drivers/media/video/usbvideo/usbvideo.c +14 -7
@@ -23,6 +23,7 @@#include <linux/vmalloc.h> #include <linux/init.h> #include <linux/spinlock.h> +#include <linux/smp_lock.h> #include <asm/io.h>
@@ -943,12 +944,12 @@ static int usbvideo_find_struct(struct usbvideo *cams) }static const struct v4l2_file_operations usbvideo_fops = { - .owner =THIS_MODULE , - .open = usbvideo_v4l_open, - .release =usbvideo_v4l_close, - .read = usbvideo_v4l_read, - .mmap = usbvideo_v4l_mmap, - .ioctl = usbvideo_v4l_ioctl, + .owner =THIS_MODULE , + .open = usbvideo_v4l_open, + .release = usbvideo_v4l_close, + .read = usbvideo_v4l_read, + .mmap = usbvideo_v4l_mmap, + .unlocked_ioctl = usbvideo_v4l_ioctl, };static const struct video_device usbvideo_template = { .fops = &usbvideo_fops,
@@ -1500,7 +1501,13 @@ static long usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *argstatic long usbvideo_v4l_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { -return video_usercopy (file, cmd, arg, usbvideo_v4l_do_ioctl); +long ret; + +lock_kernel (); + ret =video_usercopy (file, cmd, arg, usbvideo_v4l_do_ioctl); +unlock_kernel (); + +return ret; }/*
drivers/media/video/usbvideo/vicam.c +13 -1
@@ -470,6 +470,18 @@ vicam_ioctl(struct file *file, unsigned int ioctlnr, unsigned long arg)return retval; } +static long +vicam_locked_ioctl (struct file *file,unsigned int ioctlnr,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =vicam_ioctl (file, ioctlnr, arg); +unlock_kernel (); + +return ret; +} +static int vicam_open (struct file *file) {
@@ -790,7 +802,7 @@ static const struct v4l2_file_operations vicam_fops = { .release = vicam_close, .read = vicam_read, .mmap = vicam_mmap, - .ioctl = vicam_ioctl, + .unlocked_ioctl = vicam_locked_ioctl, };static struct video_device vicam_template = {
drivers/media/video/uvc/uvc_v4l2.c +9 -2
@@ -21,6 +21,7 @@#include <linux/vmalloc.h> #include <linux/mm.h> #include <linux/wait.h> +#include <linux/smp_lock.h> #include <asm/atomic.h> #include <media/v4l2-common.h>
@@ -1029,13 +1030,19 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)static long uvc_v4l2_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +long ret; +if (uvc_trace_param &UVC_TRACE_IOCTL ) {uvc_printk (KERN_DEBUG ,"uvc_v4l2_ioctl(" );v4l_printk_ioctl (cmd);printk (")\n" ); } -return video_usercopy (file, cmd, arg, uvc_v4l2_do_ioctl); +lock_kernel (); + ret =video_usercopy (file, cmd, arg, uvc_v4l2_do_ioctl); +unlock_kernel (); + +return ret; } static ssize_t uvc_v4l2_read(struct file *file, char __user *data,
@@ -1134,7 +1141,7 @@ const struct v4l2_file_operations uvc_fops = { .owner = THIS_MODULE, .open = uvc_v4l2_open, .release = uvc_v4l2_release, - .ioctl = uvc_v4l2_ioctl, + .unlocked_ioctl = uvc_v4l2_ioctl, .read = uvc_v4l2_read, .mmap = uvc_v4l2_mmap, .poll = uvc_v4l2_poll,
drivers/media/video/vivi.c +1 -1
@@ -1264,7 +1264,7 @@ static const struct v4l2_file_operations vivi_fops = { .release = vivi_close, .read = vivi_read, .poll = vivi_poll, - .ioctl = video_ioctl2, /* V4L2 ioctl handler */ + .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ .mmap = vivi_mmap, };
drivers/media/video/w9968cf.c +19 -6
@@ -39,6 +39,7 @@#include <linux/ioctl.h> #include <linux/delay.h> #include <linux/stddef.h> +#include <linux/smp_lock.h> #include <asm/page.h> #include <asm/uaccess.h> #include <linux/page-flags.h>
@@ -2846,6 +2847,18 @@ w9968cf_ioctl(struct file *filp,return err; } +static long +w9968cf_locked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =w9968cf_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static long w9968cf_v4l_ioctl (struct file *filp,unsigned int cmd,void __user *arg)
@@ -3390,12 +3403,12 @@ ioctl_fail:static const struct v4l2_file_operations w9968cf_fops = { - .owner =THIS_MODULE , - .open = w9968cf_open, - .release = w9968cf_release, - .read = w9968cf_read, - .ioctl = w9968cf_ioctl, - .mmap = w9968cf_mmap, + .owner =THIS_MODULE , + .open = w9968cf_open, + .release = w9968cf_release, + .read = w9968cf_read, + .unlocked_ioctl = w9968cf_locked_ioctl, + .mmap = w9968cf_mmap, };
drivers/media/video/zc0301/zc0301_core.c +20 -7
@@ -38,6 +38,7 @@#include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/page-flags.h> +#include <linux/smp_lock.h> #include <asm/byteorder.h> #include <asm/page.h> #include <asm/uaccess.h>
@@ -1927,15 +1928,27 @@ static long zc0301_ioctl(struct file *filp,return err; } +static long +zc0301_locked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =zc0301_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static const struct v4l2_file_operations zc0301_fops = { - .owner =THIS_MODULE , - .open = zc0301_open, - .release = zc0301_release, - .ioctl = zc0301_ioctl, - .read = zc0301_read, - .poll = zc0301_poll, - .mmap = zc0301_mmap, + .owner =THIS_MODULE , + .open = zc0301_open, + .release = zc0301_release, + .unlocked_ioctl = zc0301_locked_ioctl, + .read = zc0301_read, + .poll = zc0301_poll, + .mmap = zc0301_mmap, };/*****************************************************************************/
drivers/staging/cx25821/cx25821-audups11.c +11 -7
@@ -22,6 +22,7 @@*/ #include <linux/slab.h> +#include <linux/smp_lock.h> #include "cx25821-video.h"
@@ -301,6 +302,7 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,return 0 ; } +lock_kernel (); dev->input_filename = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename; dev->vid_stdname = data_from_user->vid_stdname;
@@ -318,6 +320,8 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,break ; } +unlock_kernel (); +return 0 ; }
@@ -359,13 +363,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl_upstream11, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl_upstream11, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-videoioctl.c +20 -7
@@ -21,6 +21,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/smp_lock.h> #include "cx25821-video.h" static void buffer_queue (struct videobuf_queue *vq,struct videobuf_buffer *vb)
@@ -387,6 +388,18 @@ static long video_ioctl_set(struct file *file, unsigned int cmd,return 0 ; } +static long video_locked_ioctl_set (struct file *file,unsigned int cmd, +unsigned long arg) +{ +long ret; + +lock_kernel (); + ret =video_ioctl_set (file, cmd, arg); +unlock_kernel (); + +return ret; +} +static int vidioc_log_status (struct file *file,void *priv) {struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
@@ -419,13 +432,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl_set, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_locked_ioctl_set, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-vidups10.c +12 -7
@@ -21,6 +21,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/smp_lock.h> #include "cx25821-video.h" static void buffer_queue (struct videobuf_queue *vq,struct videobuf_buffer *vb)
@@ -271,6 +272,8 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd,return 0 ; } +lock_kernel (); + dev->input_filename_ch2 = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename; dev->vid_stdname_ch2 = data_from_user->vid_stdname;
@@ -288,6 +291,8 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd,break ; } +unlock_kernel (); +return 0 ; }
@@ -357,13 +362,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,//exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl_upstream10, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl_upstream10, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/cx25821/cx25821-vidups9.c +11 -7
@@ -271,6 +271,8 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd,return 0 ; } +lock_kernel (); + dev->input_filename = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename; dev->vid_stdname = data_from_user->vid_stdname;
@@ -288,6 +290,8 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd,break ; } +unlock_kernel (); +return 0 ; }
@@ -355,13 +359,13 @@ static int vidioc_s_ctrl(struct file *file, void *priv,// exported stuff static const struct v4l2_file_operations video_fops = { - .owner =THIS_MODULE , - .open = video_open, - .release = video_release, - .read = video_read, - .poll = video_poll, - .mmap = cx25821_video_mmap, - .ioctl = video_ioctl_upstream9, + .owner =THIS_MODULE , + .open = video_open, + .release = video_release, + .read = video_read, + .poll = video_poll, + .mmap = cx25821_video_mmap, + .unlocked_ioctl = video_ioctl_upstream9, };static const struct v4l2_ioctl_ops video_ioctl_ops = {
drivers/staging/dream/camera/msm_v4l2.c +19 -8
@@ -12,6 +12,7 @@#include <linux/spinlock.h> #include <linux/videodev2.h> #include <linux/proc_fs.h> +#include <linux/smp_lock.h> #include <linux/slab.h> #include <media/v4l2-dev.h> #include <media/msm_camera.h>
@@ -99,6 +100,7 @@ static unsigned int msm_v4l2_poll(struct file *f, struct poll_table_struct *w)static long msm_v4l2_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) { +long ret;struct msm_ctrl_cmd *ctrlcmd;D ("msm_v4l2_ioctl, cmd = %d, %d\n" , cmd, __LINE__);
@@ -119,18 +121,27 @@ static long msm_v4l2_ioctl(struct file *filep,D ("msm_v4l2_ioctl, MSM_V4L2_START_SNAPSHOT v4l2 ioctl %d\n" , cmd); ctrlcmd->type =MSM_V4L2_SNAPSHOT ; -return g_pmsm_v4l2_dev->drv->ctrl (g_pmsm_v4l2_dev->drv->sync, +lock_kernel (); + ret = g_pmsm_v4l2_dev->drv->ctrl (g_pmsm_v4l2_dev->drv->sync, ctrlcmd); +unlock_kernel (); +return ret;case MSM_V4L2_GET_PICTURE :D ("msm_v4l2_ioctl, MSM_V4L2_GET_PICTURE v4l2 ioctl %d\n" , cmd); ctrlcmd = (struct msm_ctrl_cmd *)arg; -return g_pmsm_v4l2_dev->drv->get_pict ( +lock_kernel (); + ret = g_pmsm_v4l2_dev->drv->get_pict ( g_pmsm_v4l2_dev->drv->sync, ctrlcmd); +unlock_kernel (); +return ret;default :D ("msm_v4l2_ioctl, standard v4l2 ioctl %d\n" , cmd); -return video_ioctl2 (filep, cmd, arg); +lock_kernel (); + ret =video_ioctl2 (filep, cmd, arg); +unlock_kernel (); +return ret; } }
@@ -640,11 +651,11 @@ int msm_v4l2_read_proc(char *pbuf, char **start, off_t offset,#endif static const struct v4l2_file_operations msm_v4l2_fops = { - .owner =THIS_MODULE , - .open = msm_v4l2_open, - .poll = msm_v4l2_poll, - .release = msm_v4l2_release, - .ioctl = msm_v4l2_ioctl, + .owner =THIS_MODULE , + .open = msm_v4l2_open, + .poll = msm_v4l2_poll, + .release = msm_v4l2_release, + .unlocked_ioctl = msm_v4l2_ioctl, };static void msm_v4l2_dev_init (struct msm_v4l2_device *pmsm_v4l2_dev)
Signature · 1 line
1.6.2.3
PATCH 5/5 v4l: Remove struct v4l2_file_operations::ioctl
In reply to Linus TorvaldsNo more drivers use the bkl'ed callback, now drop it for good.
--- drivers/media/video/v4l2-dev.c | 38 ++++---------------------------------- include/media/v4l2-dev.h | 1 - 2 files changed, 4 insertions(+), 35 deletions(-)
drivers/media/video/v4l2-dev.c +4 -34
@@ -215,19 +215,7 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)return vdev->fops->poll (filp, poll); } -static int v4l2_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) -{ -struct video_device *vdev =video_devdata (filp); - -if (!vdev->fops->ioctl) -return -ENOTTY ; -/* Allow ioctl to continue even if the device was unregistered. -Things like dequeueing buffers might still be useful. */ -return vdev->fops->ioctl (filp, cmd, arg); -} - -static long v4l2_unlocked_ioctl (struct file *filp, +static long v4l2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct video_device *vdev =video_devdata (filp);
@@ -307,22 +295,6 @@ static int v4l2_release(struct inode *inode, struct file *filp)return ret; } -static const struct file_operations v4l2_unlocked_fops = { - .owner =THIS_MODULE , - .read = v4l2_read, - .write = v4l2_write, - .open = v4l2_open, - .get_unmapped_area = v4l2_get_unmapped_area, - .mmap = v4l2_mmap, - .unlocked_ioctl = v4l2_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = v4l2_compat_ioctl32, -#endif - .release = v4l2_release, - .poll = v4l2_poll, - .llseek = no_llseek, -}; -static const struct file_operations v4l2_fops = { .owner =THIS_MODULE , .read = v4l2_read,
@@ -330,7 +302,7 @@ static const struct file_operations v4l2_fops = { .open = v4l2_open, .get_unmapped_area = v4l2_get_unmapped_area, .mmap = v4l2_mmap, - .ioctl = v4l2_ioctl, + .unlocked_ioctl = v4l2_ioctl,#ifdef CONFIG_COMPAT .compat_ioctl = v4l2_compat_ioctl32,#endif
@@ -517,10 +489,8 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, ret = -ENOMEM ; goto cleanup; } -if (vdev->fops->unlocked_ioctl) - vdev->cdev->ops = &v4l2_unlocked_fops; -else - vdev->cdev->ops = &v4l2_fops; + + vdev->cdev->ops = &v4l2_fops; vdev->cdev->owner = vdev->fops->owner; ret =cdev_add (vdev->cdev,MKDEV (VIDEO_MAJOR , vdev->minor),1 );if (ret <0 ) {
include/media/v4l2-dev.h +0 -1
@@ -38,7 +38,6 @@ struct v4l2_file_operations {ssize_t (*read) (struct file *,char __user *,size_t ,loff_t *);ssize_t (*write) (struct file *,const char __user *,size_t ,loff_t *);unsigned int (*poll) (struct file *,struct poll_table_struct *); -long (*ioctl) (struct file *,unsigned int ,unsigned long );long (*unlocked_ioctl) (struct file *,unsigned int ,unsigned long );unsigned long (*get_unmapped_area) (struct file *,unsigned long ,unsigned long ,unsigned long ,unsigned long );
Signature · 1 line
1.6.2.3
Arnd Bergmann
maintainerQuoted 4 lines · John Kacur
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing onx86_64I found a number of issues that I fixed-up
Thanks for catching the scsi bugs! It was getting late yesterday night, so I didn't go through a full allyesconfig then.
Quoted 5 lines
I pushed these to my own new linus-bkl tree.
git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.gitlinux-bklFrederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Yes, your fixes (except the v4l2 patch, see comment there) should best be merged into the main patches.
The idea was that if we manage to kill all fops->ioctl users right away, we wouldn't even need Linus' patch and move to dungeon level 2 directly. Either way works for me though.
Should we just split up the rest? If you, Frederic and me each take one of these chunks, we're done. According to the diffstat from Linus' patch, this is what's left:
a) arch specific drivers
arch/cris/arch-v10/drivers/ds1302.c | 2 +- arch/cris/arch-v10/drivers/gpio.c | 2 +- arch/cris/arch-v10/drivers/i2c.c | 2 +- arch/cris/arch-v10/drivers/pcf8563.c | 2 +- arch/cris/arch-v10/drivers/sync_serial.c | 2 +- arch/cris/arch-v32/drivers/cryptocop.c | 2 +- arch/cris/arch-v32/drivers/i2c.c | 2 +- arch/cris/arch-v32/drivers/mach-a3/gpio.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/gpio.c | 2 +- arch/cris/arch-v32/drivers/pcf8563.c | 2 +- arch/cris/arch-v32/drivers/sync_serial.c | 2 +- arch/ia64/kernel/perfmon.c | 2 +- arch/ia64/sn/kernel/sn2/sn_hwperf.c | 2 +- arch/m68k/bvme6000/rtc.c | 2 +- arch/m68k/mvme16x/rtc.c | 2 +- arch/um/drivers/harddog_kern.c | 2 +- arch/um/drivers/hostaudio_kern.c | 4 +- arch/um/drivers/mmapper_kern.c | 2 +-
b) file systems (my other series has patches for some of these already)
fs/autofs/root.c | 2 +- fs/autofs4/root.c | 2 +- fs/coda/pioctl.c | 2 +- fs/coda/psdev.c | 2 +- fs/fat/dir.c | 2 +- fs/fat/file.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/logfs/dir.c | 2 +- fs/logfs/file.c | 2 +- fs/ncpfs/dir.c | 2 +- fs/ncpfs/file.c | 2 +- fs/ntfs/dir.c | 2 +- fs/ntfs/file.c | 2 +- fs/smbfs/dir.c | 2 +- fs/smbfs/file.c | 2 +- fs/udf/dir.c | 2 +- fs/udf/file.c | 2 +-
c) special stuff (this should go last)
Documentation/filesystems/vfs.txt | 2 +- fs/bad_inode.c | 2 +- fs/ioctl.c | 4 +- fs/compat_ioctl.c | 2 +- fs/ecryptfs/file.c | 9 ++++--- fs/proc/inode.c | 8 +++--- include/linux/fs.h | 2 -
Arnd
Quoted 18 lines · Arnd Bergmann
Quoted 4 lines · John Kacur
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing onx86_64I found a number of issues that I fixed-upThanks for catching the scsi bugs! It was getting late yesterday night, so I didn't go through a full allyesconfig then.
Quoted 5 lines
I pushed these to my own new linus-bkl tree.
git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.gitlinux-bklFrederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Yes, your fixes (except the v4l2 patch, see comment there) should best be merged into the main patches.
Quoted 7 lines
The idea was that if we manage to kill all
fops->ioctlusers right away, we wouldn't even need Linus' patch and move to dungeon level 2 directly. Either way works for me though.Should we just split up the rest? If you, Frederic and me each take one of these chunks, we're done. According to the diffstat from Linus' patch, this is what's left:
Okay - good plan. I AM trying to balance doing my own day-to-day work, and writing slides for a conference but I'm sure you and Frederic are
just as pressed for time as me, so lets go-ahead and divide it up!
That will prevent us from doing redundant work.
I assume the target is 2.6.35 so, we have a little bit of time anyway.
I suggest we divide up a) and b) first and postone c) until the first parts are done.
Arranging our names by alphabetical order and shuffling the files off one at a time (for variety), I get this. Is everybody happy with that? 36 files / 3 = 12 files each.
Jan - speak up if you want in.
Arnd
----arch/cris/arch-v10/drivers/ds1302.carch/cris/arch-v10/drivers/pcf8563.carch/cris/arch-v32/drivers/i2c.carch/cris/arch-v32/drivers/pcf8563.carch/ia64/sn/kernel/sn2/sn_hwperf.carch/m68k/mvme16x/rtc.carch/um/drivers/mmapper_kern.cfs/coda/psdev.cfs/hfsplus/dir.cfs/logfs/file.cfs/ntfs/dir.cfs/smbfs/file.c
Frederic
--------arch/cris/arch-v10/drivers/gpio.carch/cris/arch-v10/drivers/sync_serial.carch/cris/arch-v32/drivers/mach-a3/gpio.carch/cris/arch-v32/drivers/sync_serial.carch/m68k/bvme6000/rtc.carch/um/drivers/harddog_kern.cfs/autofs/root.cfs/fat/dir.cfs/hfsplus/inode.cfs/ncpfs/dir.cfs/ntfs/file.cfs/udf/dir.c
John
----arch/cris/arch-v10/drivers/i2c.carch/cris/arch-v32/drivers/cryptocop.carch/cris/arch-v32/drivers/mach-fs/gpio.carch/ia64/kernel/perfmon.carch/m68k/bvme6000/rtc.carch/um/drivers/hostaudio_kern.cfs/coda/pioctl.cfs/fat/file.cfs/logfs/dir.cfs/ncpfs/file.cfs/smbfs/dir.cfs/udf/file.c
Quoted 57 lines
a) arch specific drivers
arch/cris/arch-v10/drivers/ds1302.c | 2 +- arch/cris/arch-v10/drivers/gpio.c | 2 +- arch/cris/arch-v10/drivers/i2c.c | 2 +- arch/cris/arch-v10/drivers/pcf8563.c | 2 +- arch/cris/arch-v10/drivers/sync_serial.c | 2 +- arch/cris/arch-v32/drivers/cryptocop.c | 2 +- arch/cris/arch-v32/drivers/i2c.c | 2 +- arch/cris/arch-v32/drivers/mach-a3/gpio.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/gpio.c | 2 +- arch/cris/arch-v32/drivers/pcf8563.c | 2 +- arch/cris/arch-v32/drivers/sync_serial.c | 2 +- arch/ia64/kernel/perfmon.c | 2 +- arch/ia64/sn/kernel/sn2/sn_hwperf.c | 2 +- arch/m68k/bvme6000/rtc.c | 2 +- arch/m68k/mvme16x/rtc.c | 2 +- arch/um/drivers/harddog_kern.c | 2 +- arch/um/drivers/hostaudio_kern.c | 4 +- arch/um/drivers/mmapper_kern.c | 2 +-b) file systems (my other series has patches for some of these already)
fs/autofs/root.c | 2 +- fs/autofs4/root.c | 2 +- fs/coda/pioctl.c | 2 +- fs/coda/psdev.c | 2 +- fs/fat/dir.c | 2 +- fs/fat/file.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/logfs/dir.c | 2 +- fs/logfs/file.c | 2 +- fs/ncpfs/dir.c | 2 +- fs/ncpfs/file.c | 2 +- fs/ntfs/dir.c | 2 +- fs/ntfs/file.c | 2 +- fs/smbfs/dir.c | 2 +- fs/smbfs/file.c | 2 +- fs/udf/dir.c | 2 +- fs/udf/file.c | 2 +-c) special stuff (this should go last)
Documentation/filesystems/vfs.txt | 2 +- fs/bad_inode.c | 2 +- fs/ioctl.c | 4 +- fs/compat_ioctl.c | 2 +- fs/ecryptfs/file.c | 9 ++++--- fs/proc/inode.c | 8 +++--- include/linux/fs.h | 2 -Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
2010/4/27 John Kacur <[email protected]>:
Quoted 59 lines · Arnd Bergmann
Quoted 19 lines · John Kacur
Quoted 4 lines
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing onx86_64I found a number of issues that I fixed-upThanks for catching the scsi bugs! It was getting late yesterday night, so I didn't go through a full allyesconfig then.
Quoted 5 lines
I pushed these to my own new linus-bkl tree.
git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.gitlinux-bklFrederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Yes, your fixes (except the v4l2 patch, see comment there) should best be merged into the main patches.
Quoted 7 lines
The idea was that if we manage to kill all
fops->ioctlusers right away, we wouldn't even need Linus' patch and move to dungeon level 2 directly. Either way works for me though.Should we just split up the rest? If you, Frederic and me each take one of these chunks, we're done. According to the diffstat from Linus' patch, this is what's left:
Okay - good plan. I AM trying to balance doing my own day-to-day work, and writing slides for a conference but I'm sure you and Frederic are
just as pressed for time as me, so lets go-ahead and divide it up!
That will prevent us from doing redundant work.
I assume the target is 2.6.35 so, we have a little bit of time anyway.I suggest we divide up a) and b) first and postone c) until the first parts are done.
Arranging our names by alphabetical order and shuffling the files off one at a time (for variety), I get this. Is everybody happy with that? 36 files / 3 = 12 files each.
Jan - speak up if you want in.Arnd
----arch/cris/arch-v10/drivers/ds1302.carch/cris/arch-v10/drivers/pcf8563.carch/cris/arch-v32/drivers/i2c.carch/cris/arch-v32/drivers/pcf8563.carch/ia64/sn/kernel/sn2/sn_hwperf.carch/m68k/mvme16x/rtc.carch/um/drivers/mmapper_kern.cfs/coda/psdev.cfs/hfsplus/dir.cfs/logfs/file.cfs/ntfs/dir.cfs/smbfs/file.c
Quoted 14 lines
Frederic
--------arch/cris/arch-v10/drivers/gpio.carch/cris/arch-v10/drivers/sync_serial.carch/cris/arch-v32/drivers/mach-a3/gpio.carch/cris/arch-v32/drivers/sync_serial.carch/m68k/bvme6000/rtc.carch/um/drivers/harddog_kern.cfs/autofs/root.cfs/fat/dir.cfs/hfsplus/inode.cfs/ncpfs/dir.cfs/ntfs/file.cfs/udf/dir.c
Ok :)
Arnd Bergmann
maintainercover BKL pushdown into ioctl, continued
In reply to John KacurHere comes my share of the remaining code.
Quoted 7 lines
Arnd
----arch/cris/arch-v10/drivers/ds1302.carch/cris/arch-v10/drivers/pcf8563.carch/cris/arch-v32/drivers/i2c.carch/cris/arch-v32/drivers/pcf8563.carch/ia64/sn/kernel/sn2/sn_hwperf.c
done
Quoted 1 line
arch/m68k/mvme16x/rtc.c
dropped, as suggested by Geert
Quoted 4 lines
arch/um/drivers/mmapper_kern.cfs/coda/psdev.cfs/hfsplus/dir.cfs/logfs/file.c
done
Quoted 1 line
fs/ntfs/dir.c
Nothing to see here
Quoted 1 line
fs/smbfs/file.c
done
Arnd Bergmann (6):
logfs: push down BKL into ioctl function
hfsplus: push down BKL into ioctl function
cris: push down BKL into some device drivers
sn_hwperf: kill BKL usage
um/mmapper: remove BKL usage
coda/psdev: remove BKL from ioctl function
arch/cris/arch-v10/drivers/ds1302.c | 20 +++++++++++++++----- arch/cris/arch-v10/drivers/pcf8563.c | 19 +++++++++++++++---- arch/cris/arch-v32/drivers/i2c.c | 22 ++++++++++++++-------- arch/cris/arch-v32/drivers/pcf8563.c | 21 ++++++++++++++++----- arch/ia64/sn/kernel/sn2/sn_hwperf.c | 9 ++------- arch/um/drivers/mmapper_kern.c | 5 ++--- fs/coda/psdev.c | 5 ++--- fs/hfsplus/dir.c | 2 +- fs/hfsplus/hfsplus_fs.h | 3 +-- fs/hfsplus/ioctl.c | 11 ++++++++--- fs/logfs/dir.c | 2 +- fs/logfs/file.c | 19 +++++++++++++++---- fs/logfs/logfs.h | 4 ++-- 13 files changed, 94 insertions(+), 48 deletions(-)
Arnd Bergmann
maintainerPATCH 1/7 logfs: push down BKL into ioctl function
In reply to John KacurI'm sure that logfs doesn't rely on the BKL, but right now, we're just pushing it down.
--- fs/logfs/dir.c | 2 +- fs/logfs/file.c | 18 +++++++++++++++--- fs/logfs/logfs.h | 4 ++-- fs/smbfs/ioctl.c | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-)
fs/logfs/dir.c +1 -1
@@ -821,7 +821,7 @@ const struct inode_operations logfs_dir_iops = { };const struct file_operations logfs_dir_fops = { .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_unlocked_ioctl, .readdir = logfs_readdir, .read = generic_read_dir, };
fs/logfs/file.c +15 -3
@@ -8,6 +8,7 @@#include "logfs.h" #include <linux/sched.h> #include <linux/writeback.h> +#include <linux/smp_lock.h> static int logfs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags,
@@ -171,9 +172,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this) } -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg) +static long logfs_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +struct inode *inode = file->f_path.dentry->d_inode;struct logfs_inode *li =logfs_inode (inode);unsigned int oldflags, flags;int err;
@@ -209,6 +210,17 @@ int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, } } +long logfs_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =logfs_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +int logfs_fsync (struct file *file,struct dentry *dentry,int datasync) {struct super_block *sb = dentry->d_inode->i_sb;
@@ -243,7 +255,7 @@ const struct file_operations logfs_reg_fops = { .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_unlocked_ioctl, .llseek = generic_file_llseek, .mmap = generic_file_readonly_mmap, .open = generic_file_open,
fs/logfs/logfs.h +2 -2
@@ -501,8 +501,8 @@ extern const struct inode_operations logfs_reg_iops;extern const struct file_operations logfs_reg_fops;extern const struct address_space_operations logfs_reg_aops;int logfs_readpage (struct file *file,struct page *page); -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg); +long logfs_unlocked_ioctl (struct file *file,unsigned int cmd, +unsigned long arg);int logfs_fsync (struct file *file,struct dentry *dentry,int datasync);/* gc.c */
fs/smbfs/ioctl.c +1 -1
@@ -26,7 +26,7 @@ int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct smb_sb_info *server = server_from_inode(inode); + struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);struct smb_conn_opt opt;int result = -EINVAL ;
Signature · 1 line
1.6.3.3
Arnd Bergmann
maintainerRe: [PATCH 1/7] logfs: push down BKL into ioctl function
fs/smbfs/ioctl.c int · line 31
Quoted 12 lines · Arnd Bergmann
fs/smbfs/ioctl.c +1
-1@@ -26,7 +26,7 @@ int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct smb_sb_info *server = server_from_inode(inode); + struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);struct smb_conn_opt opt;int result = -EINVAL ;
This hunk obviously belongs to the smbfs patch, not the logfs patch. Sorry about that.
Arnd
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
In reply to Arnd BergmannQuoted 3 lines · Arnd Bergmann
I'm sure that logfs doesn't rely on the BKL, but right now, we're just pushing it down.
So why do you create logfs_unlocked_ioctl in the first place? ;)
Jörn
Signature · 3 lines
Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest. -- Rob Pike
Arnd Bergmann
maintainerRe: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 6 lines · Jörn Engel
Quoted 3 lines · Arnd Bergmann
I'm sure that logfs doesn't rely on the BKL, but right now, we're just pushing it down.
So why do you create
logfs_unlocked_ioctlin the first place? ;)
I don't want to get caught in discussions on whether any of my patches might introduce silent bugs in something I'm not maintaining. Also to put pressure on maintainers by threatening them to make their code ugly.
If you just add a patch to convert to ->unlocked_ioctl without the BKL, we can drop this patch ;-)
Arnd
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · Jörn Engel
Quoted 3 lines · Arnd Bergmann
I'm sure that logfs doesn't rely on the BKL, but right now, we're just pushing it down.
So why do you create
logfs_unlocked_ioctlin the first place? ;)
Quoted 7 lines
I don't want to get caught in discussions on whether any of my patches might introduce silent bugs in something I'm not maintaining. Also to put pressure on maintainers by threatening them to make their code ugly.
If you just add a patch to convert to ->unlocked_ioctl without the BKL, we can drop this patch ;-)
I guess that's threatening enough. Is this for the next merge window or still the current one?
Jörn
Signature · 2 lines
Everything should be made as simple as possible, but not simpler. -- Albert Einstein
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 14 lines · Jörn Engel
Quoted 13 lines · Arnd Bergmann
Quoted 6 lines · Jörn Engel
Quoted 3 lines · Arnd Bergmann
I'm sure that logfs doesn't rely on the BKL, but right now, we're just pushing it down.
So why do you create
logfs_unlocked_ioctlin the first place? ;)I don't want to get caught in discussions on whether any of my patches might introduce silent bugs in something I'm not maintaining. Also to put pressure on maintainers by threatening them to make their code ugly.
Quoted 6 lines
Quoted 2 lines
If you just add a patch to convert to ->unlocked_ioctl without the BKL, we can drop this patch ;-)
I guess that's threatening enough. Is this for the next merge window or still the current one?
Hasn't the "current" merge window been over with for weeks? I was assuming that bkl push down, or other bkl patches are for the next merge window.
You can ask Linus whether he'll take a convert unlocked_ioctl now or not.
John
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 3 lines · John Kacur
Hasn't the "current" merge window been over with for weeks? I was assuming that bkl push down, or other bkl patches are for the next merge window.
That's what I was thinking. But some of the bkl related discussion gave me the impression that such patches were still being merged. So I wanted to be sure.
Jörn
Signature · 3 lines
It is better to die of hunger having lived without grief and fear, than to live with a troubled spirit amid abundance. -- Epictetus
Arnd Bergmann
maintainerRe: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 8 lines · Jörn Engel
Quoted 3 lines · John Kacur
Hasn't the "current" merge window been over with for weeks? I was assuming that bkl push down, or other bkl patches are for the next merge window.
That's what I was thinking. But some of the bkl related discussion gave me the impression that such patches were still being merged. So I wanted to be sure.
Yes, just queue it for the 2.6.35-rc1 window and make sure it shows up in linux-next, or send a replacement patch with your Ack or S-o-b so we can put it into the BKL queue.
Arnd
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 10 lines · Arnd Bergmann
Quoted 8 lines · Jörn Engel
Quoted 3 lines · John Kacur
Hasn't the "current" merge window been over with for weeks? I was assuming that bkl push down, or other bkl patches are for the next merge window.
That's what I was thinking. But some of the bkl related discussion gave me the impression that such patches were still being merged. So I wanted to be sure.
Quoted 5 lines
Yes, just queue it for the 2.6.35-rc1 window and make sure it shows up in linux-next, or send a replacement patch with your Ack or S-o-b so we can put it into the BKL queue.
Arnd
I've applied this series in bkl/ioctl, it passed allyesconfig in sparc. I will apply the others from you and John tomorrow or so (and will enjoy my part as well). Jörn, please queue this patch if you want to, as you prefer, we can host it as well if necessary.
Linus I hope you don't mind but I've dropped the .bkl_ioctl renaming. In fact it had conflicts with several trees in Linux-next and now that we are about to pushdown in every ioctl users, this would be an unnecessary step I think.
Thanks.
Arnd Bergmann
maintainerPATCH 1/1 logfs: kill BKL
logfs does not need the BKL, so use ->unlocked_ioctl instead of ->ioctl in file operations.
---
Quoted 5 lines · On Tuesday 27 April 2010 22:12:52 Frederic Weisbecker wrote:
I've applied this series in bkl/ioctl, it passed allyesconfig in sparc. I will apply the others from you and John tomorrow or so (and will enjoy my part as well). Jörn, please queue this patch if you want to, as you prefer, we can host it as well if necessary.
I believe that this is the one that Jörn would prefer to go in. I hope I got it right by editing the patch.
fs/logfs/dir.c +1 -1
@@ -821,7 +821,7 @@ const struct inode_operations logfs_dir_iops = { };const struct file_operations logfs_dir_fops = { .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_ioctl, .readdir = logfs_readdir, .read = generic_read_dir, };
fs/logfs/file.c +3 -3
@@ -171,9 +172,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this) } -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg) +long logfs_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +struct inode *inode = file->f_path.dentry->d_inode;struct logfs_inode *li =logfs_inode (inode);unsigned int oldflags, flags;int err;
@@ -243,7 +255,7 @@ const struct file_operations logfs_reg_fops = { .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_ioctl, .llseek = generic_file_llseek, .mmap = generic_file_readonly_mmap, .open = generic_file_open,
fs/logfs/logfs.h +2 -2
@@ -501,8 +501,8 @@ extern const struct inode_operations logfs_reg_iops;extern const struct file_operations logfs_reg_fops;extern const struct address_space_operations logfs_reg_aops;int logfs_readpage (struct file *file,struct page *page); -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg); +long logfs_ioctl (struct file *file,unsigned int cmd, +unsigned long arg);int logfs_fsync (struct file *file,struct dentry *dentry,int datasync);/* gc.c */
Re: [PATCH] logfs: kill BKL
Quoted 5 lines · Arnd Bergmann
logfs does not need the BKL, so use ->unlocked_ioctl instead of ->ioctl in file operations.
---Quoted 1 line · On Tuesday 27 April 2010 22:12:52 Frederic Weisbecker wrote:
Quoted 7 lines
Quoted 4 lines
I've applied this series in bkl/ioctl, it passed allyesconfig in sparc. I will apply the others from you and John tomorrow or so (and will enjoy my part as well). Jörn, please queue this patch if you want to, as you prefer, we can host it as well if necessary.
I believe that this is the one that Jörn would prefer to go in. I hope I got it right by editing the patch.
Jörn, any news about this patch? If you're fine with it, could you queue it for .35 ?
Thanks.
Quoted 54 lines
fs/logfs/dir.c +1
-1@@ -821,7 +821,7 @@ const struct inode_operations logfs_dir_iops = { };const struct file_operations logfs_dir_fops = { .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_ioctl, .readdir = logfs_readdir, .read = generic_read_dir, };fs/logfs/file.c +3
-3@@ -171,9 +172,9 @@ static int logfs_releasepage(struct page *page, gfp_t only_xfs_uses_this) } -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg) +long logfs_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +struct inode *inode = file->f_path.dentry->d_inode;struct logfs_inode *li =logfs_inode (inode);unsigned int oldflags, flags;int err;@@ -243,7 +255,7 @@ const struct file_operations logfs_reg_fops = { .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, .fsync = logfs_fsync, - .ioctl = logfs_ioctl, + .unlocked_ioctl = logfs_ioctl, .llseek = generic_file_llseek, .mmap = generic_file_readonly_mmap, .open = generic_file_open,fs/logfs/logfs.h +2
-2@@ -501,8 +501,8 @@ extern const struct inode_operations logfs_reg_iops;extern const struct file_operations logfs_reg_fops;extern const struct address_space_operations logfs_reg_aops;int logfs_readpage (struct file *file,struct page *page); -int logfs_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg); +long logfs_ioctl (struct file *file,unsigned int cmd, +unsigned long arg);int logfs_fsync (struct file *file,struct dentry *dentry,int datasync);/* gc.c */
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
In reply to John KacurQuoted 2 lines · John Kacur
You can ask Linus whether he'll take a convert
unlocked_ioctlnow or not.
Absolutely not.
I could imagine merging something like just the bkl_ioctl rename: if it breaks, it won't compile, so there is little risk, and _if_ it helps the next merge window I could merge it early.
But it looks like people are trying to avoid it entirely, and there is not a way in *hell* I will take some big and scary "push BKL down" patch that is clearly _not_ 99% mechanical and clearly _can_ introduce major and subtle bugs while compiling.
Linus
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
Quoted 8 lines · Linus Torvalds
Quoted 2 lines · John Kacur
You can ask Linus whether he'll take a convert
unlocked_ioctlnow or not.Absolutely not.
Quoted 9 lines
I could imagine merging something like just the
bkl_ioctlrename: if it breaks, it won't compile, so there is little risk, and _if_ it helps the next merge window I could merge it early.But it looks like people are trying to avoid it entirely, and there is not a way in *hell* I will take some big and scary "push BKL down" patch that is clearly _not_ 99% mechanical and clearly _can_ introduce major and subtle bugs while compiling.
Heh, that's exactly what I thought you would say, but still good to clarify it for everyone.
John
Re: [PATCH 1/7] logfs: push down BKL into ioctl function
In reply to Arnd Bergmannfs/smbfs/ioctl.c int · line 31
Quoted 10 lines · Arnd Bergmann
fs/smbfs/ioctl.c +1
-1@@ -26,7 +26,7 @@ int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct smb_sb_info *server = server_from_inode(inode); + struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);struct smb_conn_opt opt;int result = -EINVAL ;
I've included this part in the smbfs pushdown patch.
Thanks.
Arnd Bergmann
maintainerPATCH 2/7 hfsplus: push down BKL into ioctl function
In reply to John KacurHFS is one of the remaining users of the ->ioctl function, convert it blindly to unlocked_ioctl by pushing down the BKL.
--- fs/hfsplus/dir.c | 2 +- fs/hfsplus/hfsplus_fs.h | 3 +-- fs/hfsplus/inode.c | 2 +- fs/hfsplus/ioctl.c | 12 +++++++++--- 4 files changed, 12 insertions(+), 7 deletions(-)
fs/hfsplus/dir.c +1 -1
@@ -494,7 +494,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {const struct file_operations hfsplus_dir_operations = { .read = generic_read_dir, .readdir = hfsplus_readdir, - .ioctl = hfsplus_ioctl, + .unlocked_ioctl = hfsplus_ioctl, .llseek = generic_file_llseek, .release = hfsplus_dir_release, };
fs/hfsplus/hfsplus_fs.h +1 -2
@@ -337,8 +337,7 @@ struct inode *hfsplus_new_inode(struct super_block *, int);void hfsplus_delete_inode (struct inode *);/* ioctl.c */ -int hfsplus_ioctl (struct inode *inode,struct file *filp,unsigned int cmd, -unsigned long arg); +long hfsplus_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);int hfsplus_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
fs/hfsplus/inode.c +1 -1
@@ -285,7 +285,7 @@ static const struct file_operations hfsplus_file_operations = { .fsync = file_fsync, .open = hfsplus_file_open, .release = hfsplus_file_release, - .ioctl = hfsplus_ioctl, + .unlocked_ioctl = hfsplus_ioctl, };struct inode *hfsplus_new_inode (struct super_block *sb,int mode)
fs/hfsplus/ioctl.c +9 -3
@@ -17,14 +17,16 @@#include <linux/mount.h> #include <linux/sched.h> #include <linux/xattr.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include "hfsplus_fs.h" -int hfsplus_ioctl (struct inode *inode,struct file *filp,unsigned int cmd, -unsigned long arg) +long hfsplus_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) { +struct inode *inode = filp->f_path.dentry->d_inode;unsigned int flags; +lock_kernel ();switch (cmd) {case HFSPLUS_IOC_EXT2_GETFLAGS : flags =0 ;
@@ -38,8 +40,10 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,case HFSPLUS_IOC_EXT2_SETFLAGS : {int err =0 ; err =mnt_want_write (filp->f_path.mnt); -if (err) +if (err) { +unlock_kernel ();return err; + }if (!is_owner_or_cap (inode)) { err = -EACCES ;
@@ -85,9 +89,11 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,mark_inode_dirty (inode); setflags_out:mnt_drop_write (filp->f_path.mnt); +unlock_kernel ();return err; }default : +unlock_kernel ();return -ENOTTY ; } }
Signature · 1 line
1.6.3.3
Arnd Bergmann
maintainerPATCH 3/7 cris: push down BKL into some device drivers
In reply to John KacurA number of cris specific device drivers still use the locked ->ioctl operation. Convert them to unlocked_ioctl with explicit lock_kernel calls.
--- arch/cris/arch-v10/drivers/ds1302.c | 20 +++++++++++++++----- arch/cris/arch-v10/drivers/pcf8563.c | 19 +++++++++++++++---- arch/cris/arch-v32/drivers/i2c.c | 22 ++++++++++++++-------- arch/cris/arch-v32/drivers/pcf8563.c | 21 ++++++++++++++++----- 4 files changed, 60 insertions(+), 22 deletions(-)
arch/cris/arch-v10/drivers/ds1302.c +15 -5
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/miscdevice.h> #include <linux/delay.h> +#include <linux/smp_lock.h> #include <linux/bcd.h> #include <linux/capability.h>
@@ -238,9 +239,7 @@ static unsigned char days_in_mo[] =/* ioctl that supports RTC_RD_TIME and RTC_SET_TIME (read and set time/date). */ -static int -rtc_ioctl (struct inode *inode,struct file *file,unsigned int cmd, -unsigned long arg) +static int rtc_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {unsigned long flags;
@@ -354,6 +353,17 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, } } +static long rtc_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); + ret =rtc_ioctl (file, cmd, arg); +unlock_kernel (); + +return ret; +} +static void print_rtc_status (void ) {
@@ -375,8 +385,8 @@ print_rtc_status(void)/* The various file operations we support. */ static const struct file_operations rtc_fops = { - .owner =THIS_MODULE , - .ioctl = rtc_ioctl, + .owner =THIS_MODULE , + .unlocked_ioctl = rtc_unlocked_ioctl, };/* Probe for the chip by writing something to its RAM and try reading it back. */
arch/cris/arch-v10/drivers/pcf8563.c +15 -4
@@ -27,6 +27,7 @@#include <linux/delay.h> #include <linux/bcd.h> #include <linux/mutex.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <asm/system.h>
@@ -53,7 +54,7 @@ static DEFINE_MUTEX(rtc_lock); /* Protect state etc */static const unsigned char days_in_month[] = {0 ,31 ,28 ,31 ,30 ,31 ,30 ,31 ,31 ,30 ,31 ,30 ,31 }; -int pcf8563_ioctl (struct inode *,struct file *,unsigned int ,unsigned long ); +static long pcf8563_unlocked_ioctl (struct file *,unsigned int ,unsigned long );/* Cache VL bit value read at driver init since writing the RTC_SECOND * register clears the VL status.
@@ -62,7 +63,7 @@ static int voltage_low;static const struct file_operations pcf8563_fops = { .owner =THIS_MODULE , - .ioctl = pcf8563_ioctl, + .unlocked_ioctl = pcf8563_unlocked_ioctl, };unsigned char
@@ -212,8 +213,7 @@ pcf8563_exit(void)* ioctl calls for this driver. Why return -ENOTTY upon error? Because * POSIX says so! */ -int pcf8563_ioctl (struct inode *inode,struct file *filp,unsigned int cmd, -unsigned long arg) +static int pcf8563_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {/* Some sanity checks. */ if (_IOC_TYPE (cmd) !=RTC_MAGIC )
@@ -339,6 +339,17 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,return 0 ; } +static long pcf8563_unlocked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); +return pcf8563_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static int __init pcf8563_register (void ) {if (pcf8563_init () <0 ) {
arch/cris/arch-v32/drivers/i2c.c +14 -8
@@ -649,10 +649,10 @@ i2c_release(struct inode *inode, struct file *filp)/* Main device API. ioctl's to write or read to/from i2c registers. */ -static int -i2c_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static long +i2c_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +int ret;if (_IOC_TYPE (cmd) !=ETRAXI2C_IOCTYPE ) {return -ENOTTY ; }
@@ -665,9 +665,13 @@ i2c_ioctl(struct inode *inode, struct file *file,I2C_ARGREG (arg), I2C_ARGVALUE(arg))); -return i2c_writereg (I2C_ARGSLAVE (arg), +lock_kernel (); + ret =i2c_writereg (I2C_ARGSLAVE (arg),I2C_ARGREG (arg),I2C_ARGVALUE (arg)); +unlock_kernel (); +return ret; +case I2C_READREG : {unsigned char val;
@@ -675,7 +679,9 @@ i2c_ioctl(struct inode *inode, struct file *file,D (printk ("i2cr %d %d " ,I2C_ARGSLAVE (arg),I2C_ARGREG (arg))); +lock_kernel (); val =i2c_readreg (I2C_ARGSLAVE (arg),I2C_ARGREG (arg)); +unlock_kernel ();D (printk ("= %d\n" , val));return val; }
@@ -688,10 +694,10 @@ i2c_ioctl(struct inode *inode, struct file *file, }static const struct file_operations i2c_fops = { - .owner =THIS_MODULE , - .ioctl = i2c_ioctl, - .open = i2c_open, - .release = i2c_release, + .owner =THIS_MODULE , + .unlocked_ioctl = i2c_ioctl, + .open = i2c_open, + .release = i2c_release, };static int __init i2c_init (void )
arch/cris/arch-v32/drivers/pcf8563.c +16 -5
@@ -24,6 +24,7 @@#include <linux/init.h> #include <linux/fs.h> #include <linux/ioctl.h> +#include <linux/smp_lock.h> #include <linux/delay.h> #include <linux/bcd.h> #include <linux/mutex.h>
@@ -49,7 +50,7 @@ static DEFINE_MUTEX(rtc_lock); /* Protect state etc */static const unsigned char days_in_month[] = {0 ,31 ,28 ,31 ,30 ,31 ,30 ,31 ,31 ,30 ,31 ,30 ,31 }; -int pcf8563_ioctl (struct inode *,struct file *,unsigned int ,unsigned long ); +static long pcf8563_unlocked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);/* Cache VL bit value read at driver init since writing the RTC_SECOND * register clears the VL status.
@@ -57,8 +58,8 @@ int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);static int voltage_low;static const struct file_operations pcf8563_fops = { - .owner =THIS_MODULE , - .ioctl = pcf8563_ioctl + .owner =THIS_MODULE , + .unlocked_ioctl = pcf8563_unlocked_ioctl, };unsigned char
@@ -208,8 +209,7 @@ pcf8563_exit(void)* ioctl calls for this driver. Why return -ENOTTY upon error? Because * POSIX says so! */ -int pcf8563_ioctl (struct inode *inode,struct file *filp,unsigned int cmd, -unsigned long arg) +static int pcf8563_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {/* Some sanity checks. */ if (_IOC_TYPE (cmd) !=RTC_MAGIC )
@@ -335,6 +335,17 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,return 0 ; } +static long pcf8563_unlocked_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) +{ +int ret; + +lock_kernel (); +return pcf8563_ioctl (filp, cmd, arg); +unlock_kernel (); + +return ret; +} +static int __init pcf8563_register (void ) {if (pcf8563_init () <0 ) {
Signature · 1 line
1.6.3.3
Re: [PATCH 3/7] cris: push down BKL into some device drivers
Quoted 5 lines · Arnd Bergmann
A number of cris specific device drivers still use the locked ->ioctl operation. Convert them to
unlocked_ioctlwith explicitlock_kernelcalls.Signed-off-by Arnd Bergmann <[email protected]>
(Adding some more cris related Cc on this one)
Re: [PATCH 3/7] cris: push down BKL into some device drivers
In reply to Arnd BergmannQuoted 3 lines · Arnd Bergmann
A number of cris specific device drivers still use the locked ->ioctl operation. Convert them to
unlocked_ioctlwith explicitlock_kernelcalls.
Looks good, I've added this to the cris tree.
Quoted 1 line
Signed-off-by Arnd Bergmann <[email protected]>
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Re: [PATCH 3/7] cris: push down BKL into some device drivers
Quoted 6 lines · Jesper Nilsson
Quoted 3 lines · Arnd Bergmann
A number of cris specific device drivers still use the locked ->ioctl operation. Convert them to
unlocked_ioctlwith explicitlock_kernelcalls.Looks good, I've added this to the cris tree.
Ok, zapped it from mine then.
Thanks.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Arnd Bergmann <[email protected]>/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Arnd Bergmann
maintainerPATCH 4/7 sn_hwperf: kill BKL usage
In reply to John KacurThis driver always gave up the BKL in its ioctl function, so just convert it to unlocked_ioctl and remove the BKL here.
--- arch/ia64/sn/kernel/sn2/sn_hwperf.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
arch/ia64/sn/kernel/sn2/sn_hwperf.c +2 -7
@@ -30,7 +30,6 @@#include <linux/miscdevice.h> #include <linux/utsname.h> #include <linux/cpumask.h> -#include <linux/smp_lock.h> #include <linux/nodemask.h> #include <linux/smp.h> #include <linux/mutex.h>
@@ -682,8 +681,7 @@ static int sn_hwperf_map_err(int hwperf_err)/* * ioctl for "sn_hwperf" misc device */ -static int -sn_hwperf_ioctl (struct inode *in,struct file *fp,u32 op,unsigned long arg) +static long sn_hwperf_ioctl (struct file *fp,u32 op,unsigned long arg) {struct sn_hwperf_ioctl_args a;struct cpuinfo_ia64 *cdata;
@@ -699,8 +697,6 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)int i;int j; -unlock_kernel (); -/* only user requests are allowed here */ if ((op &SN_HWPERF_OP_MASK ) <10 ) { r = -EINVAL ;
@@ -859,12 +855,11 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg) error:vfree (p); -lock_kernel ();return r; }static const struct file_operations sn_hwperf_fops = { - .ioctl = sn_hwperf_ioctl, + .unlocked_ioctl = sn_hwperf_ioctl, };static struct miscdevice sn_hwperf_dev = {
Signature · 1 line
1.6.3.3
Arnd Bergmann
maintainerPATCH 5/7 um/mmapper: remove BKL usage
In reply to John KacurAn empty function does not need the BKL, so just remove it.
--- arch/um/drivers/mmapper_kern.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
arch/um/drivers/mmapper_kern.c +2 -3
@@ -46,8 +46,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,return count; } -static int mmapper_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) +static long mmapper_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {return -ENOIOCTLCMD ; }
@@ -90,7 +89,7 @@ static const struct file_operations mmapper_fops = { .owner = THIS_MODULE, .read = mmapper_read, .write = mmapper_write, - .ioctl = mmapper_ioctl, + .unlocked_ioctl = mmapper_ioctl, .mmap = mmapper_mmap, .open = mmapper_open, .release = mmapper_release,
Signature · 1 line
1.6.3.3
Arnd Bergmann
maintainerPATCH 6/7 coda/psdev: remove BKL from ioctl function
In reply to John KacurThe ioctl function returns constant results, so it obviously does not need the BKL and can be converted to unlocked_ioctl.
--- fs/coda/psdev.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
fs/coda/psdev.c +2 -3
@@ -73,8 +73,7 @@ static unsigned int coda_psdev_poll(struct file *file, poll_table * wait)return mask; } -static int coda_psdev_ioctl (struct inode * inode,struct file * filp, -unsigned int cmd,unsigned long arg) +static long coda_psdev_ioctl (struct file * filp,unsigned int cmd,unsigned long arg) {unsigned int data;
@@ -344,7 +343,7 @@ static const struct file_operations coda_psdev_fops = { .read = coda_psdev_read, .write = coda_psdev_write, .poll = coda_psdev_poll, - .ioctl = coda_psdev_ioctl, + .unlocked_ioctl = coda_psdev_ioctl, .open = coda_psdev_open, .release = coda_psdev_release, };
Signature · 1 line
1.6.3.3
Arnd Bergmann
maintainerPATCH 7/7 smbfs: push down BKL into ioctl function
In reply to John KacurConverting from ->ioctl to ->unlocked_ioctl with explicit lock_kernel lets us kill the ioctl operation.
--- fs/smbfs/dir.c | 2 +- fs/smbfs/file.c | 2 +- fs/smbfs/ioctl.c | 8 +++++--- fs/smbfs/proto.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
fs/smbfs/dir.c +1 -1
@@ -39,7 +39,7 @@ const struct file_operations smb_dir_operations = { .read = generic_read_dir, .readdir = smb_readdir, - .ioctl = smb_ioctl, + .unlocked_ioctl = smb_ioctl, .open = smb_dir_open, };
fs/smbfs/file.c +1 -1
@@ -437,7 +437,7 @@ const struct file_operations smb_file_operations = .aio_read = smb_file_aio_read, .write = do_sync_write, .aio_write = smb_file_aio_write, - .ioctl = smb_ioctl, + .unlocked_ioctl = smb_ioctl, .mmap = smb_file_mmap, .open = smb_file_open, .release = smb_file_release,
fs/smbfs/ioctl.c +5 -3
@@ -13,6 +13,7 @@#include <linux/time.h> #include <linux/mm.h> #include <linux/highuid.h> +#include <linux/smp_lock.h> #include <linux/net.h> #include <linux/smb_fs.h>
@@ -22,14 +23,14 @@#include "proto.h" -int -smb_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +long +smb_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct smb_sb_info *server =server_from_inode (filp->f_path.dentry->d_inode);struct smb_conn_opt opt;int result = -EINVAL ; +lock_kernel ();switch (cmd) {uid16_t uid16;uid_t uid32;
@@ -62,6 +63,7 @@ smb_ioctl(struct inode *inode, struct file *filp,default :break ; } +unlock_kernel ();return result; }
fs/smbfs/proto.h +1 -1
@@ -67,7 +67,7 @@ extern const struct address_space_operations smb_file_aops;extern const struct file_operations smb_file_operations;extern const struct inode_operations smb_file_inode_operations;/* ioctl.c */ -extern int smb_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg); +extern long smb_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);/* smbiod.c */ extern void smbiod_wake_up (void );extern int smbiod_register_server (struct smb_sb_info *server);
Signature · 1 line
1.6.3.3
2010/4/27 Arnd Bergmann <[email protected]>:
Quoted 15 lines · John Kacur
Quoted 4 lines
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing onx86_64I found a number of issues that I fixed-upThanks for catching the scsi bugs! It was getting late yesterday night, so I didn't go through a full allyesconfig then.
Quoted 5 lines
I pushed these to my own new linus-bkl tree.
git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.gitlinux-bklFrederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Quoted 6 lines
Yes, your fixes (except the v4l2 patch, see comment there) should best be merged into the main patches.
The idea was that if we manage to kill all
fops->ioctlusers right away, we wouldn't even need Linus' patch and move to dungeon level 2 directly. Either way works for me though.
Yeah. Since we are motivated enough to do the whole pushdown, I think we should forget the .bkl_ioctl renaming.
This will let Greg take the staging part for example. I can take all the unmainted rest
(basically most of the rest I guess).
Quoted 3 lines · Arnd Bergmann
a) arch specific drivers
arch/m68k/bvme6000/rtc.c| 2 +-arch/m68k/mvme16x/rtc.c| 2 +-
Don't waste your time on these:
http://git.kernel.org/?p=linux/kernel/git/geert/linux-m68k.git;a=commit;h=ce266e954a1bc7cef51115faacaf3d390b534755
Gr{oetje,eeting}s,
Geert (still has to update his for-next branch for 2.6.35).
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 21 lines · John Kacur
These are bkl pushdowns from Arnd that conflicted with
Linus's "Preparation for BKL'ed ioctl removal patch". I fixed-up the merge conflicts. In addition - during allyesconfig compile testing onx86_64I found a number of issues that I fixed-upI pushed these to my own new linus-bkl tree.
git://www.kernel.org/pub/scm/linux/kernel/git/jkacur/jk-2.6.gitlinux-bklFrederic, if you want to grab those, pls do so. also, we might want to combine my compile fixes with Arnd's push-down patches, for better git bisectability.
Presented separately here for everyone's easy perusal.
Arnd Bergmann (6):
dvb: push down BKL into ioctl functions
scsi: push down BKL into ioctl functions
isdn: push down BKL into ioctl functions
staging: push down BKL into ioctl functions
v4l: always useunlocked_ioctl
drivers: push down BKL into various drivers
Quoted 6 lines
John Kacur (4):
bkl: Fix up compile problems in megaraid from bkl push-down
bkl: Fix missing inodetw_chrdev_ioctldue to bkl pushdown
bkl: Fix missing inode intwl_chrdev_ioctlresulting from bkl
pushdown
bkl: Fix-up compile problems as a result of the bkl-pushdown.
Applied the series in bkl/ioctl, except the staging part that went to Greg's tree and the v4l part for which Linus had concerns.
I haven't pushed your fixes separately but merged them into the concerned arnd's patches with your SOB added.
It passed allyesconfig in sparc.
Thanks.