Commit 3c42f0c3 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

[PATCH] drivers/input/keyboard: convert to dynamic input_dev allocation

Input: convert drivers/input/keyboard to dynamic input_dev allocation

This is required for input_dev sysfs integration
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2e5b636b
......@@ -155,10 +155,7 @@ static const char *amikbd_messages[8] = {
[7] = KERN_WARNING "amikbd: keyboard interrupt\n"
};
static struct input_dev amikbd_dev;
static char *amikbd_name = "Amiga keyboard";
static char *amikbd_phys = "amikbd/input0";
static struct input_dev *amikbd_dev;
static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
......@@ -176,16 +173,16 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp)
scancode = amikbd_keycode[scancode];
input_regs(&amikbd_dev, fp);
input_regs(amikbd_dev, fp);
if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
input_report_key(&amikbd_dev, scancode, 1);
input_report_key(&amikbd_dev, scancode, 0);
input_sync(&amikbd_dev);
input_report_key(amikbd_dev, scancode, 1);
input_report_key(amikbd_dev, scancode, 0);
} else {
input_report_key(&amikbd_dev, scancode, down);
input_sync(&amikbd_dev);
input_report_key(amikbd_dev, scancode, down);
}
input_sync(amikbd_dev);
} else /* scancodes >= 0x78 are error codes */
printk(amikbd_messages[scancode - 0x78]);
......@@ -202,39 +199,41 @@ static int __init amikbd_init(void)
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
init_input_dev(&amikbd_dev);
amikbd_dev = input_dev_allocate();
if (!amikbd_dev) {
printk(KERN_ERR "amikbd: not enough memory for input device\n");
release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
return -ENOMEM;
}
amikbd_dev->name = "Amiga Keyboard";
amikbd_dev->phys = "amikbd/input0";
amikbd_dev->id.bustype = BUS_AMIGA;
amikbd_dev->id.vendor = 0x0001;
amikbd_dev->id.product = 0x0001;
amikbd_dev->id.version = 0x0100;
amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev.keycode = amikbd_keycode;
amikbd_dev.keycodesize = sizeof(unsigned char);
amikbd_dev.keycodemax = ARRAY_SIZE(amikbd_keycode);
amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev->keycode = amikbd_keycode;
amikbd_dev->keycodesize = sizeof(unsigned char);
amikbd_dev->keycodemax = ARRAY_SIZE(amikbd_keycode);
for (i = 0; i < 0x78; i++)
if (amikbd_keycode[i])
set_bit(amikbd_keycode[i], amikbd_dev.keybit);
set_bit(amikbd_keycode[i], amikbd_dev->keybit);
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt);
amikbd_dev.name = amikbd_name;
amikbd_dev.phys = amikbd_phys;
amikbd_dev.id.bustype = BUS_AMIGA;
amikbd_dev.id.vendor = 0x0001;
amikbd_dev.id.product = 0x0001;
amikbd_dev.id.version = 0x0100;
input_register_device(&amikbd_dev);
printk(KERN_INFO "input: %s\n", amikbd_name);
input_register_device(amikbd_dev);
return 0;
}
static void __exit amikbd_exit(void)
{
input_unregister_device(&amikbd_dev);
free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt);
release_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100);
input_unregister_device(amikbd_dev);
release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
}
module_init(amikbd_init);
......
This diff is collapsed.
......@@ -70,8 +70,7 @@ static unsigned char corgikbd_keycode[NR_SCANCODES] = {
struct corgikbd {
unsigned char keycode[ARRAY_SIZE(corgikbd_keycode)];
struct input_dev input;
char phys[32];
struct input_dev *input;
spinlock_t lock;
struct timer_list timer;
......@@ -147,7 +146,7 @@ static void corgikbd_scankeyboard(struct corgikbd *corgikbd_data, struct pt_regs
spin_lock_irqsave(&corgikbd_data->lock, flags);
if (regs)
input_regs(&corgikbd_data->input, regs);
input_regs(corgikbd_data->input, regs);
num_pressed = 0;
for (col = 0; col < KB_COLS; col++) {
......@@ -169,14 +168,14 @@ static void corgikbd_scankeyboard(struct corgikbd *corgikbd_data, struct pt_regs
scancode = SCANCODE(row, col);
pressed = rowd & KB_ROWMASK(row);
input_report_key(&corgikbd_data->input, corgikbd_data->keycode[scancode], pressed);
input_report_key(corgikbd_data->input, corgikbd_data->keycode[scancode], pressed);
if (pressed)
num_pressed++;
if (pressed && (corgikbd_data->keycode[scancode] == CORGI_KEY_OFF)
&& time_after(jiffies, corgikbd_data->suspend_jiffies + HZ)) {
input_event(&corgikbd_data->input, EV_PWR, CORGI_KEY_OFF, 1);
input_event(corgikbd_data->input, EV_PWR, CORGI_KEY_OFF, 1);
corgikbd_data->suspend_jiffies=jiffies;
}
}
......@@ -185,7 +184,7 @@ static void corgikbd_scankeyboard(struct corgikbd *corgikbd_data, struct pt_regs
corgikbd_activate_all();
input_sync(&corgikbd_data->input);
input_sync(corgikbd_data->input);
/* if any keys are pressed, enable the timer */
if (num_pressed)
......@@ -249,9 +248,9 @@ static void corgikbd_hinge_timer(unsigned long data)
if (hinge_count >= HINGE_STABLE_COUNT) {
spin_lock_irqsave(&corgikbd_data->lock, flags);
input_report_switch(&corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0));
input_report_switch(&corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0));
input_sync(&corgikbd_data->input);
input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0));
input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0));
input_sync(corgikbd_data->input);
spin_unlock_irqrestore(&corgikbd_data->lock, flags);
}
......@@ -287,16 +286,21 @@ static int corgikbd_resume(struct device *dev, uint32_t level)
static int __init corgikbd_probe(struct device *dev)
{
int i;
struct corgikbd *corgikbd;
struct input_dev *input_dev;
int i;
corgikbd = kzalloc(sizeof(struct corgikbd), GFP_KERNEL);
if (!corgikbd)
input_dev = input_allocate_device();
if (!corgikbd || !input_dev) {
kfree(corgikbd);
input_free_device(input_dev);
return -ENOMEM;
}
dev_set_drvdata(dev,corgikbd);
strcpy(corgikbd->phys, "corgikbd/input0");
dev_set_drvdata(dev, corgikbd);
corgikbd->input = input_dev;
spin_lock_init(&corgikbd->lock);
/* Init Keyboard rescan timer */
......@@ -311,28 +315,30 @@ static int __init corgikbd_probe(struct device *dev)
corgikbd->suspend_jiffies=jiffies;
init_input_dev(&corgikbd->input);
corgikbd->input.private = corgikbd;
corgikbd->input.name = "Corgi Keyboard";
corgikbd->input.dev = dev;
corgikbd->input.phys = corgikbd->phys;
corgikbd->input.id.bustype = BUS_HOST;
corgikbd->input.id.vendor = 0x0001;
corgikbd->input.id.product = 0x0001;
corgikbd->input.id.version = 0x0100;
corgikbd->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
corgikbd->input.keycode = corgikbd->keycode;
corgikbd->input.keycodesize = sizeof(unsigned char);
corgikbd->input.keycodemax = ARRAY_SIZE(corgikbd_keycode);
memcpy(corgikbd->keycode, corgikbd_keycode, sizeof(corgikbd->keycode));
input_dev->name = "Corgi Keyboard";
input_dev->phys = "corgikbd/input0";
input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev;
input_dev->private = corgikbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
input_dev->keycode = corgikbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodemax = ARRAY_SIZE(corgikbd_keycode);
for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++)
set_bit(corgikbd->keycode[i], corgikbd->input.keybit);
clear_bit(0, corgikbd->input.keybit);
set_bit(SW_0, corgikbd->input.swbit);
set_bit(SW_1, corgikbd->input.swbit);
set_bit(corgikbd->keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
set_bit(SW_0, input_dev->swbit);
set_bit(SW_1, input_dev->swbit);
input_register_device(corgikbd->input);
input_register_device(&corgikbd->input);
mod_timer(&corgikbd->htimer, jiffies + HINGE_SCAN_INTERVAL);
/* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
......@@ -349,8 +355,6 @@ static int __init corgikbd_probe(struct device *dev)
for (i = 0; i < CORGI_KEY_STROBE_NUM; i++)
pxa_gpio_mode(CORGI_GPIO_KEY_STROBE(i) | GPIO_OUT | GPIO_DFLT_HIGH);
printk(KERN_INFO "input: Corgi Keyboard Registered\n");
return 0;
}
......@@ -365,7 +369,7 @@ static int corgikbd_remove(struct device *dev)
del_timer_sync(&corgikbd->htimer);
del_timer_sync(&corgikbd->timer);
input_unregister_device(&corgikbd->input);
input_unregister_device(corgikbd->input);
kfree(corgikbd);
......
......@@ -102,7 +102,7 @@ static int ctrlclick_volume = 100; /* % */
module_param (ctrlclick_volume, int, 0);
MODULE_PARM_DESC (ctrlclick_volume, "Ctrlclick volume (in %), default is 100%");
static int lk201_compose_is_alt = 0;
static int lk201_compose_is_alt;
module_param (lk201_compose_is_alt, int, 0);
MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key "
"will act as an Alt key");
......@@ -274,7 +274,7 @@ static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = {
};
#define CHECK_LED(LED, BITS) do { \
if (test_bit (LED, lk->dev.led)) \
if (test_bit (LED, lk->dev->led)) \
leds_on |= BITS; \
else \
leds_off |= BITS; \
......@@ -287,7 +287,7 @@ struct lkkbd {
lk_keycode_t keycode[LK_NUM_KEYCODES];
int ignore_bytes;
unsigned char id[LK_NUM_IGNORE_BYTES];
struct input_dev dev;
struct input_dev *dev;
struct serio *serio;
struct work_struct tq;
char name[64];
......@@ -423,8 +423,7 @@ lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags,
DBG (KERN_INFO "Got byte 0x%02x\n", data);
if (lk->ignore_bytes > 0) {
DBG (KERN_INFO "Ignoring a byte on %s\n",
lk->name);
DBG (KERN_INFO "Ignoring a byte on %s\n", lk->name);
lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
if (lk->ignore_bytes == 0)
......@@ -435,14 +434,14 @@ lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags,
switch (data) {
case LK_ALL_KEYS_UP:
input_regs (&lk->dev, regs);
input_regs (lk->dev, regs);
for (i = 0; i < ARRAY_SIZE (lkkbd_keycode); i++)
if (lk->keycode[i] != KEY_RESERVED)
input_report_key (&lk->dev, lk->keycode[i], 0);
input_sync (&lk->dev);
input_report_key (lk->dev, lk->keycode[i], 0);
input_sync (lk->dev);
break;
case LK_METRONOME:
DBG (KERN_INFO "Got LK_METRONOME and don't "
DBG (KERN_INFO "Got %#d and don't "
"know how to handle...\n");
break;
case LK_OUTPUT_ERROR:
......@@ -482,12 +481,12 @@ lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags,
default:
if (lk->keycode[data] != KEY_RESERVED) {
input_regs (&lk->dev, regs);
if (!test_bit (lk->keycode[data], lk->dev.key))
input_report_key (&lk->dev, lk->keycode[data], 1);
input_regs (lk->dev, regs);
if (!test_bit (lk->keycode[data], lk->dev->key))
input_report_key (lk->dev, lk->keycode[data], 1);
else
input_report_key (&lk->dev, lk->keycode[data], 0);
input_sync (&lk->dev);
input_report_key (lk->dev, lk->keycode[data], 0);
input_sync (lk->dev);
} else
printk (KERN_WARNING "%s: Unknown key with "
"scancode 0x%02x on %s.\n",
......@@ -605,7 +604,7 @@ lkkbd_reinit (void *data)
lk->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)) {
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);
......@@ -616,7 +615,7 @@ lkkbd_reinit (void *data)
}
/* Sound the bell if needed */
if (test_bit (SND_BELL, lk->dev.snd))
if (test_bit (SND_BELL, lk->dev->snd))
lk->serio->write (lk->serio, LK_CMD_SOUND_BELL);
}
......@@ -627,71 +626,70 @@ static int
lkkbd_connect (struct serio *serio, struct serio_driver *drv)
{
struct lkkbd *lk;
struct input_dev *input_dev;
int i;
int err;
if (!(lk = kmalloc (sizeof (struct lkkbd), GFP_KERNEL)))
return -ENOMEM;
memset (lk, 0, sizeof (struct lkkbd));
init_input_dev (&lk->dev);
set_bit (EV_KEY, lk->dev.evbit);
set_bit (EV_LED, lk->dev.evbit);
set_bit (EV_SND, lk->dev.evbit);
set_bit (EV_REP, lk->dev.evbit);
set_bit (LED_CAPSL, lk->dev.ledbit);
set_bit (LED_SLEEP, lk->dev.ledbit);
set_bit (LED_COMPOSE, lk->dev.ledbit);
set_bit (LED_SCROLLL, lk->dev.ledbit);
set_bit (SND_BELL, lk->dev.sndbit);
set_bit (SND_CLICK, lk->dev.sndbit);
lk = kzalloc (sizeof (struct lkkbd), GFP_KERNEL);
input_dev = input_allocate_device ();
if (!lk || !input_dev) {
err = -ENOMEM;
goto fail;
}
lk->serio = serio;
lk->dev = input_dev;
INIT_WORK (&lk->tq, lkkbd_reinit, lk);
lk->bell_volume = bell_volume;
lk->keyclick_volume = keyclick_volume;
lk->ctrlclick_volume = ctrlclick_volume;
memcpy (lk->keycode, lkkbd_keycode, sizeof (lk_keycode_t) * LK_NUM_KEYCODES);
lk->dev.keycode = lk->keycode;
lk->dev.keycodesize = sizeof (lk_keycode_t);
lk->dev.keycodemax = LK_NUM_KEYCODES;
lk->dev.event = lkkbd_event;
lk->dev.private = lk;
strlcpy (lk->name, "DEC LK keyboard", sizeof(lk->name));
snprintf (lk->phys, sizeof(lk->phys), "%s/input0", serio->phys);
input_dev->name = lk->name;
input_dev->phys = lk->phys;
input_dev->id.bustype = BUS_RS232;
input_dev->id.vendor = SERIO_LKKBD;
input_dev->id.product = 0;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->event = lkkbd_event;
input_dev->private = lk;
set_bit (EV_KEY, input_dev->evbit);
set_bit (EV_LED, input_dev->evbit);
set_bit (EV_SND, input_dev->evbit);
set_bit (EV_REP, input_dev->evbit);
set_bit (LED_CAPSL, input_dev->ledbit);
set_bit (LED_SLEEP, input_dev->ledbit);
set_bit (LED_COMPOSE, input_dev->ledbit);
set_bit (LED_SCROLLL, input_dev->ledbit);
set_bit (SND_BELL, input_dev->sndbit);
set_bit (SND_CLICK, input_dev->sndbit);
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);
serio_set_drvdata (serio, lk);
err = serio_open (serio, drv);
if (err) {
serio_set_drvdata (serio, NULL);
kfree (lk);
return err;
}
sprintf (lk->name, "DEC LK keyboard");
sprintf (lk->phys, "%s/input0", serio->phys);
memcpy (lk->keycode, lkkbd_keycode, sizeof (lk_keycode_t) * LK_NUM_KEYCODES);
for (i = 0; i < LK_NUM_KEYCODES; i++)
set_bit (lk->keycode[i], lk->dev.keybit);
if (err)
goto fail;
lk->dev.name = lk->name;
lk->dev.phys = lk->phys;
lk->dev.id.bustype = BUS_RS232;
lk->dev.id.vendor = SERIO_LKKBD;
lk->dev.id.product = 0;
lk->dev.id.version = 0x0100;
lk->dev.dev = &serio->dev;
input_register_device (&lk->dev);
printk (KERN_INFO "input: %s on %s, initiating reset\n", lk->name, serio->phys);
input_register_device (lk->dev);
lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET);
return 0;
fail: serio_set_drvdata (serio, NULL);
input_free_device (input_dev);
kfree (lk);
return err;
}
/*
......@@ -702,9 +700,11 @@ lkkbd_disconnect (struct serio *serio)
{
struct lkkbd *lk = serio_get_drvdata (serio);
input_unregister_device (&lk->dev);
input_get_device (lk->dev);
input_unregister_device (lk->dev);
serio_close (serio);
serio_set_drvdata (serio, NULL);
input_put_device (lk->dev);
kfree (lk);
}
......
......@@ -37,7 +37,7 @@ static unsigned char dc_kbd_keycode[256] = {
struct dc_kbd {
struct input_dev dev;
struct input_dev *dev;
unsigned char new[8];
unsigned char old[8];
};
......@@ -46,30 +46,24 @@ struct dc_kbd {
static void dc_scan_kbd(struct dc_kbd *kbd)
{
int i;
struct input_dev *dev = &kbd->dev;
struct input_dev *dev = kbd->dev;
for(i=0; i<8; i++)
input_report_key(dev,
dc_kbd_keycode[i+224],
(kbd->new[0]>>i)&1);
for (i = 0; i < 8; i++)
input_report_key(dev, dc_kbd_keycode[i + 224], (kbd->new[0] >> i) & 1);
for(i=2; i<8; i++) {
for (i = 2; i < 8; i++) {
if(kbd->old[i]>3&&memscan(kbd->new+2, kbd->old[i], 6)==NULL) {
if(dc_kbd_keycode[kbd->old[i]])
input_report_key(dev,
dc_kbd_keycode[kbd->old[i]],
0);
if (kbd->old[i] > 3 && memscan(kbd->new + 2, kbd->old[i], 6) == NULL) {
if (dc_kbd_keycode[kbd->old[i]])
input_report_key(dev, dc_kbd_keycode[kbd->old[i]], 0);
else
printk("Unknown key (scancode %#x) released.",
kbd->old[i]);
}
if(kbd->new[i]>3&&memscan(kbd->old+2, kbd->new[i], 6)!=NULL) {
if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) != NULL) {
if(dc_kbd_keycode[kbd->new[i]])
input_report_key(dev,
dc_kbd_keycode[kbd->new[i]],
1);
input_report_key(dev, dc_kbd_keycode[kbd->new[i]], 1);
else
printk("Unknown key (scancode %#x) pressed.",
kbd->new[i]);
......@@ -89,43 +83,39 @@ static void dc_kbd_callback(struct mapleq *mq)
unsigned long *buf = mq->recvbuf;
if (buf[1] == mapledev->function) {
memcpy(kbd->new, buf+2, 8);
memcpy(kbd->new, buf + 2, 8);
dc_scan_kbd(kbd);
}
}
static int dc_kbd_connect(struct maple_device *dev)
{
int i;
unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]);
struct dc_kbd *kbd;
struct input_dev *input_dev;
unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]);
int i;
if (!(kbd = kmalloc(sizeof(struct dc_kbd), GFP_KERNEL)))
return -1;
memset(kbd, 0, sizeof(struct dc_kbd));
dev->private_data = kbd;
kbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
init_input_dev(&kbd->dev);
for (i=0; i<255; i++)
set_bit(dc_kbd_keycode[i], kbd->dev.keybit);
clear_bit(0, kbd->dev.keybit);
dev->private_data = kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbd || !input_dev) {
kfree(kbd);
input_free_device(input_dev);
return -ENOMEM;
}
kbd->dev.private = kbd;
kbd->dev = input_dev;
kbd->dev.name = dev->product_name;
kbd->dev.id.bustype = BUS_MAPLE;
input_dev->name = dev->product_name;
input_dev->id.bustype = BUS_MAPLE;
input_dev->private = kbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
for (i = 0; i < 255; i++)
set_bit(dc_kbd_keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
input_register_device(&kbd->dev);
input_register_device(kbd->dev);
maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD);
printk(KERN_INFO "input: keyboard(0x%lx): %s\n", data, kbd->dev.name);
return 0;
}
......@@ -134,7 +124,7 @@ static void dc_kbd_disconnect(struct maple_device *dev)
{
struct dc_kbd *kbd = dev->private_data;
input_unregister_device(&kbd->dev);
input_unregister_device(kbd->dev);
kfree(kbd);
}
......
......@@ -57,11 +57,9 @@ static unsigned char nkbd_keycode[128] = {
KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_UP, 0
};
static char *nkbd_name = "Newton Keyboard";
struct nkbd {
unsigned char keycode[128];
struct input_dev dev;
struct input_dev *dev;
struct serio *serio;
char phys[32];
};
......@@ -73,13 +71,13 @@ static irqreturn_t nkbd_interrupt(struct serio *serio,
/* invalid scan codes are probably the init sequence, so we ignore them */
if (nkbd->keycode[data & NKBD_KEY]) {
input_regs(&nkbd->dev, regs);
input_report_key(&nkbd->dev, nkbd->keycode[data & NKBD_KEY], data & NKBD_PRESS);
input_sync(&nkbd->dev);
input_regs(nkbd->dev, regs);
input_report_key(nkbd->dev, nkbd->keycode[data & NKBD_KEY], data & NKBD_PRESS);
input_sync(nkbd->dev);
}
else if (data == 0xe7) /* end of init sequence */
printk(KERN_INFO "input: %s on %s\n", nkbd_name, serio->phys);
printk(KERN_INFO "input: %s on %s\n", nkbd->dev->name, serio->phys);
return IRQ_HANDLED;
}
......@@ -87,62 +85,59 @@ static irqreturn_t nkbd_interrupt(struct serio *serio,
static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct nkbd *nkbd;
struct input_dev *input_dev;
int err = -ENOMEM;
int i;
int err;
if (!(nkbd = kmalloc(sizeof(struct nkbd), GFP_KERNEL)))
return -ENOMEM;
memset(nkbd, 0, sizeof(struct nkbd));
nkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
nkbd = kzalloc(sizeof(struct nkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!nkbd || !input_dev)
goto fail;
nkbd->serio = serio;
nkbd->dev = input_dev;
sprintf(nkbd->phys, "%s/input0", serio->phys);
memcpy(nkbd->keycode, nkbd_keycode, sizeof(nkbd->keycode));
init_input_dev(&nkbd->dev);
nkbd->dev.keycode = nkbd->keycode;
nkbd->dev.keycodesize = sizeof(unsigned char);
nkbd->dev.keycodemax = ARRAY_SIZE(nkbd_keycode);
nkbd->dev.private = nkbd;
input_dev->name = "Newton Keyboard";
input_dev->phys = nkbd->phys;
input_dev->id.bustype = BUS_RS232;
input_dev->id.vendor = SERIO_NEWTON;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = nkbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = nkbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodemax = ARRAY_SIZE(nkbd_keycode);
for (i = 0; i < 128; i++)
set_bit(nkbd->keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
serio_set_drvdata(serio, nkbd);
err = serio_open(serio, drv);
if (err) {
serio_set_drvdata(serio, NULL);
kfree(nkbd);
return err;
}
memcpy(nkbd->keycode, nkbd_keycode, sizeof(nkbd->keycode));
for (i = 0; i < 128; i++)
set_bit(nkbd->keycode[i], nkbd->dev.keybit);
clear_bit(0, nkbd->dev.keybit);
sprintf(nkbd->phys, "%s/input0", serio->phys);
nkbd->dev.name = nkbd_name;
nkbd->dev.phys = nkbd->phys;
nkbd->dev.id.bustype = BUS_RS232;
nkbd->dev.id.vendor = SERIO_NEWTON;
nkbd->dev.id.product = 0x0001;
nkbd->dev.id.version = 0x0100;
nkbd->dev.dev = &serio->dev;
input_register_device(&nkbd->dev);
printk(KERN_INFO "input: %s on %s\n", nkbd_name, serio->phys);
if (err)
goto fail;
input_register_device(nkbd->dev);
return 0;
fail: serio_set_drvdata(serio, NULL);
input_free_device(input_dev);
kfree(nkbd);
return err;
}
static void nkbd_disconnect(struct serio *serio)
{
struct nkbd *nkbd = serio_get_drvdata(serio);
input_unregister_device(&nkbd->dev);
serio_close(serio);
serio_set_drvdata(serio, NULL);
input_unregister_device(nkbd->dev);
kfree(nkbd);
}
......
......@@ -85,7 +85,7 @@ static int spitz_senses[] = {
struct spitzkbd {
unsigned char keycode[ARRAY_SIZE(spitzkbd_keycode)];
struct input_dev input;
struct input_dev *input;
char phys[32];
spinlock_t lock;
......@@ -187,8 +187,7 @@ static void spitzkbd_scankeyboard(struct spitzkbd *spitzkbd_data, struct pt_regs
spin_lock_irqsave(&spitzkbd_data->lock, flags);
if (regs)
input_regs(&spitzkbd_data->input, regs);
input_regs(spitzkbd_data->input, regs);
num_pressed = 0;
for (col = 0; col < KB_COLS; col++) {
......@@ -210,7 +209,7 @@ static void spitzkbd_scankeyboard(struct spitzkbd *spitzkbd_data, struct pt_regs
scancode = SCANCODE(row, col);
pressed = rowd & KB_ROWMASK(row);
input_report_key(&spitzkbd_data->input, spitzkbd_data->keycode[scancode], pressed);
input_report_key(spitzkbd_data->input, spitzkbd_data->keycode[scancode], pressed);
if (pressed)
num_pressed++;
......@@ -220,15 +219,15 @@ static void spitzkbd_scankeyboard(struct spitzkbd *spitzkbd_data, struct pt_regs
spitzkbd_activate_all();
input_report_key(&spitzkbd_data->input, SPITZ_KEY_SYNC, (GPLR(SPITZ_GPIO_SYNC) & GPIO_bit(SPITZ_GPIO_SYNC)) != 0 );
input_report_key(&spitzkbd_data->input, KEY_SUSPEND, pwrkey);
input_report_key(spitzkbd_data->input, SPITZ_KEY_SYNC, (GPLR(SPITZ_GPIO_SYNC) & GPIO_bit(SPITZ_GPIO_SYNC)) != 0 );
input_report_key(spitzkbd_data->input, KEY_SUSPEND, pwrkey);
if (pwrkey && time_after(jiffies, spitzkbd_data->suspend_jiffies + msecs_to_jiffies(1000))) {
input_event(&spitzkbd_data->input, EV_PWR, KEY_SUSPEND, 1);
input_event(spitzkbd_data->input, EV_PWR, KEY_SUSPEND, 1);
spitzkbd_data->suspend_jiffies = jiffies;
}
input_sync(&spitzkbd_data->input);
input_sync(spitzkbd_data->input);
/* if any keys are pressed, enable the timer */
if (num_pressed)
......@@ -259,6 +258,7 @@ static irqreturn_t spitzkbd_interrupt(int irq, void *dev_id, struct pt_regs *reg
static void spitzkbd_timer_callback(unsigned long data)
{
struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data;
spitzkbd_scankeyboard(spitzkbd_data, NULL);
}
......@@ -298,9 +298,9 @@ static void spitzkbd_hinge_timer(unsigned long data)
if (hinge_count >= HINGE_STABLE_COUNT) {
spin_lock_irqsave(&spitzkbd_data->lock, flags);
input_report_switch(&spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
input_report_switch(&spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
input_sync(&spitzkbd_data->input);
input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
input_sync(spitzkbd_data->input);
spin_unlock_irqrestore(&spitzkbd_data->lock, flags);
} else {
......@@ -346,14 +346,21 @@ static int spitzkbd_resume(struct device *dev, uint32_t level)
static int __init spitzkbd_probe(struct device *dev)
{
int i;
struct spitzkbd *spitzkbd;
struct input_dev *input_dev;
int i;
spitzkbd = kzalloc(sizeof(struct spitzkbd), GFP_KERNEL);
if (!spitzkbd)
return -ENOMEM;
dev_set_drvdata(dev,spitzkbd);
input_dev = input_allocate_device();
if (!input_dev) {
kfree(spitzkbd);
return -ENOMEM;
}
dev_set_drvdata(dev, spitzkbd);
strcpy(spitzkbd->phys, "spitzkbd/input0");
spin_lock_init(&spitzkbd->lock);
......@@ -368,30 +375,34 @@ static int __init spitzkbd_probe(struct device *dev)
spitzkbd->htimer.function = spitzkbd_hinge_timer;
spitzkbd->htimer.data = (unsigned long) spitzkbd;
spitzkbd->suspend_jiffies=jiffies;
init_input_dev(&spitzkbd->input);
spitzkbd->input.private = spitzkbd;
spitzkbd->input.name = "Spitz Keyboard";
spitzkbd->input.dev = dev;
spitzkbd->input.phys = spitzkbd->phys;
spitzkbd->input.id.bustype = BUS_HOST;
spitzkbd->input.id.vendor = 0x0001;
spitzkbd->input.id.product = 0x0001;
spitzkbd->input.id.version = 0x0100;
spitzkbd->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
spitzkbd->input.keycode = spitzkbd->keycode;
spitzkbd->input.keycodesize = sizeof(unsigned char);
spitzkbd->input.keycodemax = ARRAY_SIZE(spitzkbd_keycode);
spitzkbd->suspend_jiffies = jiffies;
spitzkbd->input = input_dev;
input_dev->private = spitzkbd;
input_dev->name = "Spitz Keyboard";
input_dev->phys = spitzkbd->phys;
input_dev->cdev.dev = dev;
input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
input_dev->keycode = spitzkbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodemax = ARRAY_SIZE(spitzkbd_keycode);
memcpy(spitzkbd->keycode, spitzkbd_keycode, sizeof(spitzkbd->keycode));
for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
set_bit(spitzkbd->keycode[i], spitzkbd->input.keybit);
clear_bit(0, spitzkbd->input.keybit);
set_bit(SW_0, spitzkbd->input.swbit);
set_bit(SW_1, spitzkbd->input.swbit);
set_bit(spitzkbd->keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
set_bit(SW_0, input_dev->swbit);
set_bit(SW_1, input_dev->swbit);
input_register_device(input_dev);
input_register_device(&spitzkbd->input);
mod_timer(&spitzkbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
/* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
......@@ -444,7 +455,7 @@ static int spitzkbd_remove(struct device *dev)
del_timer_sync(&spitzkbd->htimer);
del_timer_sync(&spitzkbd->timer);
input_unregister_device(&spitzkbd->input);
input_unregister_device(spitzkbd->input);
kfree(spitzkbd);
......
......@@ -76,13 +76,14 @@ static unsigned char sunkbd_keycode[128] = {
struct sunkbd {
unsigned char keycode[128];
struct input_dev dev;
struct input_dev *dev;
struct serio *serio;
struct work_struct tq;
wait_queue_head_t wait;
char name[64];
char phys[32];
char type;
unsigned char enabled;
volatile s8 reset;
volatile s8 layout;
};
......@@ -124,10 +125,13 @@ static irqreturn_t sunkbd_interrupt(struct serio *serio,
break;
default:
if (!sunkbd->enabled)
break;
if (sunkbd->keycode[data & SUNKBD_KEY]) {
input_regs(&sunkbd->dev, regs);
input_report_key(&sunkbd->dev, sunkbd->keycode[data & SUNKBD_KEY], !(data & SUNKBD_RELEASE));
input_sync(&sunkbd->dev);
input_regs(sunkbd->dev, regs);
input_report_key(sunkbd->dev, sunkbd->keycode[data & SUNKBD_KEY], !(data & SUNKBD_RELEASE));
input_sync(sunkbd->dev);
} else {
printk(KERN_WARNING "sunkbd.c: Unknown key (scancode %#x) %s.\n",
data & SUNKBD_KEY, data & SUNKBD_RELEASE ? "released" : "pressed");
......@@ -184,7 +188,7 @@ static int sunkbd_initialize(struct sunkbd *sunkbd)
sunkbd->reset = -2;
sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_RESET);
wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ);
if (sunkbd->reset <0)
if (sunkbd->reset < 0)
return -1;
sunkbd->type = sunkbd->reset;
......@@ -213,10 +217,17 @@ static void sunkbd_reinit(void *data)
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));
(!!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));
}
static void sunkbd_enable(struct sunkbd *sunkbd, int enable)
{
serio_pause_rx(sunkbd->serio);
sunkbd->enabled = 1;
serio_continue_rx(sunkbd->serio);
}
/*
......@@ -226,70 +237,64 @@ static void sunkbd_reinit(void *data)
static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct sunkbd *sunkbd;
struct input_dev *input_dev;
int err = -ENOMEM;
int i;
int err;
if (!(sunkbd = kmalloc(sizeof(struct sunkbd), GFP_KERNEL)))
return -ENOMEM;
memset(sunkbd, 0, sizeof(struct sunkbd));
init_input_dev(&sunkbd->dev);
init_waitqueue_head(&sunkbd->wait);
sunkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP);
sunkbd->dev.ledbit[0] = BIT(LED_CAPSL) | BIT(LED_COMPOSE) | BIT(LED_SCROLLL) | BIT(LED_NUML);
sunkbd->dev.sndbit[0] = BIT(SND_CLICK) | BIT(SND_BELL);
sunkbd = kzalloc(sizeof(struct sunkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!sunkbd || !input_dev)
goto fail;
sunkbd->serio = serio;
sunkbd->dev = input_dev;
init_waitqueue_head(&sunkbd->wait);
INIT_WORK(&sunkbd->tq, sunkbd_reinit, sunkbd);
sunkbd->dev.keycode = sunkbd->keycode;
sunkbd->dev.keycodesize = sizeof(unsigned char);
sunkbd->dev.keycodemax = ARRAY_SIZE(sunkbd_keycode);
sunkbd->dev.event = sunkbd_event;
sunkbd->dev.private = sunkbd;
snprintf(sunkbd->phys, sizeof(sunkbd->phys), "%s/input0", serio->phys);
serio_set_drvdata(serio, sunkbd);
err = serio_open(serio, drv);
if (err) {
serio_set_drvdata(serio, NULL);
kfree(sunkbd);
return err;
}
if (err)
goto fail;
if (sunkbd_initialize(sunkbd) < 0) {
serio_close(serio);
serio_set_drvdata(serio, NULL);
kfree(sunkbd);
return -ENODEV;
goto fail;
}
sprintf(sunkbd->name, "Sun Type %d keyboard", sunkbd->type);
memcpy(sunkbd->keycode, sunkbd_keycode, sizeof(sunkbd->keycode));
for (i = 0; i < 128; i++)
set_bit(sunkbd->keycode[i], sunkbd->dev.keybit);
clear_bit(0, sunkbd->dev.keybit);
sprintf(sunkbd->phys, "%s/input0", serio->phys);
sunkbd->dev.name = sunkbd->name;
sunkbd->dev.phys = sunkbd->phys;
sunkbd->dev.id.bustype = BUS_RS232;
sunkbd->dev.id.vendor = SERIO_SUNKBD;
sunkbd->dev.id.product = sunkbd->type;
sunkbd->dev.id.version = 0x0100;
sunkbd->dev.dev = &serio->dev;
input_register_device(&sunkbd->dev);
printk(KERN_INFO "input: %s on %s\n", sunkbd->name, serio->phys);
input_dev->name = sunkbd->name;
input_dev->phys = sunkbd->phys;
input_dev->id.bustype = BUS_RS232;
input_dev->id.vendor = SERIO_SUNKBD;
input_dev->id.product = sunkbd->type;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = sunkbd;
input_dev->event = sunkbd_event;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP);
input_dev->ledbit[0] = BIT(LED_CAPSL) | BIT(LED_COMPOSE) | BIT(LED_SCROLLL) | BIT(LED_NUML);
input_dev->sndbit[0] = BIT(SND_CLICK) | BIT(SND_BELL);
input_dev->keycode = sunkbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodemax = ARRAY_SIZE(sunkbd_keycode);
for (i = 0; i < 128; i++)
set_bit(sunkbd->keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
sunkbd_enable(sunkbd, 1);
input_register_device(sunkbd->dev);
return 0;
fail: serio_set_drvdata(serio, NULL);
input_free_device(input_dev);
kfree(sunkbd);
return err;
}
/*
......@@ -299,7 +304,9 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
static void sunkbd_disconnect(struct serio *serio)
{
struct sunkbd *sunkbd = serio_get_drvdata(serio);
input_unregister_device(&sunkbd->dev);
sunkbd_enable(sunkbd, 0);
input_unregister_device(sunkbd->dev);
serio_close(serio);
serio_set_drvdata(serio, NULL);
kfree(sunkbd);
......
......@@ -56,11 +56,9 @@ static unsigned char xtkbd_keycode[256] = {
106
};
static char *xtkbd_name = "XT Keyboard";
struct xtkbd {
unsigned char keycode[256];
struct input_dev dev;
struct input_dev *dev;
struct serio *serio;
char phys[32];
};
......@@ -77,9 +75,9 @@ static irqreturn_t xtkbd_interrupt(struct serio *serio,
default:
if (xtkbd->keycode[data & XTKBD_KEY]) {
input_regs(&xtkbd->dev, regs);
input_report_key(&xtkbd->dev, xtkbd->keycode[data & XTKBD_KEY], !(data & XTKBD_RELEASE));
input_sync(&xtkbd->dev);
input_regs(xtkbd->dev, regs);
input_report_key(xtkbd->dev, xtkbd->keycode[data & XTKBD_KEY], !(data & XTKBD_RELEASE));
input_sync(xtkbd->dev);
} else {
printk(KERN_WARNING "xtkbd.c: Unknown key (scancode %#x) %s.\n",
data & XTKBD_KEY, data & XTKBD_RELEASE ? "released" : "pressed");
......@@ -91,62 +89,60 @@ static irqreturn_t xtkbd_interrupt(struct serio *serio,
static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct xtkbd *xtkbd;
struct input_dev *input_dev;
int err = -ENOMEM;
int i;
int err;
if (!(xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL)))
return -ENOMEM;
memset(xtkbd, 0, sizeof(struct xtkbd));
xtkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!xtkbd || !input_dev)
goto fail;
xtkbd->serio = serio;
xtkbd->dev = input_dev;
sprintf(xtkbd->phys, "%s/input0", serio->phys);
memcpy(xtkbd->keycode, xtkbd_keycode, sizeof(xtkbd->keycode));
init_input_dev(&xtkbd->dev);
xtkbd->dev.keycode = xtkbd->keycode;
xtkbd->dev.keycodesize = sizeof(unsigned char);
xtkbd->dev.keycodemax = ARRAY_SIZE(xtkbd_keycode);
xtkbd->dev.private = xtkbd;
input_dev->name = "XT Keyboard";
input_dev->phys = xtkbd->phys;
input_dev->id.bustype = BUS_XTKBD;
input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev;
input_dev->private = xtkbd;
serio_set_drvdata(serio, xtkbd);
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = xtkbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodemax = ARRAY_SIZE(xtkbd_keycode);
err = serio_open(serio, drv);
if (err) {
serio_set_drvdata(serio, NULL);
kfree(xtkbd);
return err;
}
memcpy(xtkbd->keycode, xtkbd_keycode, sizeof(xtkbd->keycode));
for (i = 0; i < 255; i++)
set_bit(xtkbd->keycode[i], xtkbd->dev.keybit);
clear_bit(0, xtkbd->dev.keybit);
sprintf(xtkbd->phys, "%s/input0", serio->phys);
xtkbd->dev.name = xtkbd_name;
xtkbd->dev.phys = xtkbd->phys;
xtkbd->dev.id.bustype = BUS_XTKBD;
xtkbd->dev.id.vendor = 0x0001;
xtkbd->dev.id.product = 0x0001;
xtkbd->dev.id.version = 0x0100;
xtkbd->dev.dev = &serio->dev;
set_bit(xtkbd->keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
input_register_device(&xtkbd->dev);
serio_set_drvdata(serio, xtkbd);
printk(KERN_INFO "input: %s on %s\n", xtkbd_name, serio->phys);
err = serio_open(serio, drv);
if (err)
goto fail;
input_register_device(xtkbd->dev);
return 0;
fail: serio_set_drvdata(serio, NULL);
input_free_device(input_dev);
kfree(xtkbd);
return err;
}
static void xtkbd_disconnect(struct serio *serio)
{
struct xtkbd *xtkbd = serio_get_drvdata(serio);
input_unregister_device(&xtkbd->dev);
serio_close(serio);
serio_set_drvdata(serio, NULL);
input_unregister_device(xtkbd->dev);
kfree(xtkbd);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment