X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fusb%2Fmisc%2Fiowarrior.c;h=e6ca9979e3ae5eece2a693207f2e7426ca8fc1dc;hb=cb28a1bbdb4790378e7366d6c9ee1d2340b84f92;hp=801070502cc1b14faa0bd3769247154f2935736f;hpb=6e5565f949af1322f8f3d3f43d044645ae448499;p=linux-2.6 diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 801070502c..e6ca9979e3 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE(usb, iowarrior_ids); */ static void iowarrior_callback(struct urb *urb) { - struct iowarrior *dev = (struct iowarrior *)urb->context; + struct iowarrior *dev = urb->context; int intr_idx; int read_idx; int aux_idx; @@ -218,7 +218,7 @@ exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } @@ -230,7 +230,7 @@ static void iowarrior_write_callback(struct urb *urb) struct iowarrior *dev; int status = urb->status; - dev = (struct iowarrior *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (status && !(status == -ENOENT || @@ -453,7 +453,7 @@ static ssize_t iowarrior_write(struct file *file, default: /* what do we have here ? An unsupported Product-ID ? */ dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n", - __FUNCTION__, dev->product_id); + __func__, dev->product_id); retval = -EFAULT; goto exit; break; @@ -474,8 +474,8 @@ exit: /** * iowarrior_ioctl */ -static int iowarrior_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static long iowarrior_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { struct iowarrior *dev = NULL; __u8 *buffer; @@ -493,6 +493,7 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file, return -ENOMEM; /* lock this object */ + lock_kernel(); mutex_lock(&dev->mutex); /* verify that the device wasn't unplugged */ @@ -584,6 +585,7 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file, error_out: /* unlock the device */ mutex_unlock(&dev->mutex); + unlock_kernel(); kfree(buffer); return retval; } @@ -604,7 +606,7 @@ static int iowarrior_open(struct inode *inode, struct file *file) interface = usb_find_interface(&iowarrior_driver, subminor); if (!interface) { - err("%s - error, can't find device for minor %d", __FUNCTION__, + err("%s - error, can't find device for minor %d", __func__, subminor); return -ENODEV; } @@ -719,7 +721,7 @@ static const struct file_operations iowarrior_fops = { .owner = THIS_MODULE, .write = iowarrior_write, .read = iowarrior_read, - .ioctl = iowarrior_ioctl, + .unlocked_ioctl = iowarrior_ioctl, .open = iowarrior_open, .release = iowarrior_release, .poll = iowarrior_poll,