HID: ntrig: fix touch events
[safe/jmp/linux-2.6] / drivers / hid / usbhid / hiddev.c
index 9e94215..867e084 100644 (file)
@@ -44,7 +44,7 @@
 #define HIDDEV_MINOR_BASE      96
 #define HIDDEV_MINORS          16
 #endif
-#define HIDDEV_BUFFER_SIZE     64
+#define HIDDEV_BUFFER_SIZE     2048
 
 struct hiddev {
        int exist;
@@ -450,7 +450,6 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
        uref_multi = kmalloc(sizeof(struct hiddev_usage_ref_multi), GFP_KERNEL);
        if (!uref_multi)
                return -ENOMEM;
-       lock_kernel();
        uref = &uref_multi->uref;
        if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
                if (copy_from_user(uref_multi, user_arg,
@@ -527,8 +526,9 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
                        goto goodreturn;
 
                case HIDIOCGCOLLECTIONINDEX:
+                       i = field->usage[uref->usage_index].collection_index;
                        kfree(uref_multi);
-                       return field->usage[uref->usage_index].collection_index;
+                       return i;
                case HIDIOCGUSAGES:
                        for (i = 0; i < uref_multi->num_values; i++)
                                uref_multi->values[i] =
@@ -545,15 +545,12 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
                }
 
 goodreturn:
-               unlock_kernel();
                kfree(uref_multi);
                return 0;
 fault:
-               unlock_kernel();
                kfree(uref_multi);
                return -EFAULT;
 inval:
-               unlock_kernel();
                kfree(uref_multi);
                return -EINVAL;
        }
@@ -850,14 +847,14 @@ static const struct file_operations hiddev_fops = {
 #endif
 };
 
-static char *hiddev_nodename(struct device *dev)
+static char *hiddev_devnode(struct device *dev, mode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 }
 
 static struct usb_class_driver hiddev_class = {
        .name =         "hiddev%d",
-       .nodename =     hiddev_nodename,
+       .devnode =      hiddev_devnode,
        .fops =         &hiddev_fops,
        .minor_base =   HIDDEV_MINOR_BASE,
 };