[PATCH] Generic HID layer - hiddev

- hiddev is USB-only (agreed with Marcel Holtmann that Bluetooth currently
  doesn't need it, and future planned interface (rawhid) will be more flexible
  and usable)
- both HID and USB-hid can be now compiled as modules (wasn't possible before
  hiddev was fully separated from generic HID layer)

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8474a79..1dd9e4f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -819,8 +819,8 @@
 	hid_dump_input(usage, value);
 	if (hid->claimed & HID_CLAIMED_INPUT)
 		hidinput_hid_event(hid, field, usage, value);
-	if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt)
-		hiddev_hid_event(hid, field, usage, value);
+	if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
+		hid->hiddev_hid_event(hid, field, usage, value);
 }
 
 /*
@@ -940,3 +940,5 @@
 }
 EXPORT_SYMBOL_GPL(hid_set_field);
 
+MODULE_LICENSE(DRIVER_LICENSE);
+
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 0991c4b..4fc8280 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1284,6 +1284,9 @@
 	hid->hidinput_input_event = usb_hidinput_input_event;
 	hid->hidinput_open = hidinput_open;
 	hid->hidinput_close = hidinput_close;
+#ifdef CONFIG_USB_HIDDEV
+	hid->hiddev_hid_event = hiddev_hid_event;
+#endif
 
 	return hid;