summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2004-02-08 03:02:20 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-02-08 03:02:20 -0800
commita6eebfd5c5e94e2d94a672407795e2d1a9045315 (patch)
tree766b3391aa70ecf495830b7aa728476fab42a09a /include/linux
parent2da321321f6ee9541391fd02aa605e49e3309eb0 (diff)
Make SET_INPUT_KEYCODE return the old value, and clean up
users of this that were very confused indeed.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/input.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 59afa63abbb3..77ba731cfb3a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -752,25 +752,28 @@ 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 { \
+ ({ unsigned __old; \
switch (dev->keycodesize) { \
case 1: { \
u8 *k = (u8 *)dev->keycode; \
+ __old = k[scancode]; \
k[scancode] = val; \
break; \
} \
case 2: { \
u16 *k = (u16 *)dev->keycode; \
+ __old = k[scancode]; \
k[scancode] = val; \
break; \
} \
- case 4: { \
+ default: { \
u32 *k = (u32 *)dev->keycode; \
+ __old = k[scancode]; \
k[scancode] = val; \
break; \
} \
} \
- } while (0)
+ __old; })
struct input_dev {