diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-02-03 18:33:57 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-03 18:33:57 -0800 |
| commit | c0ece855ddf1b0d8775dcf1465cafcb723add6e1 (patch) | |
| tree | a292201f71ae5109d663f6733a00172519ba0d16 | |
| parent | 8159ad9b6b2d6713047abc4d6fae2a3183337b63 (diff) | |
[PATCH] gcc-3.5: keyboard.c fixes
drivers/char/keyboard.c:205: warning: use of conditional expressions as lvalues is deprecated
| -rw-r--r-- | drivers/char/keyboard.c | 2 | ||||
| -rw-r--r-- | drivers/input/evdev.c | 2 | ||||
| -rw-r--r-- | include/linux/input.h | 21 |
3 files changed, 23 insertions, 2 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 05c133771931..dc03b1a99956 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -202,7 +202,7 @@ int setkeycode(unsigned int scancode, unsigned int keycode) 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 --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 8a165f585f0e..0e16eeeb9e55 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -232,7 +232,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 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 --git a/include/linux/input.h b/include/linux/input.h index 3beb4078a2da..59afa63abbb3 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -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; |
