]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/hid/usbhid/hiddev.c
Merge branch 'for-4.12/asus' into for-linus
[karo-tx-linux.git] / drivers / hid / usbhid / hiddev.c
index 774bd701dae0b82f4eecd662250cd4155c82dd4f..0e06368d1fbb6408c829019c474cac39f9d55a9a 100644 (file)
 #endif
 #define HIDDEV_BUFFER_SIZE     2048
 
-struct hiddev {
-       int exist;
-       int open;
-       struct mutex existancelock;
-       wait_queue_head_t wait;
-       struct hid_device *hid;
-       struct list_head list;
-       spinlock_t list_lock;
-};
-
 struct hiddev_list {
        struct hiddev_usage_ref buffer[HIDDEV_BUFFER_SIZE];
        int head;
@@ -690,6 +680,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        case HIDIOCINITREPORT:
                usbhid_init_reports(hid);
+               hiddev->initialized = true;
                r = 0;
                break;
 
@@ -791,6 +782,10 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case HIDIOCGUSAGES:
        case HIDIOCSUSAGES:
        case HIDIOCGCOLLECTIONINDEX:
+               if (!hiddev->initialized) {
+                       usbhid_init_reports(hid);
+                       hiddev->initialized = true;
+               }
                r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
                break;
 
@@ -911,6 +906,15 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
                kfree(hiddev);
                return -1;
        }
+
+       /*
+        * If HID_QUIRK_NO_INIT_REPORTS is set, make sure we don't initialize
+        * the reports.
+        */
+       hiddev->initialized = hid->quirks & HID_QUIRK_NO_INIT_REPORTS;
+
+       hiddev->minor = usbhid->intf->minor;
+
        return 0;
 }