From patchwork Sat May 1 13:49:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 96171 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o41DoJwb009358 for ; Sat, 1 May 2010 13:50:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752699Ab0EANuS (ORCPT ); Sat, 1 May 2010 09:50:18 -0400 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:49833 "EHLO ch-smtp01.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672Ab0EANuQ (ORCPT ); Sat, 1 May 2010 09:50:16 -0400 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:39609 helo=alnilam) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1O8D4o-00081z-4y; Sat, 01 May 2010 15:49:53 +0200 Received: by alnilam (sSMTP sendmail emulation); Sat, 01 May 2010 15:49:47 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov Cc: Andrew Morton , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH 1/3] input: mt: Simplify event bypass logic Date: Sat, 1 May 2010 15:49:39 +0200 Message-Id: <1272721779-2124-1-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.6.3.3 X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1O8D4o-00081z-4y. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1O8D4o-00081z-4y dd46768303e124e0235236be5bf2af16 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 01 May 2010 13:50:19 +0000 (UTC) diff --git a/drivers/input/input.c b/drivers/input/input.c index 9c79bd5..187dd8b 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -33,25 +33,6 @@ MODULE_LICENSE("GPL"); #define INPUT_DEVICES 256 -/* - * EV_ABS events which should not be cached are listed here. - */ -static unsigned int input_abs_bypass_init_data[] __initdata = { - ABS_MT_TOUCH_MAJOR, - ABS_MT_TOUCH_MINOR, - ABS_MT_WIDTH_MAJOR, - ABS_MT_WIDTH_MINOR, - ABS_MT_ORIENTATION, - ABS_MT_POSITION_X, - ABS_MT_POSITION_Y, - ABS_MT_TOOL_TYPE, - ABS_MT_BLOB_ID, - ABS_MT_TRACKING_ID, - ABS_MT_PRESSURE, - 0 -}; -static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; - static LIST_HEAD(input_dev_list); static LIST_HEAD(input_handler_list); @@ -235,7 +216,7 @@ static void input_handle_event(struct input_dev *dev, case EV_ABS: if (is_event_supported(code, dev->absbit, ABS_MAX)) { - if (test_bit(code, input_abs_bypass)) { + if (code >= ABS_MT_MIN && code <= ABS_MT_MAX) { disposition = INPUT_PASS_TO_HANDLERS; break; } @@ -1926,20 +1907,10 @@ static const struct file_operations input_fops = { .open = input_open_file, }; -static void __init input_init_abs_bypass(void) -{ - const unsigned int *p; - - for (p = input_abs_bypass_init_data; *p; p++) - input_abs_bypass[BIT_WORD(*p)] |= BIT_MASK(*p); -} - static int __init input_init(void) { int err; - input_init_abs_bypass(); - err = class_register(&input_class); if (err) { printk(KERN_ERR "input: unable to register input_dev class\n"); diff --git a/include/linux/input.h b/include/linux/input.h index 7ed2251..d4ad53f 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -706,6 +706,9 @@ struct input_absinfo { #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ +#define ABS_MT_MIN 0x30 +#define ABS_MT_MAX 0x3a + #define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1)