V4L/DVB (5238): Kconfig: qt1010 should be selected by gl861 and au6610
[safe/jmp/linux-2.6] / drivers / hid / hid-core.c
index f143c35..7452399 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/list.h>
 #include <linux/mm.h>
 #include <linux/smp_lock.h>
 #include <linux/input.h>
 #include <linux/wait.h>
 
-#undef DEBUG
-#undef DEBUG_DATA
-
 #include <linux/hid.h>
 #include <linux/hiddev.h>
+#include <linux/hid-debug.h>
 
 /*
  * Version Information
@@ -40,7 +37,7 @@
 
 #define DRIVER_VERSION "v2.6"
 #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"
-#define DRIVER_DESC "USB HID core driver"
+#define DRIVER_DESC "HID core driver"
 #define DRIVER_LICENSE "GPL"
 
 /*
@@ -543,6 +540,7 @@ void hid_free_device(struct hid_device *device)
        }
 
        kfree(device->rdesc);
+       kfree(device->collection);
        kfree(device);
 }
 EXPORT_SYMBOL_GPL(hid_free_device);
@@ -880,6 +878,10 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
        unsigned size = field->report_size;
        unsigned n;
 
+       /* make sure the unused bits in the last byte are zeros */
+       if (count > 0 && size > 0)
+               data[(count*size-1)/8] = 0;
+
        for (n = 0; n < count; n++) {
                if (field->logical_minimum < 0) /* signed values */
                        implement(data, offset + n * size, size, s32ton(field->value[n], size));
@@ -946,8 +948,8 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
                return -1;
        }
 
-#ifdef DEBUG_DATA
-       printk(KERN_DEBUG __FILE__ ": report (size %u) (%snumbered)\n", len, report_enum->numbered ? "" : "un");
+#ifdef CONFIG_HID_DEBUG
+       printk(KERN_DEBUG __FILE__ ": report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un");
 #endif
 
        n = 0;                          /* Normally report number is 0 */
@@ -956,7 +958,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
                size--;
        }
 
-#ifdef DEBUG_DATA
+#ifdef CONFIG_HID_DEBUG
        {
                int i;
                printk(KERN_DEBUG __FILE__ ": report %d (size %u) = ", n, size);