]> Pileus Git - ~andy/linux/blobdiff - drivers/hid/hid-input.c
HID: sony: Fix work queue issues.
[~andy/linux] / drivers / hid / hid-input.c
index 8741d953dcc80acb552bac187ffe6997ad95ca4e..a713e6211419c880ddd0a39597b78f16ad84919a 100644 (file)
@@ -192,6 +192,7 @@ static int hidinput_setkeycode(struct input_dev *dev,
        return -EINVAL;
 }
 
+
 /**
  * hidinput_calc_abs_res - calculate an absolute axis resolution
  * @field: the HID report field to calculate resolution for
@@ -234,23 +235,17 @@ __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
        case ABS_MT_TOOL_Y:
        case ABS_MT_TOUCH_MAJOR:
        case ABS_MT_TOUCH_MINOR:
-               if (field->unit & 0xffffff00)           /* Not a length */
-                       return 0;
-               unit_exponent += hid_snto32(field->unit >> 4, 4) - 1;
-               switch (field->unit & 0xf) {
-               case 0x1:                               /* If centimeters */
+               if (field->unit == 0x11) {              /* If centimeters */
                        /* Convert to millimeters */
                        unit_exponent += 1;
-                       break;
-               case 0x3:                               /* If inches */
+               } else if (field->unit == 0x13) {       /* If inches */
                        /* Convert to millimeters */
                        prev = physical_extents;
                        physical_extents *= 254;
                        if (physical_extents < prev)
                                return 0;
                        unit_exponent -= 1;
-                       break;
-               default:
+               } else {
                        return 0;
                }
                break;
@@ -1183,7 +1178,7 @@ static void hidinput_led_worker(struct work_struct *work)
 
        /* fall back to generic raw-output-report */
        len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
-       buf = kmalloc(len, GFP_KERNEL);
+       buf = hid_alloc_report_buf(report, GFP_KERNEL);
        if (!buf)
                return;
 
@@ -1284,7 +1279,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid)
        input_dev->id.vendor  = hid->vendor;
        input_dev->id.product = hid->product;
        input_dev->id.version = hid->version;
-       input_dev->dev.parent = hid->dev.parent;
+       input_dev->dev.parent = &hid->dev;
        hidinput->input = input_dev;
        list_add_tail(&hidinput->list, &hid->inputs);