[PATCH] Generic HID layer - API

- fixed generic API (added neccessary EXPORT_SYMBOL, fixed hid.h to provide correct
  prototypes)
- extended hid_device with open/close/event function pointers to driver-specific
  functions
- added driver specific driver_data to hid_device

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 689ae16..8474a79 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1,5 +1,5 @@
 /*
- *  USB HID support for Linux
+ *  HID support for Linux
  *
  *  Copyright (c) 1999 Andreas Gal
  *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
@@ -31,8 +31,6 @@
 #undef DEBUG
 #undef DEBUG_DATA
 
-#include <linux/usb.h>
-
 #include <linux/hid.h>
 #include <linux/hiddev.h>
 
@@ -538,7 +536,7 @@
  * Free a device structure, all reports, and all fields.
  */
 
-static void hid_free_device(struct hid_device *device)
+void hid_free_device(struct hid_device *device)
 {
 	unsigned i,j;
 
@@ -555,6 +553,7 @@
 	kfree(device->rdesc);
 	kfree(device);
 }
+EXPORT_SYMBOL_GPL(hid_free_device);
 
 /*
  * Fetch a report description item from the data stream. We support long
@@ -629,7 +628,7 @@
  * enumerated, fields are attached to these reports.
  */
 
-static struct hid_device *hid_parse_report(__u8 *start, unsigned size)
+struct hid_device *hid_parse_report(__u8 *start, unsigned size)
 {
 	struct hid_device *device;
 	struct hid_parser *parser;
@@ -719,6 +718,7 @@
 	kfree(parser);
 	return NULL;
 }
+EXPORT_SYMBOL_GPL(hid_parse_report);
 
 /*
  * Convert a signed n-bit integer to signed 32-bit integer. Common
@@ -767,10 +767,10 @@
 	WARN_ON(n > 32);
 
 	report += offset >> 3;  /* adjust byte index */
-	offset &= 7;		/* now only need bit offset into one byte */
+	offset &= 7;            /* now only need bit offset into one byte */
 	x = get_unaligned((u64 *) report);
 	x = le64_to_cpu(x);
-	x = (x >> offset) & ((1ULL << n) - 1);	/* extract bit field */
+	x = (x >> offset) & ((1ULL << n) - 1);  /* extract bit field */
 	return (u32) x;
 }
 
@@ -829,7 +829,7 @@
  * reporting to the layer).
  */
 
-static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt)
+void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt)
 {
 	unsigned n;
 	unsigned count = field->report_count;
@@ -875,7 +875,7 @@
 exit:
 	kfree(value);
 }
-
+EXPORT_SYMBOL_GPL(hid_input_field);
 
 /*
  * Output the field into the report.
@@ -900,7 +900,7 @@
  * Create a report.
  */
 
-static void hid_output_report(struct hid_report *report, __u8 *data)
+void hid_output_report(struct hid_report *report, __u8 *data)
 {
 	unsigned n;
 
@@ -910,6 +910,7 @@
 	for (n = 0; n < report->maxfield; n++)
 		hid_output_field(report->field[n], data);
 }
+EXPORT_SYMBOL_GPL(hid_output_report);
 
 /*
  * Set a field value. The report this field belongs to has to be
@@ -937,4 +938,5 @@
 	field->value[offset] = value;
 	return 0;
 }
+EXPORT_SYMBOL_GPL(hid_set_field);