Commit 858ad08c authored by Harvey Harrison's avatar Harvey Harrison Committed by Linus Torvalds

input: use get_unaligned_* helpers

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 973ea70c
...@@ -528,9 +528,9 @@ static void aiptek_irq(struct urb *urb) ...@@ -528,9 +528,9 @@ static void aiptek_irq(struct urb *urb)
(aiptek->curSetting.pointerMode)) { (aiptek->curSetting.pointerMode)) {
aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
} else { } else {
x = le16_to_cpu(get_unaligned((__le16 *) (data + 1))); x = get_unaligned_le16(data + 1);
y = le16_to_cpu(get_unaligned((__le16 *) (data + 3))); y = get_unaligned_le16(data + 3);
z = le16_to_cpu(get_unaligned((__le16 *) (data + 6))); z = get_unaligned_le16(data + 6);
dv = (data[5] & 0x01) != 0 ? 1 : 0; dv = (data[5] & 0x01) != 0 ? 1 : 0;
p = (data[5] & 0x02) != 0 ? 1 : 0; p = (data[5] & 0x02) != 0 ? 1 : 0;
...@@ -613,8 +613,8 @@ static void aiptek_irq(struct urb *urb) ...@@ -613,8 +613,8 @@ static void aiptek_irq(struct urb *urb)
(aiptek->curSetting.pointerMode)) { (aiptek->curSetting.pointerMode)) {
aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
} else { } else {
x = le16_to_cpu(get_unaligned((__le16 *) (data + 1))); x = get_unaligned_le16(data + 1);
y = le16_to_cpu(get_unaligned((__le16 *) (data + 3))); y = get_unaligned_le16(data + 3);
jitterable = data[5] & 0x1c; jitterable = data[5] & 0x1c;
...@@ -679,7 +679,7 @@ static void aiptek_irq(struct urb *urb) ...@@ -679,7 +679,7 @@ static void aiptek_irq(struct urb *urb)
pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0; pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
macro = dv && p && tip && !(data[3] & 1) ? (data[3] >> 1) : -1; macro = dv && p && tip && !(data[3] & 1) ? (data[3] >> 1) : -1;
z = le16_to_cpu(get_unaligned((__le16 *) (data + 4))); z = get_unaligned_le16(data + 4);
if (dv) { if (dv) {
/* If the selected tool changed, reset the old /* If the selected tool changed, reset the old
...@@ -757,7 +757,7 @@ static void aiptek_irq(struct urb *urb) ...@@ -757,7 +757,7 @@ static void aiptek_irq(struct urb *urb)
* hat switches (which just so happen to be the macroKeys.) * hat switches (which just so happen to be the macroKeys.)
*/ */
else if (data[0] == 6) { else if (data[0] == 6) {
macro = le16_to_cpu(get_unaligned((__le16 *) (data + 1))); macro = get_unaligned_le16(data + 1);
if (macro > 0) { if (macro > 0) {
input_report_key(inputdev, macroKeyEvents[macro - 1], input_report_key(inputdev, macroKeyEvents[macro - 1],
0); 0);
...@@ -952,7 +952,7 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) ...@@ -952,7 +952,7 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
buf[0], buf[1], buf[2]); buf[0], buf[1], buf[2]);
ret = -EIO; ret = -EIO;
} else { } else {
ret = le16_to_cpu(get_unaligned((__le16 *) (buf + 1))); ret = get_unaligned_le16(buf + 1);
} }
kfree(buf); kfree(buf);
return ret; return ret;
......
...@@ -245,11 +245,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -245,11 +245,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
data = report[i]; data = report[i];
break; break;
case 2: case 2:
data16 = le16_to_cpu(get_unaligned((__le16 *)&report[i])); data16 = get_unaligned_le16(&report[i]);
break; break;
case 3: case 3:
size = 4; size = 4;
data32 = le32_to_cpu(get_unaligned((__le32 *)&report[i])); data32 = get_unaligned_le32(&report[i]);
break; break;
} }
...@@ -695,10 +695,10 @@ static void gtco_urb_callback(struct urb *urbinfo) ...@@ -695,10 +695,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
/* Fall thru */ /* Fall thru */
case 1: case 1:
/* All reports have X and Y coords in the same place */ /* 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); 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); input_report_abs(inputdev, ABS_Y, val);
/* Ditto for proximity bit */ /* Ditto for proximity bit */
...@@ -762,7 +762,7 @@ static void gtco_urb_callback(struct urb *urbinfo) ...@@ -762,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[4] >> 1);
le_buffer[1] |= (u8)((device->buffer[5] & 0x1) << 7); 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); input_report_abs(inputdev, ABS_Y, val);
/* /*
...@@ -772,10 +772,10 @@ static void gtco_urb_callback(struct urb *urbinfo) ...@@ -772,10 +772,10 @@ static void gtco_urb_callback(struct urb *urbinfo)
buttonbyte = device->buffer[5] >> 1; buttonbyte = device->buffer[5] >> 1;
} else { } 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); 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); input_report_abs(inputdev, ABS_Y, val);
buttonbyte = device->buffer[5]; buttonbyte = device->buffer[5];
......
...@@ -63,8 +63,8 @@ static void kbtab_irq(struct urb *urb) ...@@ -63,8 +63,8 @@ static void kbtab_irq(struct urb *urb)
goto exit; goto exit;
} }
kbtab->x = le16_to_cpu(get_unaligned((__le16 *) &data[1])); kbtab->x = get_unaligned_le16(&data[1]);
kbtab->y = le16_to_cpu(get_unaligned((__le16 *) &data[3])); kbtab->y = get_unaligned_le16(&data[3]);
kbtab->pressure = (data[5]); kbtab->pressure = (data[5]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment