Commit c0ece855 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] gcc-3.5: keyboard.c fixes

drivers/char/keyboard.c:205: warning: use of conditional expressions as lvalues is deprecated
parent 8159ad9b
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment