aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/devio.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2010-01-14 10:23:56 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:54:32 -0500
commit2a9d0083f63da961a8cd4fdf9f4e8e6433c36966 (patch)
tree4d537433c54bc38858ab99f762ce079d09c99b25 /drivers/usb/core/devio.c
parent9fd5c675864263e9f0e6bdb2d752bb380b32a01b (diff)
USB: BKL removal from ioctl path of usbfs
Total removal from the ioctl code path except for the outcall to external modules. Locking is ensured by the normal locks of usbfs. Signed-off-by: Oliver Neukum <oliver@neukum.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/devio.c')
-rw-r--r--drivers/usb/core/devio.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index efe82c968366..e59efea9410f 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1636,7 +1636,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1636 if (driver == NULL || driver->ioctl == NULL) { 1636 if (driver == NULL || driver->ioctl == NULL) {
1637 retval = -ENOTTY; 1637 retval = -ENOTTY;
1638 } else { 1638 } else {
1639 /* keep API that guarantees BKL */
1640 lock_kernel();
1639 retval = driver->ioctl(intf, ctl->ioctl_code, buf); 1641 retval = driver->ioctl(intf, ctl->ioctl_code, buf);
1642 unlock_kernel();
1640 if (retval == -ENOIOCTLCMD) 1643 if (retval == -ENOIOCTLCMD)
1641 retval = -ENOTTY; 1644 retval = -ENOTTY;
1642 } 1645 }
@@ -1720,11 +1723,9 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1720 if (!(file->f_mode & FMODE_WRITE)) 1723 if (!(file->f_mode & FMODE_WRITE))
1721 return -EPERM; 1724 return -EPERM;
1722 1725
1723 lock_kernel();
1724 usb_lock_device(dev); 1726 usb_lock_device(dev);
1725 if (!connected(ps)) { 1727 if (!connected(ps)) {
1726 usb_unlock_device(dev); 1728 usb_unlock_device(dev);
1727 unlock_kernel();
1728 return -ENODEV; 1729 return -ENODEV;
1729 } 1730 }
1730 1731
@@ -1783,12 +1784,10 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1783 break; 1784 break;
1784 1785
1785 case USBDEVFS_SUBMITURB: 1786 case USBDEVFS_SUBMITURB:
1786 unlock_kernel();
1787 snoop(&dev->dev, "%s: SUBMITURB\n", __func__); 1787 snoop(&dev->dev, "%s: SUBMITURB\n", __func__);
1788 ret = proc_submiturb(ps, p); 1788 ret = proc_submiturb(ps, p);
1789 if (ret >= 0) 1789 if (ret >= 0)
1790 inode->i_mtime = CURRENT_TIME; 1790 inode->i_mtime = CURRENT_TIME;
1791 lock_kernel();
1792 break; 1791 break;
1793 1792
1794#ifdef CONFIG_COMPAT 1793#ifdef CONFIG_COMPAT
@@ -1840,17 +1839,13 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1840 break; 1839 break;
1841 1840
1842 case USBDEVFS_REAPURB: 1841 case USBDEVFS_REAPURB:
1843 unlock_kernel();
1844 snoop(&dev->dev, "%s: REAPURB\n", __func__); 1842 snoop(&dev->dev, "%s: REAPURB\n", __func__);
1845 ret = proc_reapurb(ps, p); 1843 ret = proc_reapurb(ps, p);
1846 lock_kernel();
1847 break; 1844 break;
1848 1845
1849 case USBDEVFS_REAPURBNDELAY: 1846 case USBDEVFS_REAPURBNDELAY:
1850 unlock_kernel();
1851 snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); 1847 snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
1852 ret = proc_reapurbnonblock(ps, p); 1848 ret = proc_reapurbnonblock(ps, p);
1853 lock_kernel();
1854 break; 1849 break;
1855 1850
1856 case USBDEVFS_DISCSIGNAL: 1851 case USBDEVFS_DISCSIGNAL:
@@ -1884,7 +1879,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1884 break; 1879 break;
1885 } 1880 }
1886 usb_unlock_device(dev); 1881 usb_unlock_device(dev);
1887 unlock_kernel();
1888 if (ret >= 0) 1882 if (ret >= 0)
1889 inode->i_atime = CURRENT_TIME; 1883 inode->i_atime = CURRENT_TIME;
1890 return ret; 1884 return ret;