Skip to content

Commit

Permalink
tty: Remove dead code
Browse files Browse the repository at this point in the history
-> 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>
  • Loading branch information
Andreas Platschek authored and Greg Kroah-Hartman committed Jul 26, 2013
1 parent 17fae28 commit cf940eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
21 changes: 1 addition & 20 deletions drivers/tty/vt/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ static int shift_state = 0;
static unsigned char ledstate = 0xff; /* undefined */
static unsigned char ledioctl;

static struct ledptr {
unsigned int *addr;
unsigned int mask;
unsigned char valid:1;
} ledptrs[3];

/*
* Notifier list for console keyboard events
*/
Expand Down Expand Up @@ -994,24 +988,11 @@ void setledstate(struct kbd_struct *kbd, unsigned int led)
static inline unsigned char getleds(void)
{
struct kbd_struct *kbd = kbd_table + fg_console;
unsigned char leds;
int i;

if (kbd->ledmode == LED_SHOW_IOCTL)
return ledioctl;

leds = kbd->ledflagstate;

if (kbd->ledmode == LED_SHOW_MEM) {
for (i = 0; i < 3; i++)
if (ledptrs[i].valid) {
if (*ledptrs[i].addr & ledptrs[i].mask)
leds |= (1 << i);
else
leds &= ~(1 << i);
}
}
return leds;
return kbd->ledflagstate;
}

static int kbd_update_leds_helper(struct input_handle *handle, void *data)
Expand Down
3 changes: 1 addition & 2 deletions include/linux/kbd_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ struct kbd_struct {
#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */

unsigned char ledmode:2; /* one 2-bit value */
unsigned char ledmode:1;
#define LED_SHOW_FLAGS 0 /* traditional state */
#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */

unsigned char ledflagstate:4; /* flags, not lights */
unsigned char default_ledflagstate:4;
Expand Down

0 comments on commit cf940eb

Please sign in to comment.