drivers/char/keyboard.c:205: warning: use of conditional expressions as lvalues is deprecated


---

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

diff -puN drivers/char/keyboard.c~gcc-35-keyboard-fixes drivers/char/keyboard.c
--- 25/drivers/char/keyboard.c~gcc-35-keyboard-fixes	2004-01-23 20:53:26.000000000 -0800
+++ 25-akpm/drivers/char/keyboard.c	2004-01-23 20:53:26.000000000 -0800
@@ -202,7 +202,7 @@ int setkeycode(unsigned int scancode, un
 		return -EINVAL;
 
 	oldkey = INPUT_KEYCODE(dev, scancode);
-	INPUT_KEYCODE(dev, scancode) = keycode;
+	SET_INPUT_KEYCODE(dev, scancode, oldkey);
 
 	clear_bit(oldkey, dev->keybit);
 	set_bit(keycode, dev->keybit);
diff -puN drivers/input/evdev.c~gcc-35-keyboard-fixes drivers/input/evdev.c
--- 25/drivers/input/evdev.c~gcc-35-keyboard-fixes	2004-01-23 20:53:26.000000000 -0800
+++ 25-akpm/drivers/input/evdev.c	2004-01-23 20:53:26.000000000 -0800
@@ -232,7 +232,7 @@ static int evdev_ioctl(struct inode *ino
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
 			if (get_user(v, ((int *) arg) + 1)) return -EFAULT;
 			u = INPUT_KEYCODE(dev, t);
-			INPUT_KEYCODE(dev, t) = v;
+			SET_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(v, dev->keybit);
diff -puN include/linux/input.h~gcc-35-keyboard-fixes include/linux/input.h
--- 25/include/linux/input.h~gcc-35-keyboard-fixes	2004-01-23 20:54:46.000000000 -0800
+++ 25-akpm/include/linux/input.h	2004-01-23 20:54:54.000000000 -0800
@@ -751,6 +751,27 @@ struct ff_effect {
 
 #define init_input_dev(dev)	do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)
 
+#define SET_INPUT_KEYCODE(dev, scancode, val)			\
+	do {							\
+		switch (dev->keycodesize) {			\
+			case 1: {				\
+				u8 *k = (u8 *)dev->keycode;	\
+				k[scancode] = val;		\
+				break;				\
+			}					\
+			case 2: {				\
+				u16 *k = (u16 *)dev->keycode;	\
+				k[scancode] = val;		\
+				break;				\
+			}					\
+			case 4: {				\
+				u32 *k = (u32 *)dev->keycode;	\
+				k[scancode] = val;		\
+				break;				\
+			}					\
+		}						\
+	} while (0)
+
 struct input_dev {
 
 	void *private;

_