aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/inode.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-05-22 17:03:27 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:18 -0400
commit44c389a00ff7229ab2f2aab22ce03ae0c9037df7 (patch)
tree24f9d98e40cf838efadbb4683135018e2a9038d8 /drivers/usb/gadget/inode.c
parent0391c828ce75cc71ae301946699a6f2d515fd99d (diff)
USB: gadget: Push BKL down into drivers
This keeps the gadget ioctl method wrapped but pushes the BKL down into the gadget code so we can use unlocked_ioctl(). Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r--drivers/usb/gadget/inode.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index f132a9219e11..04692d59fc1c 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -32,6 +32,7 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/poll.h> 34#include <linux/poll.h>
35#include <linux/smp_lock.h>
35 36
36#include <linux/device.h> 37#include <linux/device.h>
37#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
@@ -483,8 +484,7 @@ ep_release (struct inode *inode, struct file *fd)
483 return 0; 484 return 0;
484} 485}
485 486
486static int ep_ioctl (struct inode *inode, struct file *fd, 487static long ep_ioctl(struct file *fd, unsigned code, unsigned long value)
487 unsigned code, unsigned long value)
488{ 488{
489 struct ep_data *data = fd->private_data; 489 struct ep_data *data = fd->private_data;
490 int status; 490 int status;
@@ -740,7 +740,7 @@ static const struct file_operations ep_io_operations = {
740 740
741 .read = ep_read, 741 .read = ep_read,
742 .write = ep_write, 742 .write = ep_write,
743 .ioctl = ep_ioctl, 743 .unlocked_ioctl = ep_ioctl,
744 .release = ep_release, 744 .release = ep_release,
745 745
746 .aio_read = ep_aio_read, 746 .aio_read = ep_aio_read,
@@ -1294,15 +1294,18 @@ out:
1294 return mask; 1294 return mask;
1295} 1295}
1296 1296
1297static int dev_ioctl (struct inode *inode, struct file *fd, 1297static long dev_ioctl (struct file *fd, unsigned code, unsigned long value)
1298 unsigned code, unsigned long value)
1299{ 1298{
1300 struct dev_data *dev = fd->private_data; 1299 struct dev_data *dev = fd->private_data;
1301 struct usb_gadget *gadget = dev->gadget; 1300 struct usb_gadget *gadget = dev->gadget;
1301 long ret = -ENOTTY;
1302 1302
1303 if (gadget->ops->ioctl) 1303 if (gadget->ops->ioctl) {
1304 return gadget->ops->ioctl (gadget, code, value); 1304 lock_kernel();
1305 return -ENOTTY; 1305 ret = gadget->ops->ioctl (gadget, code, value);
1306 unlock_kernel();
1307 }
1308 return ret;
1306} 1309}
1307 1310
1308/* used after device configuration */ 1311/* used after device configuration */
@@ -1314,7 +1317,7 @@ static const struct file_operations ep0_io_operations = {
1314 .write = ep0_write, 1317 .write = ep0_write,
1315 .fasync = ep0_fasync, 1318 .fasync = ep0_fasync,
1316 .poll = ep0_poll, 1319 .poll = ep0_poll,
1317 .ioctl = dev_ioctl, 1320 .unlocked_ioctl = dev_ioctl,
1318 .release = dev_release, 1321 .release = dev_release,
1319}; 1322};
1320 1323
@@ -1964,7 +1967,7 @@ static const struct file_operations dev_init_operations = {
1964 .open = dev_open, 1967 .open = dev_open,
1965 .write = dev_config, 1968 .write = dev_config,
1966 .fasync = ep0_fasync, 1969 .fasync = ep0_fasync,
1967 .ioctl = dev_ioctl, 1970 .unlocked_ioctl = dev_ioctl,
1968 .release = dev_release, 1971 .release = dev_release,
1969}; 1972};
1970 1973