diff options
author | Alan Cox <alan@linux.intel.com> | 2012-02-28 09:49:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 13:50:35 -0500 |
commit | 079c9534a96da9a85a2a2f9715851050fbfbf749 (patch) | |
tree | 0e3782ff6d341f38c6f0b3840cb3c8f2bc922df8 /include/linux | |
parent | 0fb8379dab9f97e4c56de8f9ea772c10eda27561 (diff) |
vt:tackle kbd_table
Keyboard struct lifetime is easy, but the locking is not and is completely
ignored by the existing code. Tackle this one head on
- Make the kbd_table private so we can run down all direct users
- Hoick the relevant ioctl handlers into the keyboard layer
- Lock them with the keyboard lock so they don't change mid keypress
- Add helpers for things like console stop/start so we isolate the poking
around properly
- Tweak the braille console so it still builds
There are a couple of FIXME locking cases left for ioctls that are so hideous
they should be addressed in a later patch. After this patch the kbd_table is
private and all the keyboard jiggery pokery is in one place.
This update fixes speakup and also a memory leak in the original.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/kbd_kern.h | 7 | ||||
-rw-r--r-- | include/linux/keyboard.h | 2 | ||||
-rw-r--r-- | include/linux/vt_kern.h | 23 |
3 files changed, 24 insertions, 8 deletions
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index ec2d17bc1f1..daf4a3a40ee 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
@@ -7,8 +7,6 @@ | |||
7 | 7 | ||
8 | extern struct tasklet_struct keyboard_tasklet; | 8 | extern struct tasklet_struct keyboard_tasklet; |
9 | 9 | ||
10 | extern int shift_state; | ||
11 | |||
12 | extern char *func_table[MAX_NR_FUNC]; | 10 | extern char *func_table[MAX_NR_FUNC]; |
13 | extern char func_buf[]; | 11 | extern char func_buf[]; |
14 | extern char *funcbufptr; | 12 | extern char *funcbufptr; |
@@ -65,8 +63,6 @@ struct kbd_struct { | |||
65 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ | 63 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ |
66 | }; | 64 | }; |
67 | 65 | ||
68 | extern struct kbd_struct kbd_table[]; | ||
69 | |||
70 | extern int kbd_init(void); | 66 | extern int kbd_init(void); |
71 | 67 | ||
72 | extern unsigned char getledstate(void); | 68 | extern unsigned char getledstate(void); |
@@ -79,6 +75,7 @@ extern void (*kbd_ledfunc)(unsigned int led); | |||
79 | extern int set_console(int nr); | 75 | extern int set_console(int nr); |
80 | extern void schedule_console_callback(void); | 76 | extern void schedule_console_callback(void); |
81 | 77 | ||
78 | /* FIXME: review locking for vt.c callers */ | ||
82 | static inline void set_leds(void) | 79 | static inline void set_leds(void) |
83 | { | 80 | { |
84 | tasklet_schedule(&keyboard_tasklet); | 81 | tasklet_schedule(&keyboard_tasklet); |
@@ -142,8 +139,6 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag) | |||
142 | 139 | ||
143 | struct console; | 140 | struct console; |
144 | 141 | ||
145 | int getkeycode(unsigned int scancode); | ||
146 | int setkeycode(unsigned int scancode, unsigned int keycode); | ||
147 | void compute_shiftstate(void); | 142 | void compute_shiftstate(void); |
148 | 143 | ||
149 | /* defkeymap.c */ | 144 | /* defkeymap.c */ |
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index 33a63f62d57..86e5214ae73 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
26 | struct notifier_block; | 26 | struct notifier_block; |
27 | extern const int NR_TYPES; | ||
28 | extern const int max_vals[]; | ||
29 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; | 27 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; |
30 | extern unsigned short plain_map[NR_KEYS]; | 28 | extern unsigned short plain_map[NR_KEYS]; |
31 | 29 | ||
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 5d8726ad572..e33d77f15bd 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -169,5 +169,28 @@ extern void hide_boot_cursor(bool hide); | |||
169 | 169 | ||
170 | /* keyboard provided interfaces */ | 170 | /* keyboard provided interfaces */ |
171 | extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); | 171 | extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); |
172 | extern int vt_do_kdskbmode(int console, unsigned int arg); | ||
173 | extern int vt_do_kdskbmeta(int console, unsigned int arg); | ||
174 | extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, | ||
175 | int perm); | ||
176 | extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, | ||
177 | int perm, int console); | ||
178 | extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, | ||
179 | int perm); | ||
180 | extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); | ||
181 | extern int vt_do_kdgkbmode(int console); | ||
182 | extern int vt_do_kdgkbmeta(int console); | ||
183 | extern void vt_reset_unicode(int console); | ||
184 | extern int vt_get_shift_state(void); | ||
185 | extern void vt_reset_keyboard(int console); | ||
186 | extern int vt_get_leds(int console, int flag); | ||
187 | extern int vt_get_kbd_mode_bit(int console, int bit); | ||
188 | extern void vt_set_kbd_mode_bit(int console, int bit); | ||
189 | extern void vt_clr_kbd_mode_bit(int console, int bit); | ||
190 | extern void vt_set_led_state(int console, int leds); | ||
191 | extern void vt_set_led_state(int console, int leds); | ||
192 | extern void vt_kbd_con_start(int console); | ||
193 | extern void vt_kbd_con_stop(int console); | ||
194 | |||
172 | 195 | ||
173 | #endif /* _VT_KERN_H */ | 196 | #endif /* _VT_KERN_H */ |