Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: Remove dead code

-> The ledptrs[] array is never initialized.
-> There is no place where kbd->ledmode is set to LED_SHOW_MEM therefore the if
statement does not make much sense.
-> Since LED_SHOW_MEM is not used, it can be removed from the header file as well.

Signed-off-by: Andreas Platschek <andi.platschek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andreas Platschek and committed by
Greg Kroah-Hartman
cf940ebe 17fae28e

+2 -22
+1 -20
drivers/tty/vt/keyboard.c
··· 132 132 static unsigned char ledstate = 0xff; /* undefined */ 133 133 static unsigned char ledioctl; 134 134 135 - static struct ledptr { 136 - unsigned int *addr; 137 - unsigned int mask; 138 - unsigned char valid:1; 139 - } ledptrs[3]; 140 - 141 135 /* 142 136 * Notifier list for console keyboard events 143 137 */ ··· 988 994 static inline unsigned char getleds(void) 989 995 { 990 996 struct kbd_struct *kbd = kbd_table + fg_console; 991 - unsigned char leds; 992 - int i; 993 997 994 998 if (kbd->ledmode == LED_SHOW_IOCTL) 995 999 return ledioctl; 996 1000 997 - leds = kbd->ledflagstate; 998 - 999 - if (kbd->ledmode == LED_SHOW_MEM) { 1000 - for (i = 0; i < 3; i++) 1001 - if (ledptrs[i].valid) { 1002 - if (*ledptrs[i].addr & ledptrs[i].mask) 1003 - leds |= (1 << i); 1004 - else 1005 - leds &= ~(1 << i); 1006 - } 1007 - } 1008 - return leds; 1001 + return kbd->ledflagstate; 1009 1002 } 1010 1003 1011 1004 static int kbd_update_leds_helper(struct input_handle *handle, void *data)
+1 -2
include/linux/kbd_kern.h
··· 36 36 #define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ 37 37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */ 38 38 39 - unsigned char ledmode:2; /* one 2-bit value */ 39 + unsigned char ledmode:1; 40 40 #define LED_SHOW_FLAGS 0 /* traditional state */ 41 41 #define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ 42 - #define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */ 43 42 44 43 unsigned char ledflagstate:4; /* flags, not lights */ 45 44 unsigned char default_ledflagstate:4;