Date:2010-04-28 14:36:41 (12 years 5 months ago)
Author:Arnd Bergmann
Commit:f80a0ca6ad8f2800453e819dafa09a0ed9e56850
Message:pktcdvd: improve BKL and compat_ioctl.c usage

The pktcdvd driver uses proper locking and does not need the BKL in the
ioctl and llseek functions of the character device, so kill both.

Moving the compat_ioctl handling from common code into the driver itself
fixes build problems when CONFIG_BLOCK is disabled.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Files: drivers/block/pktcdvd.c (3 diffs)
fs/compat_ioctl.c (2 diffs)

Change Details

drivers/block/pktcdvd.c
4848#include <linux/module.h>
4949#include <linux/types.h>
5050#include <linux/kernel.h>
51#include <linux/compat.h>
5152#include <linux/kthread.h>
5253#include <linux/errno.h>
5354#include <linux/spinlock.h>
...... 
29842985    mutex_unlock(&ctl_mutex);
29852986}
29862987
2987static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
2988static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
29882989{
29892990    void __user *argp = (void __user *)arg;
29902991    struct pkt_ctrl_command ctrl_cmd;
...... 
30213022    return ret;
30223023}
30233024
3025#ifdef CONFIG_COMPAT
3026static long pkt_ctl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3027{
3028    return pkt_ctl_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
3029}
3030#endif
30243031
30253032static const struct file_operations pkt_ctl_fops = {
3026    .ioctl = pkt_ctl_ioctl,
3027    .owner = THIS_MODULE,
3033    .open = nonseekable_open,
3034    .unlocked_ioctl = pkt_ctl_ioctl,
3035#ifdef CONFIG_COMPAT
3036    .compat_ioctl = pkt_ctl_compat_ioctl,
3037#endif
3038    .owner = THIS_MODULE,
30283039};
30293040
30303041static struct miscdevice pkt_misc = {
fs/compat_ioctl.c
102102#include <linux/nbd.h>
103103#include <linux/random.h>
104104#include <linux/filter.h>
105#include <linux/pktcdvd.h>
106105
107106#include <linux/hiddev.h>
108107
...... 
11261125COMPATIBLE_IOCTL(PPGETPHASE)
11271126COMPATIBLE_IOCTL(PPGETFLAGS)
11281127COMPATIBLE_IOCTL(PPSETFLAGS)
1129/* pktcdvd */
1130COMPATIBLE_IOCTL(PACKET_CTRL_CMD)
11311128/* Big A */
11321129/* sparc only */
11331130/* Big Q for sound/OSS */

Archive Download the corresponding diff file



interactive