diff options
author | Martin Kepplinger <martink@posteo.de> | 2015-01-23 19:40:53 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-01-27 02:07:45 -0500 |
commit | 8d2128203682cb1b223e08f19c6b3ba72400bb96 (patch) | |
tree | becd3f84a9dd775676ee2bf884e7b38be787eef8 /drivers/input/tablet | |
parent | bb03bf3f8427a38112819061fc8688999ba02f67 (diff) |
Input: gtco - use sign_extend32() for sign extension
Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r-- | drivers/input/tablet/gtco.c | 20 |
1 files changed, 5 insertions, 15 deletions
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 | |||
59 | #include <asm/uaccess.h> | 59 | #include <asm/uaccess.h> |
60 | #include <asm/unaligned.h> | 60 | #include <asm/unaligned.h> |
61 | #include <asm/byteorder.h> | 61 | #include <asm/byteorder.h> |
62 | 62 | #include <linux/bitops.h> | |
63 | 63 | ||
64 | #include <linux/usb/input.h> | 64 | #include <linux/usb/input.h> |
65 | 65 | ||
@@ -614,7 +614,6 @@ static void gtco_urb_callback(struct urb *urbinfo) | |||
614 | struct input_dev *inputdev; | 614 | struct input_dev *inputdev; |
615 | int rc; | 615 | int rc; |
616 | u32 val = 0; | 616 | u32 val = 0; |
617 | s8 valsigned = 0; | ||
618 | char le_buffer[2]; | 617 | char le_buffer[2]; |
619 | 618 | ||
620 | inputdev = device->inputdevice; | 619 | inputdev = device->inputdevice; |
@@ -665,20 +664,11 @@ static void gtco_urb_callback(struct urb *urbinfo) | |||
665 | /* Fall thru */ | 664 | /* Fall thru */ |
666 | case 4: | 665 | case 4: |
667 | /* Tilt */ | 666 | /* Tilt */ |
667 | input_report_abs(inputdev, ABS_TILT_X, | ||
668 | sign_extend32(device->buffer[6], 6)); | ||
668 | 669 | ||
669 | /* Sign extend these 7 bit numbers. */ | 670 | input_report_abs(inputdev, ABS_TILT_Y, |
670 | if (device->buffer[6] & 0x40) | 671 | sign_extend32(device->buffer[7], 6)); |
671 | device->buffer[6] |= 0x80; | ||
672 | |||
673 | if (device->buffer[7] & 0x40) | ||
674 | device->buffer[7] |= 0x80; | ||
675 | |||
676 | |||
677 | valsigned = (device->buffer[6]); | ||
678 | input_report_abs(inputdev, ABS_TILT_X, (s32)valsigned); | ||
679 | |||
680 | valsigned = (device->buffer[7]); | ||
681 | input_report_abs(inputdev, ABS_TILT_Y, (s32)valsigned); | ||
682 | 672 | ||
683 | /* Fall thru */ | 673 | /* Fall thru */ |
684 | case 2: | 674 | case 2: |