X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fusb%2Fgadget%2Finode.c;h=f4585d3e90d7a54fd4836648e2cb50eed7d7a947;hb=8be1a6d6c77ab4532e4476fdb8177030ef48b52c;hp=69b0a2754f2ae3a0e7b0af72039094311b0cda1b;hpb=9d87dd97ffcd3b5eb2bbaf0d5d93f4bfcaed3f04;p=linux-2.6 diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 69b0a2754f..f4585d3e90 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -261,8 +262,6 @@ static const char *CHIP; #define ERROR(dev,fmt,args...) \ xprintk(dev , KERN_ERR , fmt , ## args) -#define WARN(dev,fmt,args...) \ - xprintk(dev , KERN_WARNING , fmt , ## args) #define INFO(dev,fmt,args...) \ xprintk(dev , KERN_INFO , fmt , ## args) @@ -483,8 +482,7 @@ ep_release (struct inode *inode, struct file *fd) return 0; } -static int ep_ioctl (struct inode *inode, struct file *fd, - unsigned code, unsigned long value) +static long ep_ioctl(struct file *fd, unsigned code, unsigned long value) { struct ep_data *data = fd->private_data; int status; @@ -740,7 +738,7 @@ static const struct file_operations ep_io_operations = { .read = ep_read, .write = ep_write, - .ioctl = ep_ioctl, + .unlocked_ioctl = ep_ioctl, .release = ep_release, .aio_read = ep_aio_read, @@ -1294,15 +1292,18 @@ out: return mask; } -static int dev_ioctl (struct inode *inode, struct file *fd, - unsigned code, unsigned long value) +static long dev_ioctl (struct file *fd, unsigned code, unsigned long value) { struct dev_data *dev = fd->private_data; struct usb_gadget *gadget = dev->gadget; + long ret = -ENOTTY; - if (gadget->ops->ioctl) - return gadget->ops->ioctl (gadget, code, value); - return -ENOTTY; + if (gadget->ops->ioctl) { + lock_kernel(); + ret = gadget->ops->ioctl (gadget, code, value); + unlock_kernel(); + } + return ret; } /* used after device configuration */ @@ -1314,7 +1315,7 @@ static const struct file_operations ep0_io_operations = { .write = ep0_write, .fasync = ep0_fasync, .poll = ep0_poll, - .ioctl = dev_ioctl, + .unlocked_ioctl = dev_ioctl, .release = dev_release, }; @@ -1501,7 +1502,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) } break; -#ifndef CONFIG_USB_GADGET_PXA2XX +#ifndef CONFIG_USB_GADGET_PXA25X /* PXA automagically handles this request too */ case USB_REQ_GET_CONFIGURATION: if (ctrl->bRequestType != 0x80) @@ -1964,7 +1965,7 @@ static const struct file_operations dev_init_operations = { .open = dev_open, .write = dev_config, .fasync = ep0_fasync, - .ioctl = dev_ioctl, + .unlocked_ioctl = dev_ioctl, .release = dev_release, };