diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-05 00:30:26 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-05 00:43:43 -0700 |
commit | dd0d5443da02b091636e967407805f0b7712fd44 (patch) | |
tree | 3b92ca97c4aee14d573bc091b3957e47d7a9105b /drivers/input/keyboard | |
parent | c46dd1eb9a4f1b8c1bb597a75199e3d34fb7b43b (diff) |
Input: serio - don't use serio->write() directly
We have a nice wrapper for that.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/hil_kbd.c | 40 | ||||
-rw-r--r-- | drivers/input/keyboard/lkkbd.c | 62 | ||||
-rw-r--r-- | drivers/input/keyboard/sunkbd.c | 26 |
3 files changed, 66 insertions, 62 deletions
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c index 6f356705ee3b..f732893a960e 100644 --- a/drivers/input/keyboard/hil_kbd.c +++ b/drivers/input/keyboard/hil_kbd.c @@ -280,28 +280,28 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) init_MUTEX_LOCKED(&kbd->sem); /* Get device info. MLC driver supplies devid/status/etc. */ - serio->write(serio, 0); - serio->write(serio, 0); - serio->write(serio, HIL_PKT_CMD >> 8); - serio->write(serio, HIL_CMD_IDD); + serio_write(serio, 0); + serio_write(serio, 0); + serio_write(serio, HIL_PKT_CMD >> 8); + serio_write(serio, HIL_CMD_IDD); down(&kbd->sem); - serio->write(serio, 0); - serio->write(serio, 0); - serio->write(serio, HIL_PKT_CMD >> 8); - serio->write(serio, HIL_CMD_RSC); + serio_write(serio, 0); + serio_write(serio, 0); + serio_write(serio, HIL_PKT_CMD >> 8); + serio_write(serio, HIL_CMD_RSC); down(&kbd->sem); - serio->write(serio, 0); - serio->write(serio, 0); - serio->write(serio, HIL_PKT_CMD >> 8); - serio->write(serio, HIL_CMD_RNM); + serio_write(serio, 0); + serio_write(serio, 0); + serio_write(serio, HIL_PKT_CMD >> 8); + serio_write(serio, HIL_CMD_RNM); down(&kbd->sem); - serio->write(serio, 0); - serio->write(serio, 0); - serio->write(serio, HIL_PKT_CMD >> 8); - serio->write(serio, HIL_CMD_EXD); + serio_write(serio, 0); + serio_write(serio, 0); + serio_write(serio, HIL_PKT_CMD >> 8); + serio_write(serio, HIL_CMD_EXD); down(&kbd->sem); up(&kbd->sem); @@ -350,10 +350,10 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) printk(KERN_INFO "input: %s, ID: %d\n", kbd->dev->name, did); - serio->write(serio, 0); - serio->write(serio, 0); - serio->write(serio, HIL_PKT_CMD >> 8); - serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ + serio_write(serio, 0); + serio_write(serio, 0); + serio_write(serio, HIL_PKT_CMD >> 8); + serio_write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ down(&kbd->sem); up(&kbd->sem); diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c index 4730ef35c732..f9847e0fb553 100644 --- a/drivers/input/keyboard/lkkbd.c +++ b/drivers/input/keyboard/lkkbd.c @@ -525,12 +525,12 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); if (leds_on != 0) { - lk->serio->write (lk->serio, LK_CMD_LED_ON); - lk->serio->write (lk->serio, leds_on); + serio_write (lk->serio, LK_CMD_LED_ON); + serio_write (lk->serio, leds_on); } if (leds_off != 0) { - lk->serio->write (lk->serio, LK_CMD_LED_OFF); - lk->serio->write (lk->serio, leds_off); + serio_write (lk->serio, LK_CMD_LED_OFF); + serio_write (lk->serio, leds_off); } return 0; @@ -539,20 +539,20 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, case SND_CLICK: if (value == 0) { DBG ("%s: Deactivating key clicks\n", __func__); - lk->serio->write (lk->serio, LK_CMD_DISABLE_KEYCLICK); - lk->serio->write (lk->serio, LK_CMD_DISABLE_CTRCLICK); + serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK); + serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK); } else { DBG ("%s: Activating key clicks\n", __func__); - lk->serio->write (lk->serio, LK_CMD_ENABLE_KEYCLICK); - lk->serio->write (lk->serio, volume_to_hw (lk->keyclick_volume)); - lk->serio->write (lk->serio, LK_CMD_ENABLE_CTRCLICK); - lk->serio->write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); + serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK); + serio_write (lk->serio, volume_to_hw (lk->keyclick_volume)); + serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK); + serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); } return 0; case SND_BELL: if (value != 0) - lk->serio->write (lk->serio, LK_CMD_SOUND_BELL); + serio_write (lk->serio, LK_CMD_SOUND_BELL); return 0; } @@ -579,10 +579,10 @@ lkkbd_reinit (struct work_struct *work) unsigned char leds_off = 0; /* Ask for ID */ - lk->serio->write (lk->serio, LK_CMD_REQUEST_ID); + serio_write (lk->serio, LK_CMD_REQUEST_ID); /* Reset parameters */ - lk->serio->write (lk->serio, LK_CMD_SET_DEFAULTS); + serio_write (lk->serio, LK_CMD_SET_DEFAULTS); /* Set LEDs */ CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK); @@ -590,12 +590,12 @@ lkkbd_reinit (struct work_struct *work) CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); if (leds_on != 0) { - lk->serio->write (lk->serio, LK_CMD_LED_ON); - lk->serio->write (lk->serio, leds_on); + serio_write (lk->serio, LK_CMD_LED_ON); + serio_write (lk->serio, leds_on); } if (leds_off != 0) { - lk->serio->write (lk->serio, LK_CMD_LED_OFF); - lk->serio->write (lk->serio, leds_off); + serio_write (lk->serio, LK_CMD_LED_OFF); + serio_write (lk->serio, leds_off); } /* @@ -603,31 +603,31 @@ lkkbd_reinit (struct work_struct *work) * only work with a LK401 keyboard and grants access to * LAlt, RAlt, RCompose and RShift. */ - lk->serio->write (lk->serio, LK_CMD_ENABLE_LK401); + serio_write (lk->serio, LK_CMD_ENABLE_LK401); /* Set all keys to UPDOWN mode */ for (division = 1; division <= 14; division++) - lk->serio->write (lk->serio, LK_CMD_SET_MODE (LK_MODE_UPDOWN, + serio_write (lk->serio, LK_CMD_SET_MODE (LK_MODE_UPDOWN, division)); /* Enable bell and set volume */ - lk->serio->write (lk->serio, LK_CMD_ENABLE_BELL); - lk->serio->write (lk->serio, volume_to_hw (lk->bell_volume)); + serio_write (lk->serio, LK_CMD_ENABLE_BELL); + serio_write (lk->serio, volume_to_hw (lk->bell_volume)); /* Enable/disable keyclick (and possibly set volume) */ if (test_bit (SND_CLICK, lk->dev->snd)) { - lk->serio->write (lk->serio, LK_CMD_ENABLE_KEYCLICK); - lk->serio->write (lk->serio, volume_to_hw (lk->keyclick_volume)); - lk->serio->write (lk->serio, LK_CMD_ENABLE_CTRCLICK); - lk->serio->write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); + serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK); + serio_write (lk->serio, volume_to_hw (lk->keyclick_volume)); + serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK); + serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume)); } else { - lk->serio->write (lk->serio, LK_CMD_DISABLE_KEYCLICK); - lk->serio->write (lk->serio, LK_CMD_DISABLE_CTRCLICK); + serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK); + serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK); } /* Sound the bell if needed */ if (test_bit (SND_BELL, lk->dev->snd)) - lk->serio->write (lk->serio, LK_CMD_SOUND_BELL); + serio_write (lk->serio, LK_CMD_SOUND_BELL); } /* @@ -684,8 +684,10 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) input_dev->keycode = lk->keycode; input_dev->keycodesize = sizeof (lk_keycode_t); input_dev->keycodemax = LK_NUM_KEYCODES; + for (i = 0; i < LK_NUM_KEYCODES; i++) - set_bit (lk->keycode[i], input_dev->keybit); + __set_bit (lk->keycode[i], input_dev->keybit); + __clear_bit(KEY_RESERVED, input_dev->keybit); serio_set_drvdata (serio, lk); @@ -697,7 +699,7 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) if (err) goto fail3; - lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET); + serio_write (lk->serio, LK_CMD_POWERCYCLE_RESET); return 0; diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c index 9fce6d1e29b2..e7aa935a294a 100644 --- a/drivers/input/keyboard/sunkbd.c +++ b/drivers/input/keyboard/sunkbd.c @@ -150,8 +150,8 @@ static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int c case EV_LED: - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, + serio_write(sunkbd->serio, SUNKBD_CMD_SETLED); + serio_write(sunkbd->serio, (!!test_bit(LED_CAPSL, dev->led) << 3) | (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_COMPOSE, dev->led) << 1) | !!test_bit(LED_NUML, dev->led)); return 0; @@ -161,11 +161,11 @@ static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int c switch (code) { case SND_CLICK: - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value); + serio_write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value); return 0; case SND_BELL: - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value); + serio_write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value); return 0; } @@ -183,7 +183,7 @@ static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int c static int sunkbd_initialize(struct sunkbd *sunkbd) { sunkbd->reset = -2; - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_RESET); + serio_write(sunkbd->serio, SUNKBD_CMD_RESET); wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ); if (sunkbd->reset < 0) return -1; @@ -192,7 +192,7 @@ static int sunkbd_initialize(struct sunkbd *sunkbd) if (sunkbd->type == 4) { /* Type 4 keyboard */ sunkbd->layout = -2; - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_LAYOUT); + serio_write(sunkbd->serio, SUNKBD_CMD_LAYOUT); wait_event_interruptible_timeout(sunkbd->wait, sunkbd->layout >= 0, HZ/4); if (sunkbd->layout < 0) return -1; if (sunkbd->layout & SUNKBD_LAYOUT_5_MASK) sunkbd->type = 5; @@ -212,12 +212,14 @@ static void sunkbd_reinit(struct work_struct *work) wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ); - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, - (!!test_bit(LED_CAPSL, sunkbd->dev->led) << 3) | (!!test_bit(LED_SCROLLL, sunkbd->dev->led) << 2) | - (!!test_bit(LED_COMPOSE, sunkbd->dev->led) << 1) | !!test_bit(LED_NUML, sunkbd->dev->led)); - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - !!test_bit(SND_CLICK, sunkbd->dev->snd)); - sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_BELLOFF - !!test_bit(SND_BELL, sunkbd->dev->snd)); + serio_write(sunkbd->serio, SUNKBD_CMD_SETLED); + serio_write(sunkbd->serio, + (!!test_bit(LED_CAPSL, sunkbd->dev->led) << 3) | + (!!test_bit(LED_SCROLLL, sunkbd->dev->led) << 2) | + (!!test_bit(LED_COMPOSE, sunkbd->dev->led) << 1) | + !!test_bit(LED_NUML, sunkbd->dev->led)); + serio_write(sunkbd->serio, SUNKBD_CMD_NOCLICK - !!test_bit(SND_CLICK, sunkbd->dev->snd)); + serio_write(sunkbd->serio, SUNKBD_CMD_BELLOFF - !!test_bit(SND_BELL, sunkbd->dev->snd)); } static void sunkbd_enable(struct sunkbd *sunkbd, int enable) |