public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: [PATCH 8/11] input: Fix the INPUT_KEYCODE macro and its usage
Date: Fri, 19 Sep 2003 12:26:41 +0200	[thread overview]
Message-ID: <10639672013970@twilight.ucw.cz> (raw)
In-Reply-To: <10639672012999@twilight.ucw.cz>

You can pull this changeset from:
	bk://kernel.bkbits.net/vojtech/input

===================================================================

ChangeSet@1.1346, 2003-09-19 01:22:06-07:00, vojtech@suse.cz
  input.h, keyboard.c, evdev.c:
    Fix the INPUT_KEYCODE macro and its usage.


 drivers/char/keyboard.c |    2 +-
 drivers/input/evdev.c   |   12 +++++-------
 include/linux/input.h   |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

===================================================================

diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c
--- a/drivers/char/keyboard.c	Fri Sep 19 12:16:01 2003
+++ b/drivers/char/keyboard.c	Fri Sep 19 12:16:01 2003
@@ -205,7 +205,7 @@
 	INPUT_KEYCODE(dev, scancode) = keycode;
 
 	for (i = 0; i < dev->keycodemax; i++)
-		if(INPUT_KEYCODE(dev, scancode) == oldkey)
+		if(keycode == oldkey)
 			break;
 	if (i == dev->keycodemax)
 		clear_bit(oldkey, dev->keybit);
diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c	Fri Sep 19 12:16:01 2003
+++ b/drivers/input/evdev.c	Fri Sep 19 12:16:01 2003
@@ -208,7 +208,7 @@
 	struct evdev *evdev = list->evdev;
 	struct input_dev *dev = evdev->handle.dev;
 	struct input_absinfo abs;
-	int i, t, u;
+	int i, t, u, v;
 
 	if (!evdev->exist) return -ENODEV;
 
@@ -239,14 +239,12 @@
 		case EVIOCSKEYCODE:
 			if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
+			if (get_user(v, ((int *) arg) + 1)) return -EFAULT;
 			u = INPUT_KEYCODE(dev, t);
-			if (get_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
-
-			for (i = 0; i < dev->keycodemax; i++)
-				if(INPUT_KEYCODE(dev, t) == u) break;
+			INPUT_KEYCODE(dev, t) = v;
+			for (i = 0; i < dev->keycodemax; i++) if (v == u) break;
 			if (i == dev->keycodemax) clear_bit(u, dev->keybit);
-			set_bit(INPUT_KEYCODE(dev, t), dev->keybit);
-
+			set_bit(v, dev->keybit);
 			return 0;
 
 		case EVIOCSFF:
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h	Fri Sep 19 12:16:01 2003
+++ b/include/linux/input.h	Fri Sep 19 12:16:01 2003
@@ -751,7 +751,7 @@
 #define LONG(x) ((x)/BITS_PER_LONG)
 
 #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
-	((dev->keycodesize == 1) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
+	((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
 
 #define init_input_dev(dev)	do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)
 


  reply	other threads:[~2003-09-19 10:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 10:26 [PATCH 1/11] input: Restore synaptics pad mode on module unload Vojtech Pavlik
2003-09-19 10:26 ` [PATCH 2/11] input: Forced release of keys on AT kbds Vojtech Pavlik
2003-09-19 10:26   ` [PATCH 3/11] input: Fix Sega Saturn pad support Vojtech Pavlik
2003-09-19 10:26     ` [PATCH 4/11] input: Big Synaptics pad update Vojtech Pavlik
2003-09-19 10:26       ` [PATCH 5/11] input: Fix resume of PS/2 mouse Vojtech Pavlik
2003-09-19 10:26         ` [PATCH 6/11] input: Change name of Synaptics protocol to SynPS/2 Vojtech Pavlik
2003-09-19 10:26           ` [PATCH 7/11] input: Fix psmouse->pktcnt in Synaptics mode Vojtech Pavlik
2003-09-19 10:26             ` Vojtech Pavlik [this message]
2003-09-19 10:26               ` [PATCH 9/11] input: Enlarge the timeout for PS/2 mouse full reset Vojtech Pavlik
2003-09-19 10:26                 ` [PATCH 10/11] input: Fix I-Force sleeping issues Vojtech Pavlik
2003-09-19 10:26                   ` [PATCH 11/11] input: Claim serio early in serio_open() Vojtech Pavlik
2003-09-21 13:02             ` [PATCH 7/11] input: Fix psmouse->pktcnt in Synaptics mode Peter Osterlund
2003-09-21 17:19               ` Vojtech Pavlik
2003-09-22 14:20         ` [PATCH 5/11] input: Fix resume of PS/2 mouse Pavel Machek
2003-09-20 20:31 ` [PATCH 1/11] input: Restore synaptics pad mode on module unload jhf

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=10639672013970@twilight.ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox