]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/tablet/gtco.c
input: use get_unaligned_* helpers
[linux-2.6-omap-h63xx.git] / drivers / input / tablet / gtco.c
index b2ca10f2fe0e48b74d8cf22739f8623561a09c7c..c5a8661a1baae242720bdd2c9f0eee248019c1d3 100644 (file)
@@ -245,11 +245,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
                        data = report[i];
                        break;
                case 2:
-                       data16 = le16_to_cpu(get_unaligned((__le16 *)&report[i]));
+                       data16 = get_unaligned_le16(&report[i]);
                        break;
                case 3:
                        size = 4;
-                       data32 = le32_to_cpu(get_unaligned((__le32 *)&report[i]));
+                       data32 = get_unaligned_le32(&report[i]);
                        break;
                }
 
@@ -573,10 +573,12 @@ static void gtco_setup_caps(struct input_dev *inputdev)
        struct gtco *device = input_get_drvdata(inputdev);
 
        /* Which events */
-       inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC);
+       inputdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
+               BIT_MASK(EV_MSC);
 
        /* Misc event menu block */
-       inputdev->mscbit[0] = BIT(MSC_SCAN)|BIT(MSC_SERIAL)|BIT(MSC_RAW) ;
+       inputdev->mscbit[0] = BIT_MASK(MSC_SCAN) | BIT_MASK(MSC_SERIAL) |
+               BIT_MASK(MSC_RAW);
 
        /* Absolute values based on HID report info */
        input_set_abs_params(inputdev, ABS_X, device->min_X, device->max_X,
@@ -693,10 +695,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
                        /*  Fall thru */
                case 1:
                        /* All reports have X and Y coords in the same place */
-                       val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[1]));
+                       val = get_unaligned_le16(&device->buffer[1]);
                        input_report_abs(inputdev, ABS_X, val);
 
-                       val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[3]));
+                       val = get_unaligned_le16(&device->buffer[3]);
                        input_report_abs(inputdev, ABS_Y, val);
 
                        /* Ditto for proximity bit */
@@ -760,7 +762,7 @@ static void gtco_urb_callback(struct urb *urbinfo)
                                le_buffer[1]  = (u8)(device->buffer[4] >> 1);
                                le_buffer[1] |= (u8)((device->buffer[5] & 0x1) << 7);
 
-                               val = le16_to_cpu(get_unaligned((__le16 *)le_buffer));
+                               val = get_unaligned_le16(le_buffer);
                                input_report_abs(inputdev, ABS_Y, val);
 
                                /*
@@ -770,10 +772,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
                                buttonbyte = device->buffer[5] >> 1;
                        } else {
 
-                               val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[1]));
+                               val = get_unaligned_le16(&device->buffer[1]);
                                input_report_abs(inputdev, ABS_X, val);
 
-                               val = le16_to_cpu(get_unaligned((__le16 *)&device->buffer[3]));
+                               val = get_unaligned_le16(&device->buffer[3]);
                                input_report_abs(inputdev, ABS_Y, val);
 
                                buttonbyte = device->buffer[5];
@@ -895,7 +897,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
        dbg("Extra descriptor success: type:%d  len:%d",
            hid_desc->bDescriptorType,  hid_desc->wDescriptorLength);
 
-       report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL);
+       report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL);
        if (!report) {
                err("No more memory for report");
                error = -ENOMEM;
@@ -911,16 +913,16 @@ static int gtco_probe(struct usb_interface *usbinterface,
                                         REPORT_DEVICE_TYPE << 8,
                                         0, /* interface */
                                         report,
-                                        hid_desc->wDescriptorLength,
+                                        le16_to_cpu(hid_desc->wDescriptorLength),
                                         5000); /* 5 secs */
 
-               if (result == hid_desc->wDescriptorLength)
+               if (result == le16_to_cpu(hid_desc->wDescriptorLength))
                        break;
        }
 
        /* If we didn't get the report, fail */
        dbg("usb_control_msg result: :%d", result);
-       if (result != hid_desc->wDescriptorLength) {
+       if (result != le16_to_cpu(hid_desc->wDescriptorLength)) {
                err("Failed to get HID Report Descriptor of size: %d",
                    hid_desc->wDescriptorLength);
                error = -EIO;