Commit 37767b66 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: aiptek - kill aiptek_convert_from_2s_complement()

There is no reason to do that, just tell the compiler that
we are dealing with signed values in buffer, that's it.
Signed-off-by: default avatarRene van Paassen <rene.vanpaassen@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent cd438a58
...@@ -376,26 +376,6 @@ static const char *map_val_to_str(const struct aiptek_map *map, int val) ...@@ -376,26 +376,6 @@ static const char *map_val_to_str(const struct aiptek_map *map, int val)
return "unknown"; return "unknown";
} }
/***********************************************************************
* Relative reports deliver values in 2's complement format to
* deal with negative offsets.
*/
static int aiptek_convert_from_2s_complement(unsigned char c)
{
int ret;
unsigned char b = c;
int negate = 0;
if ((b & 0x80) != 0) {
b = ~b;
b--;
negate = 1;
}
ret = b;
ret = (negate == 1) ? -ret : ret;
return ret;
}
/*********************************************************************** /***********************************************************************
* aiptek_irq can receive one of six potential reports. * aiptek_irq can receive one of six potential reports.
* The documentation for each is in the body of the function. * The documentation for each is in the body of the function.
...@@ -473,8 +453,8 @@ static void aiptek_irq(struct urb *urb) ...@@ -473,8 +453,8 @@ static void aiptek_irq(struct urb *urb)
aiptek->diagnostic = aiptek->diagnostic =
AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE; AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE;
} else { } else {
x = aiptek_convert_from_2s_complement(data[2]); x = (signed char) data[2];
y = aiptek_convert_from_2s_complement(data[3]); y = (signed char) data[3];
/* jitterable keeps track of whether any button has been pressed. /* jitterable keeps track of whether any button has been pressed.
* We're also using it to remap the physical mouse button mask * We're also using it to remap the physical mouse button mask
......
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