[PATCH 06/18] aiptek - kill aiptek_convert_from_2s_complement()

[email protected]
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
From: Rene van Paassen <[email protected]>

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: Rene van Paassen <[email protected]>
---
 drivers/usb/input/aiptek.c |   24 ++----------------------
 1 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 96b8df7..4cb1a13 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -377,26 +377,6 @@ static const char *map_val_to_str(const struct aiptek_map *map, int val)
 }
 
 /***********************************************************************
- * 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.
  * The documentation for each is in the body of the function.
  *
@@ -473,8 +453,8 @@ static void aiptek_irq(struct urb *urb)
 			aiptek->diagnostic =
 			    AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE;
 		} else {
-			x = aiptek_convert_from_2s_complement(data[2]);
-			y = aiptek_convert_from_2s_complement(data[3]);
+			x = (signed char) data[2];
+			y = (signed char) data[3];
 
 			/* jitterable keeps track of whether any button has been pressed.
 			 * We're also using it to remap the physical mouse button mask
-- 
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.