include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / hid / hid-debug.c
index a331a18..56f314f 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/poll.h>
 
@@ -145,6 +146,14 @@ static const struct hid_usage_entry hid_usage_table[] = {
     {0, 0x44, "BarrelSwitch"},
     {0, 0x45, "Eraser"},
     {0, 0x46, "TabletPick"},
+    {0, 0x47, "Confidence"},
+    {0, 0x48, "Width"},
+    {0, 0x49, "Height"},
+    {0, 0x51, "ContactID"},
+    {0, 0x52, "InputMode"},
+    {0, 0x53, "DeviceIndex"},
+    {0, 0x54, "ContactCount"},
+    {0, 0x55, "ContactMaximumNumber"},
   { 15, 0, "PhysicalInterfaceDevice" },
     {0, 0x00, "Undefined"},
     {0, 0x01, "Physical_Interface_Device"},
@@ -556,10 +565,10 @@ void hid_debug_event(struct hid_device *hdev, char *buf)
        struct hid_debug_list *list;
 
        list_for_each_entry(list, &hdev->debug_list, node) {
-               for (i = 0; i <= strlen(buf); i++)
-                       list->hid_debug_buf[(list->tail + i) % (HID_DEBUG_BUFSIZE - 1)] =
+               for (i = 0; i < strlen(buf); i++)
+                       list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
                                buf[i];
-               list->tail = (list->tail + i) % (HID_DEBUG_BUFSIZE - 1);
+               list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
         }
 }
 EXPORT_SYMBOL_GPL(hid_debug_event);
@@ -592,9 +601,11 @@ static const char *events[EV_MAX + 1] = {
        [EV_FF_STATUS] = "ForceFeedbackStatus",
 };
 
-static const char *syncs[2] = {
+static const char *syncs[3] = {
        [SYN_REPORT] = "Report",                [SYN_CONFIG] = "Config",
+       [SYN_MT_REPORT] = "MT Report",
 };
+
 static const char *keys[KEY_MAX + 1] = {
        [KEY_RESERVED] = "Reserved",            [KEY_ESC] = "Esc",
        [KEY_1] = "1",                          [KEY_2] = "2",
@@ -812,8 +823,17 @@ static const char *absolutes[ABS_MAX + 1] = {
        [ABS_HAT2Y] = "Hat2Y",          [ABS_HAT3X] = "Hat3X",
        [ABS_HAT3Y] = "Hat 3Y",         [ABS_PRESSURE] = "Pressure",
        [ABS_DISTANCE] = "Distance",    [ABS_TILT_X] = "XTilt",
-       [ABS_TILT_Y] = "YTilt",         [ABS_TOOL_WIDTH] = "Tool Width",
+       [ABS_TILT_Y] = "YTilt",         [ABS_TOOL_WIDTH] = "ToolWidth",
        [ABS_VOLUME] = "Volume",        [ABS_MISC] = "Misc",
+       [ABS_MT_TOUCH_MAJOR] = "MTMajor",
+       [ABS_MT_TOUCH_MINOR] = "MTMinor",
+       [ABS_MT_WIDTH_MAJOR] = "MTMajorW",
+       [ABS_MT_WIDTH_MINOR] = "MTMinorW",
+       [ABS_MT_ORIENTATION] = "MTOrientation",
+       [ABS_MT_POSITION_X] = "MTPositionX",
+       [ABS_MT_POSITION_Y] = "MTPositionY",
+       [ABS_MT_TOOL_TYPE] = "MTToolType",
+       [ABS_MT_BLOB_ID] = "MTBlobID",
 };
 
 static const char *misc[MSC_MAX + 1] = {
@@ -845,13 +865,13 @@ static const char **names[EV_MAX + 1] = {
        [EV_SND] = sounds,                      [EV_REP] = repeats,
 };
 
-void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f) {
-
+static void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f)
+{
        seq_printf(f, "%s.%s", events[type] ? events[type] : "?",
                names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
 }
 
-void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
+static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
 {
        int i, j, k;
        struct hid_report *report;
@@ -909,6 +929,7 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
 
        if (!(list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL))) {
                err = -ENOMEM;
+               kfree(list);
                goto out;
        }
        list->hdev = (struct hid_device *) inode->i_private;