aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/raw.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-24 11:01:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-24 11:01:10 -0400
commitf13771187b9423b824f32518319f6da85d819003 (patch)
treec431cf16c286065a302d5f3fb43fc1abac7e4047 /drivers/char/raw.c
parent15953654cc312429740fd58fb37a5a3d63a54376 (diff)
parent9f37af654fda88a8dcca74c785f6c20e52758866 (diff)
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing: uml: Pushdown the bkl from harddog_kern ioctl sunrpc: Pushdown the bkl from sunrpc cache ioctl sunrpc: Pushdown the bkl from ioctl autofs4: Pushdown the bkl from ioctl uml: Convert to unlocked_ioctls to remove implicit BKL ncpfs: BKL ioctl pushdown coda: Clean-up whitespace problems in pioctl.c coda: BKL ioctl pushdown drivers: Push down BKL into various drivers isdn: Push down BKL into ioctl functions scsi: Push down BKL into ioctl functions dvb: Push down BKL into ioctl functions smbfs: Push down BKL into ioctl function coda/psdev: Remove BKL from ioctl function um/mmapper: Remove BKL usage sn_hwperf: Kill BKL usage hfsplus: Push down BKL into ioctl function
Diffstat (limited to 'drivers/char/raw.c')
-rw-r--r--drivers/char/raw.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 8756ab0daa8b..b38942f6bf31 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -121,13 +121,17 @@ static int raw_release(struct inode *inode, struct file *filp)
121/* 121/*
122 * Forward ioctls to the underlying block device. 122 * Forward ioctls to the underlying block device.
123 */ 123 */
124static int 124static long
125raw_ioctl(struct inode *inode, struct file *filp, 125raw_ioctl(struct file *filp, unsigned int command, unsigned long arg)
126 unsigned int command, unsigned long arg)
127{ 126{
128 struct block_device *bdev = filp->private_data; 127 struct block_device *bdev = filp->private_data;
128 int ret;
129
130 lock_kernel();
131 ret = blkdev_ioctl(bdev, 0, command, arg);
132 unlock_kernel();
129 133
130 return blkdev_ioctl(bdev, 0, command, arg); 134 return ret;
131} 135}
132 136
133static void bind_device(struct raw_config_request *rq) 137static void bind_device(struct raw_config_request *rq)
@@ -141,13 +145,14 @@ static void bind_device(struct raw_config_request *rq)
141 * Deal with ioctls against the raw-device control interface, to bind 145 * Deal with ioctls against the raw-device control interface, to bind
142 * and unbind other raw devices. 146 * and unbind other raw devices.
143 */ 147 */
144static int raw_ctl_ioctl(struct inode *inode, struct file *filp, 148static long raw_ctl_ioctl(struct file *filp, unsigned int command,
145 unsigned int command, unsigned long arg) 149 unsigned long arg)
146{ 150{
147 struct raw_config_request rq; 151 struct raw_config_request rq;
148 struct raw_device_data *rawdev; 152 struct raw_device_data *rawdev;
149 int err = 0; 153 int err = 0;
150 154
155 lock_kernel();
151 switch (command) { 156 switch (command) {
152 case RAW_SETBIND: 157 case RAW_SETBIND:
153 case RAW_GETBIND: 158 case RAW_GETBIND:
@@ -240,25 +245,26 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
240 break; 245 break;
241 } 246 }
242out: 247out:
248 unlock_kernel();
243 return err; 249 return err;
244} 250}
245 251
246static const struct file_operations raw_fops = { 252static const struct file_operations raw_fops = {
247 .read = do_sync_read, 253 .read = do_sync_read,
248 .aio_read = generic_file_aio_read, 254 .aio_read = generic_file_aio_read,
249 .write = do_sync_write, 255 .write = do_sync_write,
250 .aio_write = blkdev_aio_write, 256 .aio_write = blkdev_aio_write,
251 .fsync = blkdev_fsync, 257 .fsync = blkdev_fsync,
252 .open = raw_open, 258 .open = raw_open,
253 .release= raw_release, 259 .release = raw_release,
254 .ioctl = raw_ioctl, 260 .unlocked_ioctl = raw_ioctl,
255 .owner = THIS_MODULE, 261 .owner = THIS_MODULE,
256}; 262};
257 263
258static const struct file_operations raw_ctl_fops = { 264static const struct file_operations raw_ctl_fops = {
259 .ioctl = raw_ctl_ioctl, 265 .unlocked_ioctl = raw_ctl_ioctl,
260 .open = raw_open, 266 .open = raw_open,
261 .owner = THIS_MODULE, 267 .owner = THIS_MODULE,
262}; 268};
263 269
264static struct cdev raw_cdev; 270static struct cdev raw_cdev;