diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/pktcdvd.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 158eed4d5161..29b7a648cc6e 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
50 | #include <linux/kernel.h> | 50 | #include <linux/kernel.h> |
51 | #include <linux/kthread.h> | 51 | #include <linux/kthread.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
54 | #include <linux/spinlock.h> | 53 | #include <linux/spinlock.h> |
55 | #include <linux/file.h> | 54 | #include <linux/file.h> |
@@ -2798,14 +2797,9 @@ out_mem: | |||
2798 | return ret; | 2797 | return ret; |
2799 | } | 2798 | } |
2800 | 2799 | ||
2801 | static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 2800 | static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
2802 | { | 2801 | { |
2803 | struct inode *inode = file->f_path.dentry->d_inode; | 2802 | struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; |
2804 | struct pktcdvd_device *pd; | ||
2805 | long ret; | ||
2806 | |||
2807 | lock_kernel(); | ||
2808 | pd = inode->i_bdev->bd_disk->private_data; | ||
2809 | 2803 | ||
2810 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); | 2804 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); |
2811 | 2805 | ||
@@ -2818,8 +2812,7 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2818 | case CDROM_LAST_WRITTEN: | 2812 | case CDROM_LAST_WRITTEN: |
2819 | case CDROM_SEND_PACKET: | 2813 | case CDROM_SEND_PACKET: |
2820 | case SCSI_IOCTL_SEND_COMMAND: | 2814 | case SCSI_IOCTL_SEND_COMMAND: |
2821 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2815 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2822 | break; | ||
2823 | 2816 | ||
2824 | case CDROMEJECT: | 2817 | case CDROMEJECT: |
2825 | /* | 2818 | /* |
@@ -2828,15 +2821,14 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2828 | */ | 2821 | */ |
2829 | if (pd->refcnt == 1) | 2822 | if (pd->refcnt == 1) |
2830 | pkt_lock_door(pd, 0); | 2823 | pkt_lock_door(pd, 0); |
2831 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2824 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2832 | break; | ||
2833 | 2825 | ||
2834 | default: | 2826 | default: |
2835 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); | 2827 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); |
2836 | ret = -ENOTTY; | 2828 | return -ENOTTY; |
2837 | } | 2829 | } |
2838 | unlock_kernel(); | 2830 | |
2839 | return ret; | 2831 | return 0; |
2840 | } | 2832 | } |
2841 | 2833 | ||
2842 | static int pkt_media_changed(struct gendisk *disk) | 2834 | static int pkt_media_changed(struct gendisk *disk) |
@@ -2858,7 +2850,7 @@ static struct block_device_operations pktcdvd_ops = { | |||
2858 | .owner = THIS_MODULE, | 2850 | .owner = THIS_MODULE, |
2859 | .open = pkt_open, | 2851 | .open = pkt_open, |
2860 | .release = pkt_close, | 2852 | .release = pkt_close, |
2861 | .unlocked_ioctl = pkt_ioctl, | 2853 | .ioctl = pkt_ioctl, |
2862 | .media_changed = pkt_media_changed, | 2854 | .media_changed = pkt_media_changed, |
2863 | }; | 2855 | }; |
2864 | 2856 | ||
@@ -3023,8 +3015,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd) | |||
3023 | mutex_unlock(&ctl_mutex); | 3015 | mutex_unlock(&ctl_mutex); |
3024 | } | 3016 | } |
3025 | 3017 | ||
3026 | static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | 3018 | static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
3027 | unsigned long arg) | ||
3028 | { | 3019 | { |
3029 | void __user *argp = (void __user *)arg; | 3020 | void __user *argp = (void __user *)arg; |
3030 | struct pkt_ctrl_command ctrl_cmd; | 3021 | struct pkt_ctrl_command ctrl_cmd; |
@@ -3041,22 +3032,16 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
3041 | case PKT_CTRL_CMD_SETUP: | 3032 | case PKT_CTRL_CMD_SETUP: |
3042 | if (!capable(CAP_SYS_ADMIN)) | 3033 | if (!capable(CAP_SYS_ADMIN)) |
3043 | return -EPERM; | 3034 | return -EPERM; |
3044 | lock_kernel(); | ||
3045 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); | 3035 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); |
3046 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); | 3036 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); |
3047 | unlock_kernel(); | ||
3048 | break; | 3037 | break; |
3049 | case PKT_CTRL_CMD_TEARDOWN: | 3038 | case PKT_CTRL_CMD_TEARDOWN: |
3050 | if (!capable(CAP_SYS_ADMIN)) | 3039 | if (!capable(CAP_SYS_ADMIN)) |
3051 | return -EPERM; | 3040 | return -EPERM; |
3052 | lock_kernel(); | ||
3053 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); | 3041 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); |
3054 | unlock_kernel(); | ||
3055 | break; | 3042 | break; |
3056 | case PKT_CTRL_CMD_STATUS: | 3043 | case PKT_CTRL_CMD_STATUS: |
3057 | lock_kernel(); | ||
3058 | pkt_get_status(&ctrl_cmd); | 3044 | pkt_get_status(&ctrl_cmd); |
3059 | unlock_kernel(); | ||
3060 | break; | 3045 | break; |
3061 | default: | 3046 | default: |
3062 | return -ENOTTY; | 3047 | return -ENOTTY; |
@@ -3069,7 +3054,7 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
3069 | 3054 | ||
3070 | 3055 | ||
3071 | static const struct file_operations pkt_ctl_fops = { | 3056 | static const struct file_operations pkt_ctl_fops = { |
3072 | .unlocked_ioctl = pkt_ctl_ioctl, | 3057 | .ioctl = pkt_ctl_ioctl, |
3073 | .owner = THIS_MODULE, | 3058 | .owner = THIS_MODULE, |
3074 | }; | 3059 | }; |
3075 | 3060 | ||