From: Martin Kepplinger Date: Sat, 24 Jan 2015 00:40:53 +0000 (-0800) Subject: Input: gtco - use sign_extend32() for sign extension X-Git-Tag: firefly_0821_release~176^2~541^2~101^2~16 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d2128203682cb1b223e08f19c6b3ba72400bb96;p=firefly-linux-kernel-4.4.55.git Input: gtco - use sign_extend32() for sign extension Signed-off-by: Martin Kepplinger Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 858045694e9d..3a7f3a4a4396 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -59,7 +59,7 @@ Scott Hill shill@gtcocalcomp.com #include #include #include - +#include #include @@ -614,7 +614,6 @@ static void gtco_urb_callback(struct urb *urbinfo) struct input_dev *inputdev; int rc; u32 val = 0; - s8 valsigned = 0; char le_buffer[2]; inputdev = device->inputdevice; @@ -665,20 +664,11 @@ static void gtco_urb_callback(struct urb *urbinfo) /* Fall thru */ case 4: /* Tilt */ + input_report_abs(inputdev, ABS_TILT_X, + sign_extend32(device->buffer[6], 6)); - /* Sign extend these 7 bit numbers. */ - if (device->buffer[6] & 0x40) - device->buffer[6] |= 0x80; - - if (device->buffer[7] & 0x40) - device->buffer[7] |= 0x80; - - - valsigned = (device->buffer[6]); - input_report_abs(inputdev, ABS_TILT_X, (s32)valsigned); - - valsigned = (device->buffer[7]); - input_report_abs(inputdev, ABS_TILT_Y, (s32)valsigned); + input_report_abs(inputdev, ABS_TILT_Y, + sign_extend32(device->buffer[7], 6)); /* Fall thru */ case 2: