All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH 4/4] input: dynamically allocate ABS information
Date: Wed, 11 Aug 2010 09:02:38 +0200	[thread overview]
Message-ID: <20100811070238.GF10432@buzzloop.caiaq.de> (raw)
In-Reply-To: <20100721083150.GB21558@core.coreip.homeip.net>

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@caiaq.de>
> 
> 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@caiaq.de>
> Cc: Dmitry Torokhov <dtor@mail.ru>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

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@caiaq.de>
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@caiaq.de>
Cc: Dmitry Torokhov <dtor@mail.ru>
---
 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


  parent reply	other threads:[~2010-08-11  7:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 17:22 [RFC] linux-input: dynamically allocate ABS axis information Daniel Mack
2010-05-19 17:22 ` [PATCH 1/4] input: use ABS_CNT rather than (ABS_MAX + 1) Daniel Mack
2010-05-19 17:22 ` [PATCH 2/4] input: add static inline helpers for ABS properties Daniel Mack
2010-05-19 17:22 ` [PATCH 3/4] input: switch to input_abs_*() access functions Daniel Mack
2010-07-14  8:09   ` Dmitry Torokhov
2010-05-19 17:22 ` [PATCH 4/4] input: dynamically allocate ABS information Daniel Mack
2010-05-24 16:08   ` Daniel Mack
2010-05-24 16:15     ` Dmitry Torokhov
2010-06-16  8:39       ` Daniel Mack
2010-07-21  8:30         ` Dmitry Torokhov
2010-07-21  8:31           ` Dmitry Torokhov
2010-07-21  8:32             ` Dmitry Torokhov
2010-07-21  9:22               ` ext-phil.2.carmody
2010-07-21  9:22                 ` ext-phil.2.carmody
2010-07-21 10:42                 ` Artem Bityutskiy
2010-07-21 10:42                   ` Artem Bityutskiy
2010-08-11  7:02             ` Daniel Mack [this message]
2010-08-13  3:35               ` Dmitry Torokhov
2010-08-07 15:23           ` Daniel Mack
2010-08-11  3:29             ` Dmitry Torokhov
2010-07-14  8:18   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100811070238.GF10432@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.