Re: [PATCH 4/4] input: dynamically allocate ABS information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

On Wed, Jul 21, 2010 at 01:31:50AM -0700, Dmitry Torokhov wrote:
> Input: switch to input_abs_*() access functions
> 
> From: Daniel Mack <daniel@xxxxxxxx>
> 
> Change all call sites in drivers/input to not access the ABS axis
> information directly anymore. Make them use the access helpers instead.
> 
> Also use input_set_abs_params() when possible.
> Did some code refactoring as I was on it.
> 
> Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
> Cc: Dmitry Torokhov <dtor@xxxxxxx>
> Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>

Hmm, there are three locations where some mysterious 'XX' characters
were introduced.

> diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
> index 05022f0..e90694f 100644
> --- a/drivers/input/joystick/amijoy.c
> +++ b/drivers/input/joystick/amijoy.c
> @@ -139,8 +139,8 @@ static int __init amijoy_init(void)
>  		amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
>  			BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
>  		for (j = 0; j < 2; j++) {
> -			amijoy_dev[i]->absmin[ABS_X + j] = -1;
> -			amijoy_dev[i]->absmax[ABS_X + j] = 1;
> +			XXinput_set_abs_params(amijoy_dev[i], ABS_X + j,
                        ^^

[..]

> diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
> index c83f4b2..ddd5afd 100644
> --- a/drivers/input/keyboard/hil_kbd.c
> +++ b/drivers/input/keyboard/hil_kbd.c
> @@ -232,15 +232,16 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr)
>  		if (absdev) {
>  			val = lo + (hi << 8);
>  #ifdef TABLET_AUTOADJUST
> -			if (val < dev->absmin[ABS_X + i])
> -				dev->absmin[ABS_X + i] = val;
> -			if (val > dev->absmax[ABS_X + i])
> -				dev->absmax[ABS_X + i] = val;
> +			if (val < input_abs_min(dev, ABS_X + i))
> +				input_abs_set_min(dev, ABS_X + i, val);
> +			if (val > input_abs_max(dev, ABS_X + i))
> +				XXinput_abs_set_max(dev, ABS_X + i, val);
                                ^^

>  #endif
> -			if (i%3) val = dev->absmax[ABS_X + i] - val;
> +			if (i % 3)
> +				val = input_abs_max(dev, ABS_X + i) - val;
>  			input_report_abs(dev, ABS_X + i, val);
>  		} else {
> -			val = (int) (((int8_t)lo) | ((int8_t)hi << 8));
> +			val = (int) (((int8_t) lo) | ((int8_t) hi << 8));
>  			if (i % 3)
>  				val *= -1;
>  			input_report_rel(dev, REL_X + i, val);
> @@ -387,9 +388,11 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr)
>  
>  #ifdef TABLET_AUTOADJUST
>  		for (i = 0; i < ABS_MAX; i++) {
> -			int diff = input_dev->absmax[ABS_X + i] / 10;
> -			input_dev->absmin[ABS_X + i] += diff;
> -			input_dev->absmax[ABS_X + i] -= diff;
> +			int diff = input_abs_max(input_dev, ABS_X + i) / 10;
> +			input_abs_set_min(input_dev, ABS_X + i,
> +				input_abs_min(input_dev, ABS_X + i) + diff)
> +			XXinput_abs_set_max(input_dev, ABS_X + i,
                        ^^

I have no clue how they made it there, but they don't look right, unless
I miss some essential information.

Below is a patch to fix it up.

Thanks,
Daniel

>From 939d842964c8fd764a84702672be927a79d73e8f Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@xxxxxxxx>
Date: Wed, 11 Aug 2010 08:59:53 +0200
Subject: [PATCH] drivers/input: fix faulty XXinput_* calls

They've been introduced by 987a6c02 ("Input: switch to input_abs_*()
access functions") and they appear to be some kind of debug left-over.

Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
Cc: Dmitry Torokhov <dtor@xxxxxxx>
---
 drivers/input/joystick/amijoy.c  |    2 +-
 drivers/input/keyboard/hil_kbd.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index e90694f..0bc8620 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -139,7 +139,7 @@ static int __init amijoy_init(void)
 		amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
 			BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
 		for (j = 0; j < 2; j++) {
-			XXinput_set_abs_params(amijoy_dev[i], ABS_X + j,
+			input_set_abs_params(amijoy_dev[i], ABS_X + j,
 					     -1, 1, 0, 0);
 		}
 
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index ddd5afd..dcc86b9 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -235,7 +235,7 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr)
 			if (val < input_abs_min(dev, ABS_X + i))
 				input_abs_set_min(dev, ABS_X + i, val);
 			if (val > input_abs_max(dev, ABS_X + i))
-				XXinput_abs_set_max(dev, ABS_X + i, val);
+				input_abs_set_max(dev, ABS_X + i, val);
 #endif
 			if (i % 3)
 				val = input_abs_max(dev, ABS_X + i) - val;
@@ -391,7 +391,7 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr)
 			int diff = input_abs_max(input_dev, ABS_X + i) / 10;
 			input_abs_set_min(input_dev, ABS_X + i,
 				input_abs_min(input_dev, ABS_X + i) + diff)
-			XXinput_abs_set_max(input_dev, ABS_X + i,
+			input_abs_set_max(input_dev, ABS_X + i,
 				input_abs_max(input_dev, ABS_X + i) - diff)
 		}
 #endif
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux