diff --git a/[refs] b/[refs]
index 10ae5cd0f455..44fa010f3ca4 100644
--- a/[refs]
+++ b/[refs]
@@ -1,2 +1,2 @@
---
-refs/heads/master: 4bdbd2807deeccc0793d57fb5120d7a53f2c0b3c
+refs/heads/master: 59359ff87700f5e742c96a55da9cf0819984c128
diff --git a/trunk/Documentation/DocBook/kernel-api.tmpl b/trunk/Documentation/DocBook/kernel-api.tmpl
index a1af278f9901..a166675c4303 100644
--- a/trunk/Documentation/DocBook/kernel-api.tmpl
+++ b/trunk/Documentation/DocBook/kernel-api.tmpl
@@ -533,12 +533,4 @@ X!Idrivers/video/console/fonts.c
-->
-
-
- Input Subsystem
-!Iinclude/linux/input.h
-!Edrivers/input/input.c
-!Edrivers/input/ff-core.c
-!Edrivers/input/ff-memless.c
-
diff --git a/trunk/arch/sparc/kernel/entry.S b/trunk/arch/sparc/kernel/entry.S
index a4edff4c3be3..831f540251f8 100644
--- a/trunk/arch/sparc/kernel/entry.S
+++ b/trunk/arch/sparc/kernel/entry.S
@@ -32,13 +32,12 @@
#include
#include
#include
+#include
#include
#define curptr g6
-#define NR_SYSCALLS 300 /* Each OS is different... */
-
/* These are just handy. */
#define _SV save %sp, -STACKFRAME_SZ, %sp
#define _RS restore
diff --git a/trunk/arch/sparc/kernel/systbls.S b/trunk/arch/sparc/kernel/systbls.S
index 10df38eeae08..ea75ca569052 100644
--- a/trunk/arch/sparc/kernel/systbls.S
+++ b/trunk/arch/sparc/kernel/systbls.S
@@ -78,7 +78,7 @@ sys_call_table:
/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
-/*300*/ .long sys_set_robust_list, sys_get_robust_list
+/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages
#ifdef CONFIG_SUNOS_EMUL
/* Now the SunOS syscall table. */
@@ -190,6 +190,7 @@ sunos_sys_table:
/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys
.long sunos_nosys, sunos_nosys, sunos_nosys
.long sunos_nosys, sunos_nosys, sunos_nosys
- .long sunos_nosys, sunos_nosys, sunos_nosys
+ .long sunos_nosys
+/*300*/ .long sunos_nosys, sunos_nosys, sunos_nosys
#endif
diff --git a/trunk/arch/sparc64/kernel/entry.S b/trunk/arch/sparc64/kernel/entry.S
index 0aaa35fc5a9c..6f28bec0a9bf 100644
--- a/trunk/arch/sparc64/kernel/entry.S
+++ b/trunk/arch/sparc64/kernel/entry.S
@@ -22,11 +22,10 @@
#include
#include
#include
+#include
#define curptr g6
-#define NR_SYSCALLS 300 /* Each OS is different... */
-
.text
.align 32
diff --git a/trunk/arch/sparc64/kernel/systbls.S b/trunk/arch/sparc64/kernel/systbls.S
index 419a63fca172..9a8026797ac0 100644
--- a/trunk/arch/sparc64/kernel/systbls.S
+++ b/trunk/arch/sparc64/kernel/systbls.S
@@ -79,7 +79,7 @@ sys_call_table32:
.word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
.word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
-/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list
+/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages
#endif /* CONFIG_COMPAT */
@@ -149,7 +149,7 @@ sys_call_table:
.word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
.word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
-/*300*/ .word sys_set_robust_list, sys_get_robust_list
+/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages
#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -262,5 +262,7 @@ sunos_sys_table:
/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys
.word sunos_nosys, sunos_nosys, sunos_nosys
.word sunos_nosys, sunos_nosys, sunos_nosys
- .word sunos_nosys, sunos_nosys, sunos_nosys
+ .word sunos_nosys
+/*300*/ .word sunos_nosys, sunos_nosys, sunos_nosys
+
#endif
diff --git a/trunk/drivers/char/keyboard.c b/trunk/drivers/char/keyboard.c
index 7a6c1c0b7a95..20b6c8b30248 100644
--- a/trunk/drivers/char/keyboard.c
+++ b/trunk/drivers/char/keyboard.c
@@ -710,7 +710,7 @@ static void k_fn(struct vc_data *vc, unsigned char value, char up_flag)
static void k_cur(struct vc_data *vc, unsigned char value, char up_flag)
{
- static const char cur_chars[] = "BDCA";
+ static const char *cur_chars = "BDCA";
if (up_flag)
return;
diff --git a/trunk/drivers/input/ff-core.c b/trunk/drivers/input/ff-core.c
index 783b3412cead..35656cadc914 100644
--- a/trunk/drivers/input/ff-core.c
+++ b/trunk/drivers/input/ff-core.c
@@ -203,7 +203,7 @@ static int erase_effect(struct input_dev *dev, int effect_id,
}
/**
- * input_ff_erase - erase a force-feedback effect from device
+ * input_ff_erase - erase an effect from device
* @dev: input device to erase effect from
* @effect_id: id of the ffect to be erased
* @file: purported owner of the request
@@ -347,7 +347,7 @@ EXPORT_SYMBOL_GPL(input_ff_create);
/**
* input_ff_free() - frees force feedback portion of input device
- * @dev: input device supporting force feedback
+ * @dev: input device supporintg force feedback
*
* This function is only needed in error path as input core will
* automatically free force feedback structures when device is
diff --git a/trunk/drivers/input/ff-memless.c b/trunk/drivers/input/ff-memless.c
index eba18b6ac5e4..cd8b7297e6df 100644
--- a/trunk/drivers/input/ff-memless.c
+++ b/trunk/drivers/input/ff-memless.c
@@ -460,7 +460,7 @@ static void ml_ff_destroy(struct ff_device *ff)
}
/**
- * input_ff_create_memless() - create memoryless force-feedback device
+ * input_ff_create_memless() - create memoryless FF device
* @dev: input device supporting force-feedback
* @data: driver-specific data to be passed into @play_effect
* @play_effect: driver-specific method for playing FF effect
diff --git a/trunk/drivers/input/gameport/gameport.c b/trunk/drivers/input/gameport/gameport.c
index bba5894fcecd..a0af97efe6ac 100644
--- a/trunk/drivers/input/gameport/gameport.c
+++ b/trunk/drivers/input/gameport/gameport.c
@@ -730,6 +730,12 @@ static int gameport_driver_remove(struct device *dev)
return 0;
}
+static struct bus_type gameport_bus = {
+ .name = "gameport",
+ .probe = gameport_driver_probe,
+ .remove = gameport_driver_remove,
+};
+
static void gameport_add_driver(struct gameport_driver *drv)
{
int error;
@@ -775,15 +781,6 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
return !gameport_drv->ignore;
}
-static struct bus_type gameport_bus = {
- .name = "gameport",
- .dev_attrs = gameport_device_attrs,
- .drv_attrs = gameport_driver_attrs,
- .match = gameport_bus_match,
- .probe = gameport_driver_probe,
- .remove = gameport_driver_remove,
-};
-
static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv)
{
mutex_lock(&gameport->drv_mutex);
@@ -793,6 +790,7 @@ static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *
int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode)
{
+
if (gameport->open) {
if (gameport->open(gameport, mode)) {
return -1;
@@ -820,6 +818,9 @@ static int __init gameport_init(void)
{
int error;
+ gameport_bus.dev_attrs = gameport_device_attrs;
+ gameport_bus.drv_attrs = gameport_driver_attrs;
+ gameport_bus.match = gameport_bus_match;
error = bus_register(&gameport_bus);
if (error) {
printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
diff --git a/trunk/drivers/input/gameport/lightning.c b/trunk/drivers/input/gameport/lightning.c
index 6b4d4561d465..d65d81080257 100644
--- a/trunk/drivers/input/gameport/lightning.c
+++ b/trunk/drivers/input/gameport/lightning.c
@@ -309,7 +309,7 @@ static int __init l4_init(void)
int i, cards = 0;
if (!request_region(L4_PORT, 1, "lightning"))
- return -EBUSY;
+ return -1;
for (i = 0; i < 2; i++)
if (l4_add_card(i) == 0)
@@ -319,7 +319,7 @@ static int __init l4_init(void)
if (!cards) {
release_region(L4_PORT, 1);
- return -ENODEV;
+ return -1;
}
return 0;
diff --git a/trunk/drivers/input/input.c b/trunk/drivers/input/input.c
index 7cf2b4f603a3..1c8c8a5bc4a9 100644
--- a/trunk/drivers/input/input.c
+++ b/trunk/drivers/input/input.c
@@ -37,7 +37,7 @@ static struct input_handler *input_table[8];
/**
* input_event() - report new input event
- * @dev: device that generated the event
+ * @handle: device that generated the event
* @type: type of the event
* @code: event code
* @value: value of the event
@@ -900,15 +900,6 @@ struct class input_class = {
};
EXPORT_SYMBOL_GPL(input_class);
-/**
- * input_allocate_device - allocate memory for new input device
- *
- * Returns prepared struct input_dev or NULL.
- *
- * NOTE: Use input_free_device() to free devices that have not been
- * registered; input_unregister_device() should be used for already
- * registered devices.
- */
struct input_dev *input_allocate_device(void)
{
struct input_dev *dev;
@@ -928,20 +919,6 @@ struct input_dev *input_allocate_device(void)
}
EXPORT_SYMBOL(input_allocate_device);
-/**
- * input_free_device - free memory occupied by input_dev structure
- * @dev: input device to free
- *
- * This function should only be used if input_register_device()
- * was not called yet or if it failed. Once device was registered
- * use input_unregister_device() and memory will be freed once last
- * refrence to the device is dropped.
- *
- * Device should be allocated by input_allocate_device().
- *
- * NOTE: If there are references to the input device then memory
- * will not be freed until last reference is dropped.
- */
void input_free_device(struct input_dev *dev)
{
if (dev) {
diff --git a/trunk/drivers/input/joystick/adi.c b/trunk/drivers/input/joystick/adi.c
index 6279ced8a35b..704bf70f1db7 100644
--- a/trunk/drivers/input/joystick/adi.c
+++ b/trunk/drivers/input/joystick/adi.c
@@ -521,19 +521,11 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv)
for (i = 0; i < 2; i++)
if (port->adi[i].length > 0) {
adi_init_center(port->adi + i);
- err = input_register_device(port->adi[i].dev);
- if (err)
- goto fail3;
+ input_register_device(port->adi[i].dev);
}
return 0;
- fail3: while (--i >= 0) {
- if (port->adi[i].length > 0) {
- input_unregister_device(port->adi[i].dev);
- port->adi[i].dev = NULL;
- }
- }
fail2: for (i = 0; i < 2; i++)
if (port->adi[i].dev)
input_free_device(port->adi[i].dev);
diff --git a/trunk/drivers/input/joystick/amijoy.c b/trunk/drivers/input/joystick/amijoy.c
index e608691b5a61..650acf3a30b7 100644
--- a/trunk/drivers/input/joystick/amijoy.c
+++ b/trunk/drivers/input/joystick/amijoy.c
@@ -147,11 +147,7 @@ static int __init amijoy_init(void)
amijoy_dev[i]->absmax[ABS_X + j] = 1;
}
- err = input_register_device(amijoy_dev[i]);
- if (err) {
- input_free_device(amijoy_dev[i]);
- goto fail;
- }
+ input_register_device(amijoy_dev[i]);
}
return 0;
diff --git a/trunk/drivers/input/joystick/analog.c b/trunk/drivers/input/joystick/analog.c
index 7ef68456d7d6..e9a02db36ecc 100644
--- a/trunk/drivers/input/joystick/analog.c
+++ b/trunk/drivers/input/joystick/analog.c
@@ -434,7 +434,6 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
{
struct input_dev *input_dev;
int i, j, t, v, w, x, y, z;
- int error;
analog_name(analog);
snprintf(analog->phys, sizeof(analog->phys),
@@ -506,11 +505,7 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
analog_decode(analog, port->axes, port->initial, port->buttons);
- error = input_register_device(analog->dev);
- if (error) {
- input_free_device(analog->dev);
- return error;
- }
+ input_register_device(analog->dev);
return 0;
}
@@ -673,8 +668,7 @@ static int analog_connect(struct gameport *gameport, struct gameport_driver *drv
return 0;
fail3: while (--i >= 0)
- if (port->analog[i].mask)
- input_unregister_device(port->analog[i].dev);
+ input_unregister_device(port->analog[i].dev);
fail2: gameport_close(gameport);
fail1: gameport_set_drvdata(gameport, NULL);
kfree(port);
diff --git a/trunk/drivers/input/joystick/cobra.c b/trunk/drivers/input/joystick/cobra.c
index 034ec39c251d..d5e42eb88a20 100644
--- a/trunk/drivers/input/joystick/cobra.c
+++ b/trunk/drivers/input/joystick/cobra.c
@@ -223,15 +223,12 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
for (j = 0; cobra_btn[j]; j++)
set_bit(cobra_btn[j], input_dev->keybit);
- err = input_register_device(cobra->dev[i]);
- if (err)
- goto fail4;
+ input_register_device(cobra->dev[i]);
}
return 0;
- fail4: input_free_device(cobra->dev[i]);
- fail3: while (--i >= 0)
+ fail3: for (i = 0; i < 2; i++)
if (cobra->dev[i])
input_unregister_device(cobra->dev[i]);
fail2: gameport_close(gameport);
diff --git a/trunk/drivers/input/joystick/gf2k.c b/trunk/drivers/input/joystick/gf2k.c
index bacbab5d1b6f..e4a699f6ec87 100644
--- a/trunk/drivers/input/joystick/gf2k.c
+++ b/trunk/drivers/input/joystick/gf2k.c
@@ -341,9 +341,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->absflat[gf2k_abs[i]] = (i < 2) ? 24 : 0;
}
- err = input_register_device(gf2k->dev);
- if (err)
- goto fail2;
+ input_register_device(gf2k->dev);
return 0;
diff --git a/trunk/drivers/input/joystick/grip_mp.c b/trunk/drivers/input/joystick/grip_mp.c
index 8120a9c40773..62438944a69a 100644
--- a/trunk/drivers/input/joystick/grip_mp.c
+++ b/trunk/drivers/input/joystick/grip_mp.c
@@ -423,10 +423,7 @@ static int get_and_decode_packet(struct grip_mp *grip, int flags)
if (!port->registered) {
dbg("New Grip pad in multiport slot %d.\n", slot);
- if (register_slot(slot, grip)) {
- port->mode = GRIP_MODE_RESET;
- port->dirty = 0;
- }
+ register_slot(slot, grip);
}
return flags;
}
@@ -588,7 +585,6 @@ static int register_slot(int slot, struct grip_mp *grip)
struct grip_port *port = grip->port[slot];
struct input_dev *input_dev;
int j, t;
- int err;
port->dev = input_dev = input_allocate_device();
if (!input_dev)
@@ -614,12 +610,7 @@ static int register_slot(int slot, struct grip_mp *grip)
if (t > 0)
set_bit(t, input_dev->keybit);
- err = input_register_device(port->dev);
- if (err) {
- input_free_device(port->dev);
- return err;
- }
-
+ input_register_device(port->dev);
port->registered = 1;
if (port->dirty) /* report initial state, if any */
diff --git a/trunk/drivers/input/joystick/guillemot.c b/trunk/drivers/input/joystick/guillemot.c
index dbc5d92858b8..840ed9b512b2 100644
--- a/trunk/drivers/input/joystick/guillemot.c
+++ b/trunk/drivers/input/joystick/guillemot.c
@@ -250,9 +250,7 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
for (i = 0; (t = guillemot->type->btn[i]) >= 0; i++)
set_bit(t, input_dev->keybit);
- err = input_register_device(guillemot->dev);
- if (err)
- goto fail2;
+ input_register_device(guillemot->dev);
return 0;
diff --git a/trunk/drivers/input/joystick/iforce/iforce-main.c b/trunk/drivers/input/joystick/iforce/iforce-main.c
index 3393a37fec39..24c684bc6337 100644
--- a/trunk/drivers/input/joystick/iforce/iforce-main.c
+++ b/trunk/drivers/input/joystick/iforce/iforce-main.c
@@ -325,8 +325,8 @@ int iforce_init_device(struct iforce *iforce)
if (i == 20) { /* 5 seconds */
printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n");
- error = -ENODEV;
- goto fail;
+ input_free_device(input_dev);
+ return -ENODEV;
}
/*
@@ -439,8 +439,10 @@ int iforce_init_device(struct iforce *iforce)
set_bit(iforce->type->ff[i], input_dev->ffbit);
error = input_ff_create(input_dev, ff_effects);
- if (error)
- goto fail;
+ if (error) {
+ input_free_device(input_dev);
+ return error;
+ }
ff = input_dev->ff;
ff->upload = iforce_upload_effect;
@@ -453,35 +455,22 @@ int iforce_init_device(struct iforce *iforce)
* Register input device.
*/
- error = input_register_device(iforce->dev);
- if (error)
- goto fail;
+ input_register_device(iforce->dev);
printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open);
return 0;
-
- fail: input_free_device(input_dev);
- return error;
}
static int __init iforce_init(void)
{
- int err = 0;
-
#ifdef CONFIG_JOYSTICK_IFORCE_USB
- err = usb_register(&iforce_usb_driver);
- if (err)
- return err;
+ usb_register(&iforce_usb_driver);
#endif
#ifdef CONFIG_JOYSTICK_IFORCE_232
- err = serio_register_driver(&iforce_serio_drv);
-#ifdef CONFIG_JOYSTICK_IFORCE_USB
- if (err)
- usb_deregister(&iforce_usb_driver);
-#endif
+ serio_register_driver(&iforce_serio_drv);
#endif
- return err;
+ return 0;
}
static void __exit iforce_exit(void)
diff --git a/trunk/drivers/input/joystick/iforce/iforce-serio.c b/trunk/drivers/input/joystick/iforce/iforce-serio.c
index ec4be535f483..ca08f45c2040 100644
--- a/trunk/drivers/input/joystick/iforce/iforce-serio.c
+++ b/trunk/drivers/input/joystick/iforce/iforce-serio.c
@@ -141,19 +141,21 @@ static int iforce_serio_connect(struct serio *serio, struct serio_driver *drv)
serio_set_drvdata(serio, iforce);
err = serio_open(serio, drv);
- if (err)
- goto fail1;
+ if (err) {
+ serio_set_drvdata(serio, NULL);
+ kfree(iforce);
+ return err;
+ }
err = iforce_init_device(iforce);
- if (err)
- goto fail2;
+ if (err) {
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ kfree(iforce);
+ return -ENODEV;
+ }
return 0;
-
- fail2: serio_close(serio);
- fail1: serio_set_drvdata(serio, NULL);
- kfree(iforce);
- return err;
}
static void iforce_serio_disconnect(struct serio *serio)
diff --git a/trunk/drivers/input/joystick/interact.c b/trunk/drivers/input/joystick/interact.c
index fec8b3d0967d..bbfeb9c59b87 100644
--- a/trunk/drivers/input/joystick/interact.c
+++ b/trunk/drivers/input/joystick/interact.c
@@ -283,9 +283,7 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
for (i = 0; (t = interact_type[interact->type].btn[i]) >= 0; i++)
set_bit(t, input_dev->keybit);
- err = input_register_device(interact->dev);
- if (err)
- goto fail2;
+ input_register_device(interact->dev);
return 0;
diff --git a/trunk/drivers/input/joystick/magellan.c b/trunk/drivers/input/joystick/magellan.c
index 4112789f1196..e3d19444ba2e 100644
--- a/trunk/drivers/input/joystick/magellan.c
+++ b/trunk/drivers/input/joystick/magellan.c
@@ -157,7 +157,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
magellan = kzalloc(sizeof(struct magellan), GFP_KERNEL);
input_dev = input_allocate_device();
if (!magellan || !input_dev)
- goto fail1;
+ goto fail;
magellan->dev = input_dev;
snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
@@ -183,17 +183,13 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(magellan->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(magellan->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(magellan);
return err;
}
@@ -231,7 +227,8 @@ static struct serio_driver magellan_drv = {
static int __init magellan_init(void)
{
- return serio_register_driver(&magellan_drv);
+ serio_register_driver(&magellan_drv);
+ return 0;
}
static void __exit magellan_exit(void)
diff --git a/trunk/drivers/input/joystick/spaceball.c b/trunk/drivers/input/joystick/spaceball.c
index 08bf113e62eb..2a9808cf826f 100644
--- a/trunk/drivers/input/joystick/spaceball.c
+++ b/trunk/drivers/input/joystick/spaceball.c
@@ -215,7 +215,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL);
input_dev = input_allocate_device();
if (!spaceball || !input_dev)
- goto fail1;
+ goto fail;
spaceball->dev = input_dev;
snprintf(spaceball->phys, sizeof(spaceball->phys), "%s/input0", serio->phys);
@@ -252,17 +252,13 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(spaceball->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(spaceball->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(spaceball);
return err;
}
@@ -300,7 +296,8 @@ static struct serio_driver spaceball_drv = {
static int __init spaceball_init(void)
{
- return serio_register_driver(&spaceball_drv);
+ serio_register_driver(&spaceball_drv);
+ return 0;
}
static void __exit spaceball_exit(void)
diff --git a/trunk/drivers/input/joystick/spaceorb.c b/trunk/drivers/input/joystick/spaceorb.c
index c9c79211af71..c4db0247c5fb 100644
--- a/trunk/drivers/input/joystick/spaceorb.c
+++ b/trunk/drivers/input/joystick/spaceorb.c
@@ -172,7 +172,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
spaceorb = kzalloc(sizeof(struct spaceorb), GFP_KERNEL);
input_dev = input_allocate_device();
if (!spaceorb || !input_dev)
- goto fail1;
+ goto fail;
spaceorb->dev = input_dev;
snprintf(spaceorb->phys, sizeof(spaceorb->phys), "%s/input0", serio->phys);
@@ -198,17 +198,13 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(spaceorb->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(spaceorb->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(spaceorb);
return err;
}
@@ -246,7 +242,8 @@ static struct serio_driver spaceorb_drv = {
static int __init spaceorb_init(void)
{
- return serio_register_driver(&spaceorb_drv);
+ serio_register_driver(&spaceorb_drv);
+ return 0;
}
static void __exit spaceorb_exit(void)
diff --git a/trunk/drivers/input/joystick/stinger.c b/trunk/drivers/input/joystick/stinger.c
index ecb0916215fa..1ffb03223311 100644
--- a/trunk/drivers/input/joystick/stinger.c
+++ b/trunk/drivers/input/joystick/stinger.c
@@ -143,7 +143,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
stinger = kmalloc(sizeof(struct stinger), GFP_KERNEL);
input_dev = input_allocate_device();
if (!stinger || !input_dev)
- goto fail1;
+ goto fail;
stinger->dev = input_dev;
snprintf(stinger->phys, sizeof(stinger->phys), "%s/serio0", serio->phys);
@@ -168,17 +168,13 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(stinger->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(stinger->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(stinger);
return err;
}
@@ -216,7 +212,8 @@ static struct serio_driver stinger_drv = {
static int __init stinger_init(void)
{
- return serio_register_driver(&stinger_drv);
+ serio_register_driver(&stinger_drv);
+ return 0;
}
static void __exit stinger_exit(void)
diff --git a/trunk/drivers/input/joystick/twidjoy.c b/trunk/drivers/input/joystick/twidjoy.c
index 9cf17d6ced82..49085df2d631 100644
--- a/trunk/drivers/input/joystick/twidjoy.c
+++ b/trunk/drivers/input/joystick/twidjoy.c
@@ -194,7 +194,7 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
twidjoy = kzalloc(sizeof(struct twidjoy), GFP_KERNEL);
input_dev = input_allocate_device();
if (!twidjoy || !input_dev)
- goto fail1;
+ goto fail;
twidjoy->dev = input_dev;
snprintf(twidjoy->phys, sizeof(twidjoy->phys), "%s/input0", serio->phys);
@@ -221,17 +221,13 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(twidjoy->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(twidjoy->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(twidjoy);
return err;
}
@@ -269,7 +265,8 @@ static struct serio_driver twidjoy_drv = {
static int __init twidjoy_init(void)
{
- return serio_register_driver(&twidjoy_drv);
+ serio_register_driver(&twidjoy_drv);
+ return 0;
}
static void __exit twidjoy_exit(void)
diff --git a/trunk/drivers/input/joystick/warrior.c b/trunk/drivers/input/joystick/warrior.c
index 29d339acf430..35edea1ab955 100644
--- a/trunk/drivers/input/joystick/warrior.c
+++ b/trunk/drivers/input/joystick/warrior.c
@@ -149,7 +149,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
warrior = kzalloc(sizeof(struct warrior), GFP_KERNEL);
input_dev = input_allocate_device();
if (!warrior || !input_dev)
- goto fail1;
+ goto fail;
warrior->dev = input_dev;
snprintf(warrior->phys, sizeof(warrior->phys), "%s/input0", serio->phys);
@@ -176,17 +176,13 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(warrior->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(warrior->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(warrior);
return err;
}
@@ -224,7 +220,8 @@ static struct serio_driver warrior_drv = {
static int __init warrior_init(void)
{
- return serio_register_driver(&warrior_drv);
+ serio_register_driver(&warrior_drv);
+ return 0;
}
static void __exit warrior_exit(void)
diff --git a/trunk/drivers/input/keyboard/Kconfig b/trunk/drivers/input/keyboard/Kconfig
index 049f2f544e75..81a333f73010 100644
--- a/trunk/drivers/input/keyboard/Kconfig
+++ b/trunk/drivers/input/keyboard/Kconfig
@@ -203,15 +203,4 @@ config KEYBOARD_OMAP
To compile this driver as a module, choose M here: the
module will be called omap-keypad.
-config KEYBOARD_AAED2000
- tristate "AAED-2000 keyboard"
- depends on MACH_AAED2000
- default y
- help
- Say Y here to enable the keyboard on the Agilent AAED-2000
- development board.
-
- To compile this driver as a module, choose M here: the
- module will be called aaed2000_kbd.
-
endif
diff --git a/trunk/drivers/input/keyboard/Makefile b/trunk/drivers/input/keyboard/Makefile
index 568797907347..4c79e7bc9d06 100644
--- a/trunk/drivers/input/keyboard/Makefile
+++ b/trunk/drivers/input/keyboard/Makefile
@@ -17,5 +17,4 @@ obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
-obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
diff --git a/trunk/drivers/input/keyboard/aaed2000_kbd.c b/trunk/drivers/input/keyboard/aaed2000_kbd.c
deleted file mode 100644
index 65fcb6af63a8..000000000000
--- a/trunk/drivers/input/keyboard/aaed2000_kbd.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Keyboard driver for the AAED-2000 dev board
- *
- * Copyright (c) 2006 Nicolas Bellido Y Ortega
- *
- * Based on corgikbd.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#define KB_ROWS 12
-#define KB_COLS 8
-#define KB_ROWMASK(r) (1 << (r))
-#define SCANCODE(r,c) (((c) * KB_ROWS) + (r))
-#define NR_SCANCODES (KB_COLS * KB_ROWS)
-
-#define SCAN_INTERVAL (50) /* ms */
-#define KB_ACTIVATE_DELAY (20) /* us */
-
-static unsigned char aaedkbd_keycode[NR_SCANCODES] = {
- KEY_9, KEY_0, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, 0, KEY_SPACE, KEY_KP6, 0, KEY_KPDOT, 0, 0,
- KEY_K, KEY_M, KEY_O, KEY_DOT, KEY_SLASH, 0, KEY_F, 0, 0, 0, KEY_LEFTSHIFT, 0,
- KEY_I, KEY_P, KEY_LEFTBRACE, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, 0, 0, 0, 0, KEY_RIGHTSHIFT, 0,
- KEY_8, KEY_L, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_ENTER, 0, 0, 0, 0, 0, 0, 0,
- KEY_J, KEY_H, KEY_B, KEY_KP8, KEY_KP4, 0, KEY_C, KEY_D, KEY_S, KEY_A, 0, KEY_CAPSLOCK,
- KEY_Y, KEY_U, KEY_N, KEY_T, 0, 0, KEY_R, KEY_E, KEY_W, KEY_Q, 0, KEY_TAB,
- KEY_7, KEY_6, KEY_G, 0, KEY_5, 0, KEY_4, KEY_3, KEY_2, KEY_1, 0, KEY_GRAVE,
- 0, 0, KEY_COMMA, 0, KEY_KP2, 0, KEY_V, KEY_LEFTALT, KEY_X, KEY_Z, 0, KEY_LEFTCTRL
-};
-
-struct aaedkbd {
- unsigned char keycode[ARRAY_SIZE(aaedkbd_keycode)];
- struct input_dev *input;
- struct work_struct workq;
- int kbdscan_state[KB_COLS];
- int kbdscan_count[KB_COLS];
-};
-
-#define KBDSCAN_STABLE_COUNT 2
-
-static void aaedkbd_report_col(struct aaedkbd *aaedkbd,
- unsigned int col, unsigned int rowd)
-{
- unsigned int scancode, pressed;
- unsigned int row;
-
- for (row = 0; row < KB_ROWS; row++) {
- scancode = SCANCODE(row, col);
- pressed = rowd & KB_ROWMASK(row);
-
- input_report_key(aaedkbd->input, aaedkbd->keycode[scancode], pressed);
- }
-}
-
-/* Scan the hardware keyboard and push any changes up through the input layer */
-static void aaedkbd_work(void *data)
-{
- struct aaedkbd *aaedkbd = data;
- unsigned int col, rowd;
-
- col = 0;
- do {
- AAEC_GPIO_KSCAN = col + 8;
- udelay(KB_ACTIVATE_DELAY);
- rowd = AAED_EXT_GPIO & AAED_EGPIO_KBD_SCAN;
-
- if (rowd != aaedkbd->kbdscan_state[col]) {
- aaedkbd->kbdscan_count[col] = 0;
- aaedkbd->kbdscan_state[col] = rowd;
- } else if (++aaedkbd->kbdscan_count[col] >= KBDSCAN_STABLE_COUNT) {
- aaedkbd_report_col(aaedkbd, col, rowd);
- col++;
- }
- } while (col < KB_COLS);
-
- AAEC_GPIO_KSCAN = 0x07;
- input_sync(aaedkbd->input);
-
- schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL));
-}
-
-static int aaedkbd_open(struct input_dev *indev)
-{
- struct aaedkbd *aaedkbd = indev->private;
-
- schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL));
-
- return 0;
-}
-
-static void aaedkbd_close(struct input_dev *indev)
-{
- struct aaedkbd *aaedkbd = indev->private;
-
- cancel_delayed_work(&aaedkbd->workq);
- flush_scheduled_work();
-}
-
-static int __devinit aaedkbd_probe(struct platform_device *pdev)
-{
- struct aaedkbd *aaedkbd;
- struct input_dev *input_dev;
- int i;
- int error;
-
- aaedkbd = kzalloc(sizeof(struct aaedkbd), GFP_KERNEL);
- input_dev = input_allocate_device();
- if (!aaedkbd || !input_dev) {
- error = -ENOMEM;
- goto fail;
- }
-
- platform_set_drvdata(pdev, aaedkbd);
-
- aaedkbd->input = input_dev;
-
- /* Init keyboard rescan workqueue */
- INIT_WORK(&aaedkbd->workq, aaedkbd_work, aaedkbd);
-
- memcpy(aaedkbd->keycode, aaedkbd_keycode, sizeof(aaedkbd->keycode));
-
- input_dev->name = "AAED-2000 Keyboard";
- input_dev->phys = "aaedkbd/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 = &pdev->dev;
- input_dev->private = aaedkbd;
-
- input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
- input_dev->keycode = aaedkbd->keycode;
- input_dev->keycodesize = sizeof(unsigned char);
- input_dev->keycodemax = ARRAY_SIZE(aaedkbd_keycode);
-
- for (i = 0; i < ARRAY_SIZE(aaedkbd_keycode); i++)
- set_bit(aaedkbd->keycode[i], input_dev->keybit);
- clear_bit(0, input_dev->keybit);
-
- input_dev->open = aaedkbd_open;
- input_dev->close = aaedkbd_close;
-
- error = input_register_device(aaedkbd->input);
- if (error)
- goto fail;
-
- return 0;
-
- fail: kfree(aaedkbd);
- input_free_device(input_dev);
- return error;
-}
-
-static int __devexit aaedkbd_remove(struct platform_device *pdev)
-{
- struct aaedkbd *aaedkbd = platform_get_drvdata(pdev);
-
- input_unregister_device(aaedkbd->input);
- kfree(aaedkbd);
-
- return 0;
-}
-
-static struct platform_driver aaedkbd_driver = {
- .probe = aaedkbd_probe,
- .remove = __devexit_p(aaedkbd_remove),
- .driver = {
- .name = "aaed2000-keyboard",
- },
-};
-
-static int __init aaedkbd_init(void)
-{
- return platform_driver_register(&aaedkbd_driver);
-}
-
-static void __exit aaedkbd_exit(void)
-{
- platform_driver_unregister(&aaedkbd_driver);
-}
-
-module_init(aaedkbd_init);
-module_exit(aaedkbd_exit);
-
-MODULE_AUTHOR("Nicolas Bellido Y Ortega");
-MODULE_DESCRIPTION("AAED-2000 Keyboard Driver");
-MODULE_LICENSE("GPLv2");
diff --git a/trunk/drivers/input/keyboard/amikbd.c b/trunk/drivers/input/keyboard/amikbd.c
index 16583d71753b..8abdbd0ee8f9 100644
--- a/trunk/drivers/input/keyboard/amikbd.c
+++ b/trunk/drivers/input/keyboard/amikbd.c
@@ -190,7 +190,7 @@ static int __init amikbd_init(void)
int i, j;
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
- return -ENODEV;
+ return -EIO;
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
@@ -198,8 +198,8 @@ static int __init amikbd_init(void)
amikbd_dev = input_allocate_device();
if (!amikbd_dev) {
printk(KERN_ERR "amikbd: not enough memory for input device\n");
- err = -ENOMEM;
- goto fail1;
+ release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
+ return -ENOMEM;
}
amikbd_dev->name = "Amiga Keyboard";
@@ -231,22 +231,10 @@ static int __init amikbd_init(void)
memcpy(key_maps[i], temp_map, sizeof(temp_map));
}
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
- if (request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd",
- amikbd_interrupt)) {
- err = -EBUSY;
- goto fail2;
- }
-
- err = input_register_device(amikbd_dev);
- if (err)
- goto fail3;
+ request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt);
+ input_register_device(amikbd_dev);
return 0;
-
- fail3: free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt);
- fail2: input_free_device(amikbd_dev);
- fail1: release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
- return err;
}
static void __exit amikbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/atkbd.c b/trunk/drivers/input/keyboard/atkbd.c
index 498e64a00e3c..cbb93669d1ce 100644
--- a/trunk/drivers/input/keyboard/atkbd.c
+++ b/trunk/drivers/input/keyboard/atkbd.c
@@ -939,7 +939,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
atkbd = kzalloc(sizeof(struct atkbd), GFP_KERNEL);
dev = input_allocate_device();
if (!atkbd || !dev)
- goto fail1;
+ goto fail;
atkbd->dev = dev;
ps2_init(&atkbd->ps2dev, serio);
@@ -967,13 +967,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
+ goto fail;
if (atkbd->write) {
if (atkbd_probe(atkbd)) {
+ serio_close(serio);
err = -ENODEV;
- goto fail3;
+ goto fail;
}
atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra);
@@ -987,22 +988,16 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
atkbd_set_keycode_table(atkbd);
atkbd_set_device_attrs(atkbd);
- err = sysfs_create_group(&serio->dev.kobj, &atkbd_attribute_group);
- if (err)
- goto fail3;
+ sysfs_create_group(&serio->dev.kobj, &atkbd_attribute_group);
atkbd_enable(atkbd);
- err = input_register_device(atkbd->dev);
- if (err)
- goto fail4;
+ input_register_device(atkbd->dev);
return 0;
- fail4: sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(dev);
kfree(atkbd);
return err;
}
@@ -1138,11 +1133,9 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count)
{
- struct input_dev *old_dev, *new_dev;
+ struct input_dev *new_dev;
unsigned long value;
char *rest;
- int err;
- unsigned char old_extra, old_set;
if (!atkbd->write)
return -EIO;
@@ -1154,36 +1147,17 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
if (atkbd->extra != value) {
/*
* Since device's properties will change we need to
- * unregister old device. But allocate and register
- * new one first to make sure we have it.
+ * unregister old device. But allocate new one first
+ * to make sure we have it.
*/
- old_dev = atkbd->dev;
- old_extra = atkbd->extra;
- old_set = atkbd->set;
-
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
-
+ input_unregister_device(atkbd->dev);
atkbd->dev = new_dev;
atkbd->set = atkbd_select_set(atkbd, atkbd->set, value);
atkbd_activate(atkbd);
- atkbd_set_keycode_table(atkbd);
atkbd_set_device_attrs(atkbd);
-
- err = input_register_device(atkbd->dev);
- if (err) {
- input_free_device(new_dev);
-
- atkbd->dev = old_dev;
- atkbd->set = atkbd_select_set(atkbd, old_set, old_extra);
- atkbd_set_keycode_table(atkbd);
- atkbd_set_device_attrs(atkbd);
-
- return err;
- }
- input_unregister_device(old_dev);
-
+ input_register_device(atkbd->dev);
}
return count;
}
@@ -1195,41 +1169,23 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count)
{
- struct input_dev *old_dev, *new_dev;
+ struct input_dev *new_dev;
unsigned long value;
char *rest;
- int err;
- unsigned char old_scroll;
value = simple_strtoul(buf, &rest, 10);
if (*rest || value > 1)
return -EINVAL;
if (atkbd->scroll != value) {
- old_dev = atkbd->dev;
- old_scroll = atkbd->scroll;
-
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
-
+ input_unregister_device(atkbd->dev);
atkbd->dev = new_dev;
atkbd->scroll = value;
atkbd_set_keycode_table(atkbd);
atkbd_set_device_attrs(atkbd);
-
- err = input_register_device(atkbd->dev);
- if (err) {
- input_free_device(new_dev);
-
- atkbd->scroll = old_scroll;
- atkbd->dev = old_dev;
- atkbd_set_keycode_table(atkbd);
- atkbd_set_device_attrs(atkbd);
-
- return err;
- }
- input_unregister_device(old_dev);
+ input_register_device(atkbd->dev);
}
return count;
}
@@ -1241,11 +1197,9 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
{
- struct input_dev *old_dev, *new_dev;
+ struct input_dev *new_dev;
unsigned long value;
char *rest;
- int err;
- unsigned char old_set, old_extra;
if (!atkbd->write)
return -EIO;
@@ -1255,32 +1209,15 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
return -EINVAL;
if (atkbd->set != value) {
- old_dev = atkbd->dev;
- old_extra = atkbd->extra;
- old_set = atkbd->set;
-
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
-
+ input_unregister_device(atkbd->dev);
atkbd->dev = new_dev;
atkbd->set = atkbd_select_set(atkbd, value, atkbd->extra);
atkbd_activate(atkbd);
atkbd_set_keycode_table(atkbd);
atkbd_set_device_attrs(atkbd);
-
- err = input_register_device(atkbd->dev);
- if (err) {
- input_free_device(new_dev);
-
- atkbd->dev = old_dev;
- atkbd->set = atkbd_select_set(atkbd, old_set, old_extra);
- atkbd_set_keycode_table(atkbd);
- atkbd_set_device_attrs(atkbd);
-
- return err;
- }
- input_unregister_device(old_dev);
+ input_register_device(atkbd->dev);
}
return count;
}
@@ -1292,11 +1229,9 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count)
{
- struct input_dev *old_dev, *new_dev;
+ struct input_dev *new_dev;
unsigned long value;
char *rest;
- int err;
- unsigned char old_softrepeat, old_softraw;
if (!atkbd->write)
return -EIO;
@@ -1306,32 +1241,15 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
return -EINVAL;
if (atkbd->softrepeat != value) {
- old_dev = atkbd->dev;
- old_softrepeat = atkbd->softrepeat;
- old_softraw = atkbd->softraw;
-
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
-
+ input_unregister_device(atkbd->dev);
atkbd->dev = new_dev;
atkbd->softrepeat = value;
if (atkbd->softrepeat)
atkbd->softraw = 1;
atkbd_set_device_attrs(atkbd);
-
- err = input_register_device(atkbd->dev);
- if (err) {
- input_free_device(new_dev);
-
- atkbd->dev = old_dev;
- atkbd->softrepeat = old_softrepeat;
- atkbd->softraw = old_softraw;
- atkbd_set_device_attrs(atkbd);
-
- return err;
- }
- input_unregister_device(old_dev);
+ input_register_device(atkbd->dev);
}
return count;
}
@@ -1344,39 +1262,22 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count)
{
- struct input_dev *old_dev, *new_dev;
+ struct input_dev *new_dev;
unsigned long value;
char *rest;
- int err;
- unsigned char old_softraw;
value = simple_strtoul(buf, &rest, 10);
if (*rest || value > 1)
return -EINVAL;
if (atkbd->softraw != value) {
- old_dev = atkbd->dev;
- old_softraw = atkbd->softraw;
-
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
-
+ input_unregister_device(atkbd->dev);
atkbd->dev = new_dev;
atkbd->softraw = value;
atkbd_set_device_attrs(atkbd);
-
- err = input_register_device(atkbd->dev);
- if (err) {
- input_free_device(new_dev);
-
- atkbd->dev = old_dev;
- atkbd->softraw = old_softraw;
- atkbd_set_device_attrs(atkbd);
-
- return err;
- }
- input_unregister_device(old_dev);
+ input_register_device(atkbd->dev);
}
return count;
}
@@ -1389,7 +1290,8 @@ static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf)
static int __init atkbd_init(void)
{
- return serio_register_driver(&atkbd_drv);
+ serio_register_driver(&atkbd_drv);
+ return 0;
}
static void __exit atkbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/corgikbd.c b/trunk/drivers/input/keyboard/corgikbd.c
index 1016c94e65db..befdd6006b50 100644
--- a/trunk/drivers/input/keyboard/corgikbd.c
+++ b/trunk/drivers/input/keyboard/corgikbd.c
@@ -291,12 +291,15 @@ static int __init corgikbd_probe(struct platform_device *pdev)
{
struct corgikbd *corgikbd;
struct input_dev *input_dev;
- int i, err = -ENOMEM;
+ int i;
corgikbd = kzalloc(sizeof(struct corgikbd), GFP_KERNEL);
input_dev = input_allocate_device();
- if (!corgikbd || !input_dev)
- goto fail;
+ if (!corgikbd || !input_dev) {
+ kfree(corgikbd);
+ input_free_device(input_dev);
+ return -ENOMEM;
+ }
platform_set_drvdata(pdev, corgikbd);
@@ -338,9 +341,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
set_bit(SW_TABLET_MODE, input_dev->swbit);
set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
- err = input_register_device(corgikbd->input);
- if (err)
- goto fail;
+ input_register_device(corgikbd->input);
mod_timer(&corgikbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
@@ -361,10 +362,6 @@ static int __init corgikbd_probe(struct platform_device *pdev)
pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN);
return 0;
-
- fail: input_free_device(input_dev);
- kfree(corgikbd);
- return err;
}
static int corgikbd_remove(struct platform_device *pdev)
diff --git a/trunk/drivers/input/keyboard/hil_kbd.c b/trunk/drivers/input/keyboard/hil_kbd.c
index 7cc9728b04df..e774dd31e99b 100644
--- a/trunk/drivers/input/keyboard/hil_kbd.c
+++ b/trunk/drivers/input/keyboard/hil_kbd.c
@@ -381,7 +381,8 @@ struct serio_driver hil_kbd_serio_drv = {
static int __init hil_kbd_init(void)
{
- return serio_register_driver(&hil_kbd_serio_drv);
+ serio_register_driver(&hil_kbd_serio_drv);
+ return 0;
}
static void __exit hil_kbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/lkkbd.c b/trunk/drivers/input/keyboard/lkkbd.c
index 1789785813ee..708d5a1bc3d2 100644
--- a/trunk/drivers/input/keyboard/lkkbd.c
+++ b/trunk/drivers/input/keyboard/lkkbd.c
@@ -651,7 +651,7 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
input_dev = input_allocate_device ();
if (!lk || !input_dev) {
err = -ENOMEM;
- goto fail1;
+ goto fail;
}
lk->serio = serio;
@@ -696,19 +696,15 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
err = serio_open (serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device (lk->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device (lk->dev);
lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET);
return 0;
- fail3: serio_close (serio);
- fail2: serio_set_drvdata (serio, NULL);
- fail1: input_free_device (input_dev);
+ fail: serio_set_drvdata (serio, NULL);
+ input_free_device (input_dev);
kfree (lk);
return err;
}
@@ -758,7 +754,8 @@ static struct serio_driver lkkbd_drv = {
static int __init
lkkbd_init (void)
{
- return serio_register_driver(&lkkbd_drv);
+ serio_register_driver(&lkkbd_drv);
+ return 0;
}
static void __exit
diff --git a/trunk/drivers/input/keyboard/locomokbd.c b/trunk/drivers/input/keyboard/locomokbd.c
index 2ade5186cc41..5788dbc317bb 100644
--- a/trunk/drivers/input/keyboard/locomokbd.c
+++ b/trunk/drivers/input/keyboard/locomokbd.c
@@ -193,22 +193,22 @@ static int locomokbd_probe(struct locomo_dev *dev)
{
struct locomokbd *locomokbd;
struct input_dev *input_dev;
- int i, err;
+ int i, ret;
locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!locomokbd || !input_dev) {
- err = -ENOMEM;
- goto err_free_mem;
+ ret = -ENOMEM;
+ goto free;
}
/* try and claim memory region */
if (!request_mem_region((unsigned long) dev->mapbase,
dev->length,
LOCOMO_DRIVER_NAME(dev))) {
- err = -EBUSY;
+ ret = -EBUSY;
printk(KERN_ERR "locomokbd: Can't acquire access to io memory for keyboard\n");
- goto err_free_mem;
+ goto free;
}
locomokbd->ldev = dev;
@@ -244,28 +244,24 @@ static int locomokbd_probe(struct locomo_dev *dev)
clear_bit(0, input_dev->keybit);
/* attempt to get the interrupt */
- err = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
- if (err) {
+ ret = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
+ if (ret) {
printk(KERN_ERR "locomokbd: Can't get irq for keyboard\n");
- goto err_release_region;
+ goto out;
}
- err = input_register_device(locomokbd->input);
- if (err)
- goto err_free_irq;
+ input_register_device(locomokbd->input);
return 0;
- err_free_irq:
- free_irq(dev->irq[0], locomokbd);
- err_release_region:
+out:
release_mem_region((unsigned long) dev->mapbase, dev->length);
locomo_set_drvdata(dev, NULL);
- err_free_mem:
+free:
input_free_device(input_dev);
kfree(locomokbd);
- return err;
+ return ret;
}
static int locomokbd_remove(struct locomo_dev *dev)
diff --git a/trunk/drivers/input/keyboard/maple_keyb.c b/trunk/drivers/input/keyboard/maple_keyb.c
index 99836b3af47b..cc6aaf9e85be 100644
--- a/trunk/drivers/input/keyboard/maple_keyb.c
+++ b/trunk/drivers/input/keyboard/maple_keyb.c
@@ -94,13 +94,13 @@ static int dc_kbd_connect(struct maple_device *dev)
struct input_dev *input_dev;
unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]);
int i;
- int err;
dev->private_data = kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbd || !input_dev) {
- err = -ENOMEM;
- goto fail;
+ kfree(kbd);
+ input_free_device(input_dev);
+ return -ENOMEM;
}
kbd->dev = input_dev;
@@ -113,16 +113,10 @@ static int dc_kbd_connect(struct maple_device *dev)
set_bit(dc_kbd_keycode[i], input_dev->keybit);
clear_bit(0, input_dev->keybit);
- err = input_register_device(kbd->dev);
- if (err)
- goto fail;
+ input_register_device(kbd->dev);
maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD);
return 0;
-
- fail: input_free_device(input_dev);
- kfree(kbd);
- return err;
}
diff --git a/trunk/drivers/input/keyboard/newtonkbd.c b/trunk/drivers/input/keyboard/newtonkbd.c
index aa29b50765c9..9282e4e082bd 100644
--- a/trunk/drivers/input/keyboard/newtonkbd.c
+++ b/trunk/drivers/input/keyboard/newtonkbd.c
@@ -91,7 +91,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
nkbd = kzalloc(sizeof(struct nkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!nkbd || !input_dev)
- goto fail1;
+ goto fail;
nkbd->serio = serio;
nkbd->dev = input_dev;
@@ -119,17 +119,13 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(nkbd->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(nkbd->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(nkbd);
return err;
}
@@ -169,7 +165,8 @@ static struct serio_driver nkbd_drv = {
static int __init nkbd_init(void)
{
- return serio_register_driver(&nkbd_drv);
+ serio_register_driver(&nkbd_drv);
+ return 0;
}
static void __exit nkbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/spitzkbd.c b/trunk/drivers/input/keyboard/spitzkbd.c
index 8a2166c77ff4..28b2748e82d0 100644
--- a/trunk/drivers/input/keyboard/spitzkbd.c
+++ b/trunk/drivers/input/keyboard/spitzkbd.c
@@ -346,12 +346,17 @@ static int __init spitzkbd_probe(struct platform_device *dev)
{
struct spitzkbd *spitzkbd;
struct input_dev *input_dev;
- int i, err = -ENOMEM;
+ int i;
spitzkbd = kzalloc(sizeof(struct spitzkbd), GFP_KERNEL);
+ if (!spitzkbd)
+ return -ENOMEM;
+
input_dev = input_allocate_device();
- if (!spitzkbd || !input_dev)
- goto fail;
+ if (!input_dev) {
+ kfree(spitzkbd);
+ return -ENOMEM;
+ }
platform_set_drvdata(dev, spitzkbd);
strcpy(spitzkbd->phys, "spitzkbd/input0");
@@ -395,9 +400,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
set_bit(SW_TABLET_MODE, input_dev->swbit);
set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
- err = input_register_device(input_dev);
- if (err)
- goto fail;
+ input_register_device(input_dev);
mod_timer(&spitzkbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
@@ -431,15 +434,13 @@ static int __init spitzkbd_probe(struct platform_device *dev)
request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr,
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"Spitzkbd SWB", spitzkbd);
- request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr,
+ request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr,
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"Spitzkbd HP", spitzkbd);
- return 0;
+ printk(KERN_INFO "input: Spitz Keyboard Registered\n");
- fail: input_free_device(input_dev);
- kfree(spitzkbd);
- return err;
+ return 0;
}
static int spitzkbd_remove(struct platform_device *dev)
@@ -473,7 +474,6 @@ static struct platform_driver spitzkbd_driver = {
.resume = spitzkbd_resume,
.driver = {
.name = "spitz-keyboard",
- .owner = THIS_MODULE,
},
};
diff --git a/trunk/drivers/input/keyboard/stowaway.c b/trunk/drivers/input/keyboard/stowaway.c
index f7b5c5b81451..e60937d17b1c 100644
--- a/trunk/drivers/input/keyboard/stowaway.c
+++ b/trunk/drivers/input/keyboard/stowaway.c
@@ -173,7 +173,8 @@ static struct serio_driver skbd_drv = {
static int __init skbd_init(void)
{
- return serio_register_driver(&skbd_drv);
+ serio_register_driver(&skbd_drv);
+ return 0;
}
static void __exit skbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/sunkbd.c b/trunk/drivers/input/keyboard/sunkbd.c
index d6ab6d4b1fa8..cac4781103c3 100644
--- a/trunk/drivers/input/keyboard/sunkbd.c
+++ b/trunk/drivers/input/keyboard/sunkbd.c
@@ -243,7 +243,7 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
sunkbd = kzalloc(sizeof(struct sunkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!sunkbd || !input_dev)
- goto fail1;
+ goto fail;
sunkbd->serio = serio;
sunkbd->dev = input_dev;
@@ -255,11 +255,11 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
+ goto fail;
if (sunkbd_initialize(sunkbd) < 0) {
- err = -ENODEV;
- goto fail3;
+ serio_close(serio);
+ goto fail;
}
snprintf(sunkbd->name, sizeof(sunkbd->name), "Sun Type %d keyboard", sunkbd->type);
@@ -287,17 +287,11 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
clear_bit(0, input_dev->keybit);
sunkbd_enable(sunkbd, 1);
-
- err = input_register_device(sunkbd->dev);
- if (err)
- goto fail4;
-
+ input_register_device(sunkbd->dev);
return 0;
- fail4: sunkbd_enable(sunkbd, 0);
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(sunkbd);
return err;
}
@@ -352,7 +346,8 @@ static struct serio_driver sunkbd_drv = {
static int __init sunkbd_init(void)
{
- return serio_register_driver(&sunkbd_drv);
+ serio_register_driver(&sunkbd_drv);
+ return 0;
}
static void __exit sunkbd_exit(void)
diff --git a/trunk/drivers/input/keyboard/xtkbd.c b/trunk/drivers/input/keyboard/xtkbd.c
index a82093432138..8c11dc935454 100644
--- a/trunk/drivers/input/keyboard/xtkbd.c
+++ b/trunk/drivers/input/keyboard/xtkbd.c
@@ -95,7 +95,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!xtkbd || !input_dev)
- goto fail1;
+ goto fail;
xtkbd->serio = serio;
xtkbd->dev = input_dev;
@@ -124,17 +124,13 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(xtkbd->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(xtkbd->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(xtkbd);
return err;
}
@@ -174,7 +170,8 @@ static struct serio_driver xtkbd_drv = {
static int __init xtkbd_init(void)
{
- return serio_register_driver(&xtkbd_drv);
+ serio_register_driver(&xtkbd_drv);
+ return 0;
}
static void __exit xtkbd_exit(void)
diff --git a/trunk/drivers/input/mouse/amimouse.c b/trunk/drivers/input/mouse/amimouse.c
index 239a0e16d91a..599a7b2dc519 100644
--- a/trunk/drivers/input/mouse/amimouse.c
+++ b/trunk/drivers/input/mouse/amimouse.c
@@ -95,13 +95,10 @@ static void amimouse_close(struct input_dev *dev)
static int __init amimouse_init(void)
{
- int err;
-
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
return -ENODEV;
- amimouse_dev = input_allocate_device();
- if (!amimouse_dev)
+ if (!(amimouse_dev = input_allocate_device()))
return -ENOMEM;
amimouse_dev->name = "Amiga mouse";
@@ -117,11 +114,7 @@ static int __init amimouse_init(void)
amimouse_dev->open = amimouse_open;
amimouse_dev->close = amimouse_close;
- err = input_register_device(amimouse_dev);
- if (err) {
- input_free_device(amimouse_dev);
- return err;
- }
+ input_register_device(amimouse_dev);
return 0;
}
diff --git a/trunk/drivers/input/mouse/hil_ptr.c b/trunk/drivers/input/mouse/hil_ptr.c
index bfb174fe3230..4f2b503c1ac7 100644
--- a/trunk/drivers/input/mouse/hil_ptr.c
+++ b/trunk/drivers/input/mouse/hil_ptr.c
@@ -417,7 +417,8 @@ static struct serio_driver hil_ptr_serio_driver = {
static int __init hil_ptr_init(void)
{
- return serio_register_driver(&hil_ptr_serio_driver);
+ serio_register_driver(&hil_ptr_serio_driver);
+ return 0;
}
static void __exit hil_ptr_exit(void)
diff --git a/trunk/drivers/input/mouse/inport.c b/trunk/drivers/input/mouse/inport.c
index 13dd96785e39..e1252fa9a107 100644
--- a/trunk/drivers/input/mouse/inport.c
+++ b/trunk/drivers/input/mouse/inport.c
@@ -135,7 +135,6 @@ static void inport_close(struct input_dev *dev)
static int __init inport_init(void)
{
unsigned char a, b, c;
- int err;
if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) {
printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE);
@@ -146,16 +145,15 @@ static int __init inport_init(void)
b = inb(INPORT_SIGNATURE_PORT);
c = inb(INPORT_SIGNATURE_PORT);
if (a == b || a != c) {
+ release_region(INPORT_BASE, INPORT_EXTENT);
printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
- err = -ENODEV;
- goto err_release_region;
+ return -ENODEV;
}
- inport_dev = input_allocate_device();
- if (!inport_dev) {
+ if (!(inport_dev = input_allocate_device())) {
printk(KERN_ERR "inport.c: Not enough memory for input device\n");
- err = -ENOMEM;
- goto err_release_region;
+ release_region(INPORT_BASE, INPORT_EXTENT);
+ return -ENOMEM;
}
inport_dev->name = INPORT_NAME;
@@ -176,18 +174,9 @@ static int __init inport_init(void)
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
- err = input_register_device(inport_dev);
- if (err)
- goto err_free_dev;
+ input_register_device(inport_dev);
return 0;
-
- err_free_dev:
- input_free_device(inport_dev);
- err_release_region:
- release_region(INPORT_BASE, INPORT_EXTENT);
-
- return err;
}
static void __exit inport_exit(void)
diff --git a/trunk/drivers/input/mouse/lifebook.c b/trunk/drivers/input/mouse/lifebook.c
index 29542f0631cb..c57e8853b949 100644
--- a/trunk/drivers/input/mouse/lifebook.c
+++ b/trunk/drivers/input/mouse/lifebook.c
@@ -21,51 +21,47 @@
#include "lifebook.h"
static struct dmi_system_id lifebook_dmi_table[] = {
- {
- .ident = "FLORA-ie 55mi",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"),
- },
- },
- {
- .ident = "LifeBook B",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
- },
- },
- {
- .ident = "Lifebook B",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
- },
- },
- {
- .ident = "Lifebook B213x/B2150",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
- },
- },
- {
- .ident = "Zephyr",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
- },
- },
- {
- .ident = "CF-18",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
- },
- },
- {
- .ident = "Lifebook B142",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"),
- },
- },
- { }
+ {
+ .ident = "LifeBook B",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
+ },
+ },
+ {
+ .ident = "Lifebook B",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
+ },
+ },
+ {
+ .ident = "Lifebook B213x/B2150",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
+ },
+ },
+ {
+ .ident = "Zephyr",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
+ },
+ },
+ {
+ .ident = "CF-18",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
+ },
+ },
+ {
+ .ident = "Lifebook B142",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"),
+ },
+
+ },
+ { }
};
+
static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
{
unsigned char *packet = psmouse->packet;
diff --git a/trunk/drivers/input/mouse/logibm.c b/trunk/drivers/input/mouse/logibm.c
index db205995bffd..8e9c2f3d69a8 100644
--- a/trunk/drivers/input/mouse/logibm.c
+++ b/trunk/drivers/input/mouse/logibm.c
@@ -124,8 +124,6 @@ static void logibm_close(struct input_dev *dev)
static int __init logibm_init(void)
{
- int err;
-
if (!request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) {
printk(KERN_ERR "logibm.c: Can't allocate ports at %#x\n", LOGIBM_BASE);
return -EBUSY;
@@ -136,19 +134,18 @@ static int __init logibm_init(void)
udelay(100);
if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) {
+ release_region(LOGIBM_BASE, LOGIBM_EXTENT);
printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE);
- err = -ENODEV;
- goto err_release_region;
+ return -ENODEV;
}
outb(LOGIBM_DEFAULT_MODE, LOGIBM_CONFIG_PORT);
outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);
- logibm_dev = input_allocate_device();
- if (!logibm_dev) {
+ if (!(logibm_dev = input_allocate_device())) {
printk(KERN_ERR "logibm.c: Not enough memory for input device\n");
- err = -ENOMEM;
- goto err_release_region;
+ release_region(LOGIBM_BASE, LOGIBM_EXTENT);
+ return -ENOMEM;
}
logibm_dev->name = "Logitech bus mouse";
@@ -165,18 +162,9 @@ static int __init logibm_init(void)
logibm_dev->open = logibm_open;
logibm_dev->close = logibm_close;
- err = input_register_device(logibm_dev);
- if (err)
- goto err_free_dev;
+ input_register_device(logibm_dev);
return 0;
-
- err_free_dev:
- input_free_device(logibm_dev);
- err_release_region:
- release_region(LOGIBM_BASE, LOGIBM_EXTENT);
-
- return err;
}
static void __exit logibm_exit(void)
diff --git a/trunk/drivers/input/mouse/logips2pp.c b/trunk/drivers/input/mouse/logips2pp.c
index d3ddea26b8ca..8a4f862709e7 100644
--- a/trunk/drivers/input/mouse/logips2pp.c
+++ b/trunk/drivers/input/mouse/logips2pp.c
@@ -328,7 +328,6 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
unsigned char model, buttons;
const struct ps2pp_info *model_info;
int use_ps2pp = 0;
- int error;
param[0] = 0;
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
@@ -394,14 +393,8 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
psmouse->set_resolution = ps2pp_set_resolution;
psmouse->disconnect = ps2pp_disconnect;
- error = device_create_file(&psmouse->ps2dev.serio->dev,
- &psmouse_attr_smartscroll.dattr);
- if (error) {
- printk(KERN_ERR
- "logips2pp.c: failed to create smartscroll "
- "sysfs attribute, error: %d\n", error);
- return -1;
- }
+ device_create_file(&psmouse->ps2dev.serio->dev,
+ &psmouse_attr_smartscroll.dattr);
}
}
diff --git a/trunk/drivers/input/mouse/pc110pad.c b/trunk/drivers/input/mouse/pc110pad.c
index f155c1fea04e..8c075aa7223b 100644
--- a/trunk/drivers/input/mouse/pc110pad.c
+++ b/trunk/drivers/input/mouse/pc110pad.c
@@ -108,7 +108,6 @@ static int pc110pad_open(struct input_dev *dev)
static int __init pc110pad_init(void)
{
struct pci_dev *dev;
- int err;
dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
if (dev) {
@@ -125,16 +124,16 @@ static int __init pc110pad_init(void)
outb(PC110PAD_OFF, pc110pad_io + 2);
if (request_irq(pc110pad_irq, pc110pad_interrupt, 0, "pc110pad", NULL)) {
+ release_region(pc110pad_io, 4);
printk(KERN_ERR "pc110pad: Unable to get irq %d.\n", pc110pad_irq);
- err = -EBUSY;
- goto err_release_region;
+ return -EBUSY;
}
- pc110pad_dev = input_allocate_device();
- if (!pc110pad_dev) {
+ if (!(pc110pad_dev = input_allocate_device())) {
+ free_irq(pc110pad_irq, NULL);
+ release_region(pc110pad_io, 4);
printk(KERN_ERR "pc110pad: Not enough memory.\n");
- err = -ENOMEM;
- goto err_free_irq;
+ return -ENOMEM;
}
pc110pad_dev->name = "IBM PC110 TouchPad";
@@ -154,20 +153,9 @@ static int __init pc110pad_init(void)
pc110pad_dev->open = pc110pad_open;
pc110pad_dev->close = pc110pad_close;
- err = input_register_device(pc110pad_dev);
- if (err)
- goto err_free_dev;
+ input_register_device(pc110pad_dev);
return 0;
-
- err_free_dev:
- input_free_device(pc110pad_dev);
- err_free_irq:
- free_irq(pc110pad_irq, NULL);
- err_release_region:
- release_region(pc110pad_io, 4);
-
- return err;
}
static void __exit pc110pad_exit(void)
diff --git a/trunk/drivers/input/mouse/psmouse-base.c b/trunk/drivers/input/mouse/psmouse-base.c
index e626b1e737fa..6f9b2c7cc9c2 100644
--- a/trunk/drivers/input/mouse/psmouse-base.c
+++ b/trunk/drivers/input/mouse/psmouse-base.c
@@ -1102,7 +1102,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
{
struct psmouse *psmouse, *parent = NULL;
struct input_dev *input_dev;
- int retval = 0, error = -ENOMEM;
+ int retval = -ENOMEM;
mutex_lock(&psmouse_mutex);
@@ -1118,7 +1118,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
psmouse = kzalloc(sizeof(struct psmouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!psmouse || !input_dev)
- goto err_free;
+ goto out;
ps2_init(&psmouse->ps2dev, serio);
INIT_WORK(&psmouse->resync_work, psmouse_resync, psmouse);
@@ -1129,13 +1129,14 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
serio_set_drvdata(serio, psmouse);
- error = serio_open(serio, drv);
- if (error)
- goto err_clear_drvdata;
+ retval = serio_open(serio, drv);
+ if (retval)
+ goto out;
if (psmouse_probe(psmouse) < 0) {
- error = -ENODEV;
- goto err_close_serio;
+ serio_close(serio);
+ retval = -ENODEV;
+ goto out;
}
psmouse->rate = psmouse_rate;
@@ -1149,44 +1150,30 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
psmouse_initialize(psmouse);
- error = input_register_device(psmouse->dev);
- if (error)
- goto err_protocol_disconnect;
+ input_register_device(psmouse->dev);
if (parent && parent->pt_activate)
parent->pt_activate(parent);
- error = sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group);
- if (error)
- goto err_pt_deactivate;
+ sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group);
psmouse_activate(psmouse);
- out:
+ retval = 0;
+
+out:
+ if (retval) {
+ serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
+ kfree(psmouse);
+ }
+
/* If this is a pass-through port the parent needs to be re-activated */
if (parent)
psmouse_activate(parent);
mutex_unlock(&psmouse_mutex);
return retval;
-
- err_pt_deactivate:
- if (parent && parent->pt_deactivate)
- parent->pt_deactivate(parent);
- err_protocol_disconnect:
- if (psmouse->disconnect)
- psmouse->disconnect(psmouse);
- psmouse_set_state(psmouse, PSMOUSE_IGNORE);
- err_close_serio:
- serio_close(serio);
- err_clear_drvdata:
- serio_set_drvdata(serio, NULL);
- err_free:
- input_free_device(input_dev);
- kfree(psmouse);
-
- retval = error;
- goto out;
}
@@ -1349,14 +1336,14 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf)
{
- unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
+ unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
- return sprintf(buf, "%u\n", *field);
+ return sprintf(buf, "%lu\n", *field);
}
static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count)
{
- unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
+ unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
unsigned long value;
char *rest;
@@ -1364,9 +1351,6 @@ static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const
if (*rest)
return -EINVAL;
- if ((unsigned int)value != value)
- return -EINVAL;
-
*field = value;
return count;
@@ -1381,20 +1365,17 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
{
struct serio *serio = psmouse->ps2dev.serio;
struct psmouse *parent = NULL;
- struct input_dev *old_dev, *new_dev;
- const struct psmouse_protocol *proto, *old_proto;
- int error;
+ struct input_dev *new_dev;
+ const struct psmouse_protocol *proto;
int retry = 0;
- proto = psmouse_protocol_by_name(buf, count);
- if (!proto)
+ if (!(proto = psmouse_protocol_by_name(buf, count)))
return -EINVAL;
if (psmouse->type == proto->type)
return count;
- new_dev = input_allocate_device();
- if (!new_dev)
+ if (!(new_dev = input_allocate_device()))
return -ENOMEM;
while (serio->child) {
@@ -1427,13 +1408,11 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
parent->pt_deactivate(parent);
}
- old_dev = psmouse->dev;
- old_proto = psmouse_protocol_by_type(psmouse->type);
-
if (psmouse->disconnect)
psmouse->disconnect(psmouse);
psmouse_set_state(psmouse, PSMOUSE_IGNORE);
+ input_unregister_device(psmouse->dev);
psmouse->dev = new_dev;
psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
@@ -1447,23 +1426,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
psmouse_initialize(psmouse);
psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
- error = input_register_device(psmouse->dev);
- if (error) {
- if (psmouse->disconnect)
- psmouse->disconnect(psmouse);
-
- psmouse_set_state(psmouse, PSMOUSE_IGNORE);
- input_free_device(new_dev);
- psmouse->dev = old_dev;
- psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
- psmouse_switch_protocol(psmouse, old_proto);
- psmouse_initialize(psmouse);
- psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
-
- return error;
- }
-
- input_unregister_device(old_dev);
+ input_register_device(psmouse->dev);
if (parent && parent->pt_activate)
parent->pt_activate(parent);
@@ -1524,19 +1487,15 @@ static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
static int __init psmouse_init(void)
{
- int err;
-
kpsmoused_wq = create_singlethread_workqueue("kpsmoused");
if (!kpsmoused_wq) {
printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n");
return -ENOMEM;
}
- err = serio_register_driver(&psmouse_drv);
- if (err)
- destroy_workqueue(kpsmoused_wq);
+ serio_register_driver(&psmouse_drv);
- return err;
+ return 0;
}
static void __exit psmouse_exit(void)
diff --git a/trunk/drivers/input/mouse/rpcmouse.c b/trunk/drivers/input/mouse/rpcmouse.c
index fbdcfd8eb4e9..ea0468569610 100644
--- a/trunk/drivers/input/mouse/rpcmouse.c
+++ b/trunk/drivers/input/mouse/rpcmouse.c
@@ -66,10 +66,7 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id)
static int __init rpcmouse_init(void)
{
- int err;
-
- rpcmouse_dev = input_allocate_device();
- if (!rpcmouse_dev)
+ if (!(rpcmouse_dev = input_allocate_device()))
return -ENOMEM;
rpcmouse_dev->name = "Acorn RiscPC Mouse";
@@ -88,22 +85,13 @@ static int __init rpcmouse_init(void)
if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) {
printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n");
- err = -EBUSY;
- goto err_free_dev;
+ input_free_device(rpcmouse_dev);
+ return -EBUSY;
}
- err = input_register_device(rpcmouse_dev);
- if (err)
- goto err_free_irq;
+ input_register_device(rpcmouse_dev);
return 0;
-
- err_free_irq:
- free_irq(IRQ_VSYNCPULSE, rpcmouse_dev);
- err_free_dev:
- input_free_device(rpcmouse_dev);
-
- return err;
}
static void __exit rpcmouse_exit(void)
diff --git a/trunk/drivers/input/mouse/sermouse.c b/trunk/drivers/input/mouse/sermouse.c
index a85d74710b44..2a272c5daf08 100644
--- a/trunk/drivers/input/mouse/sermouse.c
+++ b/trunk/drivers/input/mouse/sermouse.c
@@ -246,7 +246,7 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!sermouse || !input_dev)
- goto fail1;
+ goto fail;
sermouse->dev = input_dev;
snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys);
@@ -275,17 +275,14 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
+ goto fail;
- err = input_register_device(sermouse->dev);
- if (err)
- goto fail3;
+ input_register_device(sermouse->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(sermouse);
return err;
}
@@ -351,7 +348,8 @@ static struct serio_driver sermouse_drv = {
static int __init sermouse_init(void)
{
- return serio_register_driver(&sermouse_drv);
+ serio_register_driver(&sermouse_drv);
+ return 0;
}
static void __exit sermouse_exit(void)
diff --git a/trunk/drivers/input/mouse/trackpoint.c b/trunk/drivers/input/mouse/trackpoint.c
index 9ab5b5ea809d..ae5871a0e060 100644
--- a/trunk/drivers/input/mouse/trackpoint.c
+++ b/trunk/drivers/input/mouse/trackpoint.c
@@ -293,7 +293,6 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char firmware_id;
unsigned char button_info;
- int error;
if (trackpoint_start_protocol(psmouse, &firmware_id))
return -1;
@@ -306,7 +305,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
button_info = 0;
}
- psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
+ psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL);
if (!priv)
return -1;
@@ -319,14 +318,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
trackpoint_defaults(priv);
trackpoint_sync(psmouse);
- error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
- if (error) {
- printk(KERN_ERR
- "trackpoint.c: failed to create sysfs attributes, error: %d\n",
- error);
- kfree(priv);
- return -1;
- }
+ sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n",
firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f);
diff --git a/trunk/drivers/input/mouse/vsxxxaa.c b/trunk/drivers/input/mouse/vsxxxaa.c
index c3d64fcc858d..ffdb50eee93d 100644
--- a/trunk/drivers/input/mouse/vsxxxaa.c
+++ b/trunk/drivers/input/mouse/vsxxxaa.c
@@ -497,7 +497,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL);
input_dev = input_allocate_device ();
if (!mouse || !input_dev)
- goto fail1;
+ goto fail;
mouse->dev = input_dev;
mouse->serio = serio;
@@ -527,7 +527,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
err = serio_open (serio, drv);
if (err)
- goto fail2;
+ goto fail;
/*
* Request selftest. Standard packet format and differential
@@ -535,15 +535,12 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
*/
serio->write (serio, 'T'); /* Test */
- err = input_register_device (input_dev);
- if (err)
- goto fail3;
+ input_register_device (input_dev);
return 0;
- fail3: serio_close (serio);
- fail2: serio_set_drvdata (serio, NULL);
- fail1: input_free_device (input_dev);
+ fail: serio_set_drvdata (serio, NULL);
+ input_free_device (input_dev);
kfree (mouse);
return err;
}
@@ -574,7 +571,8 @@ static struct serio_driver vsxxxaa_drv = {
static int __init
vsxxxaa_init (void)
{
- return serio_register_driver(&vsxxxaa_drv);
+ serio_register_driver(&vsxxxaa_drv);
+ return 0;
}
static void __exit
diff --git a/trunk/drivers/input/mousedev.c b/trunk/drivers/input/mousedev.c
index 664bcc8116fc..a22a74a2a3dc 100644
--- a/trunk/drivers/input/mousedev.c
+++ b/trunk/drivers/input/mousedev.c
@@ -196,12 +196,12 @@ static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int
switch (code) {
case BTN_TOUCH:
case BTN_0:
+ case BTN_FORWARD:
case BTN_LEFT: index = 0; break;
case BTN_STYLUS:
case BTN_1:
case BTN_RIGHT: index = 1; break;
case BTN_2:
- case BTN_FORWARD:
case BTN_STYLUS2:
case BTN_MIDDLE: index = 2; break;
case BTN_3:
diff --git a/trunk/drivers/input/serio/i8042.c b/trunk/drivers/input/serio/i8042.c
index debe9445488c..7e3141f37e32 100644
--- a/trunk/drivers/input/serio/i8042.c
+++ b/trunk/drivers/input/serio/i8042.c
@@ -255,10 +255,25 @@ static int i8042_kbd_write(struct serio *port, unsigned char c)
static int i8042_aux_write(struct serio *serio, unsigned char c)
{
struct i8042_port *port = serio->port_data;
+ int retval;
+
+/*
+ * Send the byte out.
+ */
+
+ if (port->mux == -1)
+ retval = i8042_command(&c, I8042_CMD_AUX_SEND);
+ else
+ retval = i8042_command(&c, I8042_CMD_MUX_SEND + port->mux);
+
+/*
+ * Make sure the interrupt happens and the character is received even
+ * in the case the IRQ isn't wired, so that we can receive further
+ * characters later.
+ */
- return i8042_command(&c, port->mux == -1 ?
- I8042_CMD_AUX_SEND :
- I8042_CMD_MUX_SEND + port->mux);
+ i8042_interrupt(0, NULL);
+ return retval;
}
/*
@@ -322,27 +337,23 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
dfl = 0;
if (str & I8042_STR_MUXERR) {
dbg("MUX error, status is %02x, data is %02x", str, data);
+ switch (data) {
+ default:
/*
* When MUXERR condition is signalled the data register can only contain
* 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately
- * it is not always the case. Some KBCs also report 0xfc when there is
- * nothing connected to the port while others sometimes get confused which
- * port the data came from and signal error leaving the data intact. They
- * _do not_ revert to legacy mode (actually I've never seen KBC reverting
- * to legacy mode yet, when we see one we'll add proper handling).
- * Anyway, we process 0xfc, 0xfd, 0xfe and 0xff as timeouts, and for the
- * rest assume that the data came from the same serio last byte
+ * it is not always the case. Some KBC just get confused which port the
+ * data came from and signal error leaving the data intact. They _do not_
+ * revert to legacy mode (actually I've never seen KBC reverting to legacy
+ * mode yet, when we see one we'll add proper handling).
+ * Anyway, we will assume that the data came from the same serio last byte
* was transmitted (if transmission happened not too long ago).
*/
-
- switch (data) {
- default:
if (time_before(jiffies, last_transmit + HZ/10)) {
str = last_str;
break;
}
/* fall through - report timeout */
- case 0xfc:
case 0xfd:
case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break;
case 0xff: dfl = SERIO_PARITY; data = 0xfe; break;
diff --git a/trunk/drivers/input/serio/serio.c b/trunk/drivers/input/serio/serio.c
index 8c717042f611..211943f85cb6 100644
--- a/trunk/drivers/input/serio/serio.c
+++ b/trunk/drivers/input/serio/serio.c
@@ -44,7 +44,8 @@ EXPORT_SYMBOL(serio_interrupt);
EXPORT_SYMBOL(__serio_register_port);
EXPORT_SYMBOL(serio_unregister_port);
EXPORT_SYMBOL(serio_unregister_child_port);
-EXPORT_SYMBOL(serio_register_driver);
+EXPORT_SYMBOL(__serio_unregister_port_delayed);
+EXPORT_SYMBOL(__serio_register_driver);
EXPORT_SYMBOL(serio_unregister_driver);
EXPORT_SYMBOL(serio_open);
EXPORT_SYMBOL(serio_close);
@@ -61,10 +62,11 @@ static LIST_HEAD(serio_list);
static struct bus_type serio_bus;
+static void serio_add_driver(struct serio_driver *drv);
static void serio_add_port(struct serio *serio);
+static void serio_destroy_port(struct serio *serio);
static void serio_reconnect_port(struct serio *serio);
static void serio_disconnect_port(struct serio *serio);
-static void serio_attach_driver(struct serio_driver *drv);
static int serio_connect_driver(struct serio *serio, struct serio_driver *drv)
{
@@ -168,10 +170,11 @@ static void serio_find_driver(struct serio *serio)
*/
enum serio_event_type {
- SERIO_RESCAN_PORT,
- SERIO_RECONNECT_PORT,
+ SERIO_RESCAN,
+ SERIO_RECONNECT,
SERIO_REGISTER_PORT,
- SERIO_ATTACH_DRIVER,
+ SERIO_UNREGISTER_PORT,
+ SERIO_REGISTER_DRIVER,
};
struct serio_event {
@@ -186,12 +189,11 @@ static LIST_HEAD(serio_event_list);
static DECLARE_WAIT_QUEUE_HEAD(serio_wait);
static struct task_struct *serio_task;
-static int serio_queue_event(void *object, struct module *owner,
- enum serio_event_type event_type)
+static void serio_queue_event(void *object, struct module *owner,
+ enum serio_event_type event_type)
{
unsigned long flags;
struct serio_event *event;
- int retval = 0;
spin_lock_irqsave(&serio_event_lock, flags);
@@ -210,34 +212,24 @@ static int serio_queue_event(void *object, struct module *owner,
}
}
- event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
- if (!event) {
- printk(KERN_ERR
- "serio: Not enough memory to queue event %d\n",
- event_type);
- retval = -ENOMEM;
- goto out;
- }
-
- if (!try_module_get(owner)) {
- printk(KERN_WARNING
- "serio: Can't get module reference, dropping event %d\n",
- event_type);
- kfree(event);
- retval = -EINVAL;
- goto out;
- }
-
- event->type = event_type;
- event->object = object;
- event->owner = owner;
+ if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) {
+ if (!try_module_get(owner)) {
+ printk(KERN_WARNING "serio: Can't get module reference, dropping event %d\n", event_type);
+ kfree(event);
+ goto out;
+ }
- list_add_tail(&event->node, &serio_event_list);
- wake_up(&serio_wait);
+ event->type = event_type;
+ event->object = object;
+ event->owner = owner;
+ list_add_tail(&event->node, &serio_event_list);
+ wake_up(&serio_wait);
+ } else {
+ printk(KERN_ERR "serio: Not enough memory to queue event %d\n", event_type);
+ }
out:
spin_unlock_irqrestore(&serio_event_lock, flags);
- return retval;
}
static void serio_free_event(struct serio_event *event)
@@ -315,17 +307,22 @@ static void serio_handle_event(void)
serio_add_port(event->object);
break;
- case SERIO_RECONNECT_PORT:
+ case SERIO_UNREGISTER_PORT:
+ serio_disconnect_port(event->object);
+ serio_destroy_port(event->object);
+ break;
+
+ case SERIO_RECONNECT:
serio_reconnect_port(event->object);
break;
- case SERIO_RESCAN_PORT:
+ case SERIO_RESCAN:
serio_disconnect_port(event->object);
serio_find_driver(event->object);
break;
- case SERIO_ATTACH_DRIVER:
- serio_attach_driver(event->object);
+ case SERIO_REGISTER_DRIVER:
+ serio_add_driver(event->object);
break;
default:
@@ -677,12 +674,12 @@ static void serio_disconnect_port(struct serio *serio)
void serio_rescan(struct serio *serio)
{
- serio_queue_event(serio, NULL, SERIO_RESCAN_PORT);
+ serio_queue_event(serio, NULL, SERIO_RESCAN);
}
void serio_reconnect(struct serio *serio)
{
- serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
+ serio_queue_event(serio, NULL, SERIO_RECONNECT);
}
/*
@@ -719,6 +716,16 @@ void serio_unregister_child_port(struct serio *serio)
mutex_unlock(&serio_mutex);
}
+/*
+ * Submits register request to kseriod for subsequent execution.
+ * Can be used when it is not obvious whether the serio_mutex is
+ * taken or not and when delayed execution is feasible.
+ */
+void __serio_unregister_port_delayed(struct serio *serio, struct module *owner)
+{
+ serio_queue_event(serio, owner, SERIO_UNREGISTER_PORT);
+}
+
/*
* Serio driver operations
@@ -777,52 +784,28 @@ static int serio_driver_remove(struct device *dev)
return 0;
}
-static void serio_attach_driver(struct serio_driver *drv)
-{
- int error;
-
- error = driver_attach(&drv->driver);
- if (error)
- printk(KERN_WARNING
- "serio: driver_attach() failed for %s with error %d\n",
- drv->driver.name, error);
-}
+static struct bus_type serio_bus = {
+ .name = "serio",
+ .probe = serio_driver_probe,
+ .remove = serio_driver_remove,
+};
-int serio_register_driver(struct serio_driver *drv)
+static void serio_add_driver(struct serio_driver *drv)
{
- int manual_bind = drv->manual_bind;
int error;
- drv->driver.bus = &serio_bus;
-
- /*
- * Temporarily disable automatic binding because probing
- * takes long time and we are better off doing it in kseriod
- */
- drv->manual_bind = 1;
-
error = driver_register(&drv->driver);
- if (error) {
+ if (error)
printk(KERN_ERR
"serio: driver_register() failed for %s, error: %d\n",
drv->driver.name, error);
- return error;
- }
+}
- /*
- * Restore original bind mode and let kseriod bind the
- * driver to free ports
- */
- if (!manual_bind) {
- drv->manual_bind = 0;
- error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
- if (error) {
- driver_unregister(&drv->driver);
- return error;
- }
- }
+void __serio_register_driver(struct serio_driver *drv, struct module *owner)
+{
+ drv->driver.bus = &serio_bus;
- return 0;
+ serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
}
void serio_unregister_driver(struct serio_driver *drv)
@@ -963,21 +946,15 @@ irqreturn_t serio_interrupt(struct serio *serio,
return ret;
}
-static struct bus_type serio_bus = {
- .name = "serio",
- .dev_attrs = serio_device_attrs,
- .drv_attrs = serio_driver_attrs,
- .match = serio_bus_match,
- .uevent = serio_uevent,
- .probe = serio_driver_probe,
- .remove = serio_driver_remove,
- .resume = serio_resume,
-};
-
static int __init serio_init(void)
{
int error;
+ serio_bus.dev_attrs = serio_device_attrs;
+ serio_bus.drv_attrs = serio_driver_attrs;
+ serio_bus.match = serio_bus_match;
+ serio_bus.uevent = serio_uevent;
+ serio_bus.resume = serio_resume;
error = bus_register(&serio_bus);
if (error) {
printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
diff --git a/trunk/drivers/input/serio/serio_raw.c b/trunk/drivers/input/serio/serio_raw.c
index 0e343a6cacc9..ba2a2035d648 100644
--- a/trunk/drivers/input/serio/serio_raw.c
+++ b/trunk/drivers/input/serio/serio_raw.c
@@ -389,7 +389,8 @@ static struct serio_driver serio_raw_drv = {
static int __init serio_raw_init(void)
{
- return serio_register_driver(&serio_raw_drv);
+ serio_register_driver(&serio_raw_drv);
+ return 0;
}
static void __exit serio_raw_exit(void)
diff --git a/trunk/drivers/input/touchscreen/Kconfig b/trunk/drivers/input/touchscreen/Kconfig
index 29ca0ab0acb8..9418bbe47072 100644
--- a/trunk/drivers/input/touchscreen/Kconfig
+++ b/trunk/drivers/input/touchscreen/Kconfig
@@ -144,19 +144,4 @@ config TOUCHSCREEN_TOUCHWIN
To compile this driver as a module, choose M here: the
module will be called touchwin.
-config TOUCHSCREEN_UCB1400
- tristate "Philips UCB1400 touchscreen"
- select SND_AC97_BUS
- help
- This enables support for the Philips UCB1400 touchscreen interface.
- The UCB1400 is an AC97 audio codec. The touchscreen interface
- will be initialized only after the ALSA subsystem has been
- brought up and the UCB1400 detected. You therefore have to
- configure ALSA support as well (either built-in or modular,
- independently of whether this driver is itself built-in or
- modular) for this driver to work.
-
- To compile this driver as a module, choose M here: the
- module will be called ucb1400_ts.
-
endif
diff --git a/trunk/drivers/input/touchscreen/Makefile b/trunk/drivers/input/touchscreen/Makefile
index 30e6e2217a15..1abb8f10d608 100644
--- a/trunk/drivers/input/touchscreen/Makefile
+++ b/trunk/drivers/input/touchscreen/Makefile
@@ -15,4 +15,3 @@ obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
-obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
diff --git a/trunk/drivers/input/touchscreen/ads7846.c b/trunk/drivers/input/touchscreen/ads7846.c
index 8f56af8cd7a0..f56d6a0f0624 100644
--- a/trunk/drivers/input/touchscreen/ads7846.c
+++ b/trunk/drivers/input/touchscreen/ads7846.c
@@ -76,7 +76,6 @@ struct ads7846 {
char phys[32];
struct spi_device *spi;
- struct attribute_group *attr_group;
u16 model;
u16 vref_delay_usecs;
u16 x_plate_ohms;
@@ -318,48 +317,6 @@ static ssize_t ads7846_disable_store(struct device *dev,
static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
-static struct attribute *ads7846_attributes[] = {
- &dev_attr_temp0.attr,
- &dev_attr_temp1.attr,
- &dev_attr_vbatt.attr,
- &dev_attr_vaux.attr,
- &dev_attr_pen_down.attr,
- &dev_attr_disable.attr,
- NULL,
-};
-
-static struct attribute_group ads7846_attr_group = {
- .attrs = ads7846_attributes,
-};
-
-/*
- * ads7843/7845 don't have temperature sensors, and
- * use the other sensors a bit differently too
- */
-
-static struct attribute *ads7843_attributes[] = {
- &dev_attr_vbatt.attr,
- &dev_attr_vaux.attr,
- &dev_attr_pen_down.attr,
- &dev_attr_disable.attr,
- NULL,
-};
-
-static struct attribute_group ads7843_attr_group = {
- .attrs = ads7843_attributes,
-};
-
-static struct attribute *ads7845_attributes[] = {
- &dev_attr_vaux.attr,
- &dev_attr_pen_down.attr,
- &dev_attr_disable.attr,
- NULL,
-};
-
-static struct attribute_group ads7845_attr_group = {
- .attrs = ads7845_attributes,
-};
-
/*--------------------------------------------------------------------------*/
/*
@@ -831,30 +788,38 @@ static int __devinit ads7846_probe(struct spi_device *spi)
(void) ads7846_read12_ser(&spi->dev,
READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
- switch (ts->model) {
- case 7846:
- ts->attr_group = &ads7846_attr_group;
- break;
- case 7845:
- ts->attr_group = &ads7845_attr_group;
- break;
- default:
- ts->attr_group = &ads7843_attr_group;
- break;
+ /* ads7843/7845 don't have temperature sensors, and
+ * use the other sensors a bit differently too
+ */
+ if (ts->model == 7846) {
+ device_create_file(&spi->dev, &dev_attr_temp0);
+ device_create_file(&spi->dev, &dev_attr_temp1);
}
- err = sysfs_create_group(&spi->dev.kobj, ts->attr_group);
- if (err)
- goto err_free_irq;
+ if (ts->model != 7845)
+ device_create_file(&spi->dev, &dev_attr_vbatt);
+ device_create_file(&spi->dev, &dev_attr_vaux);
+
+ device_create_file(&spi->dev, &dev_attr_pen_down);
+
+ device_create_file(&spi->dev, &dev_attr_disable);
err = input_register_device(input_dev);
if (err)
- goto err_remove_attr_group;
+ goto err_remove_attr;
return 0;
- err_remove_attr_group:
- sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
- err_free_irq:
+ err_remove_attr:
+ device_remove_file(&spi->dev, &dev_attr_disable);
+ device_remove_file(&spi->dev, &dev_attr_pen_down);
+ if (ts->model == 7846) {
+ device_remove_file(&spi->dev, &dev_attr_temp1);
+ device_remove_file(&spi->dev, &dev_attr_temp0);
+ }
+ if (ts->model != 7845)
+ device_remove_file(&spi->dev, &dev_attr_vbatt);
+ device_remove_file(&spi->dev, &dev_attr_vaux);
+
free_irq(spi->irq, ts);
err_free_mem:
input_free_device(input_dev);
@@ -870,7 +835,15 @@ static int __devexit ads7846_remove(struct spi_device *spi)
ads7846_suspend(spi, PMSG_SUSPEND);
- sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
+ device_remove_file(&spi->dev, &dev_attr_disable);
+ device_remove_file(&spi->dev, &dev_attr_pen_down);
+ if (ts->model == 7846) {
+ device_remove_file(&spi->dev, &dev_attr_temp1);
+ device_remove_file(&spi->dev, &dev_attr_temp0);
+ }
+ if (ts->model != 7845)
+ device_remove_file(&spi->dev, &dev_attr_vbatt);
+ device_remove_file(&spi->dev, &dev_attr_vaux);
free_irq(ts->spi->irq, ts);
/* suspend left the IRQ disabled */
diff --git a/trunk/drivers/input/touchscreen/corgi_ts.c b/trunk/drivers/input/touchscreen/corgi_ts.c
index e2945582828e..66121f6a89ad 100644
--- a/trunk/drivers/input/touchscreen/corgi_ts.c
+++ b/trunk/drivers/input/touchscreen/corgi_ts.c
@@ -175,19 +175,17 @@ static int read_xydata(struct corgi_ts *corgi_ts)
static void new_data(struct corgi_ts *corgi_ts)
{
- struct input_dev *dev = corgi_ts->input;
-
if (corgi_ts->power_mode != PWR_MODE_ACTIVE)
return;
if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0)
return;
- input_report_abs(dev, ABS_X, corgi_ts->tc.x);
- input_report_abs(dev, ABS_Y, corgi_ts->tc.y);
- input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
- input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
- input_sync(dev);
+ input_report_abs(corgi_ts->input, ABS_X, corgi_ts->tc.x);
+ input_report_abs(corgi_ts->input, ABS_Y, corgi_ts->tc.y);
+ input_report_abs(corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure);
+ input_report_key(corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0));
+ input_sync(corgi_ts->input);
}
static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer)
@@ -221,14 +219,12 @@ static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer)
static void corgi_ts_timer(unsigned long data)
{
struct corgi_ts *corgits_data = (struct corgi_ts *) data;
-
ts_interrupt_main(corgits_data, 1);
}
static irqreturn_t ts_interrupt(int irq, void *dev_id)
{
struct corgi_ts *corgits_data = dev_id;
-
ts_interrupt_main(corgits_data, 0);
return IRQ_HANDLED;
}
@@ -276,7 +272,7 @@ static int __init corgits_probe(struct platform_device *pdev)
corgi_ts = kzalloc(sizeof(struct corgi_ts), GFP_KERNEL);
input_dev = input_allocate_device();
if (!corgi_ts || !input_dev)
- goto fail1;
+ goto fail;
platform_set_drvdata(pdev, corgi_ts);
@@ -285,7 +281,7 @@ static int __init corgits_probe(struct platform_device *pdev)
if (corgi_ts->irq_gpio < 0) {
err = -ENODEV;
- goto fail1;
+ goto fail;
}
corgi_ts->input = input_dev;
@@ -323,12 +319,10 @@ static int __init corgits_probe(struct platform_device *pdev)
if (request_irq(corgi_ts->irq_gpio, ts_interrupt, IRQF_DISABLED, "ts", corgi_ts)) {
err = -EBUSY;
- goto fail1;
+ goto fail;
}
- err = input_register_device(corgi_ts->input);
- if (err)
- goto fail2;
+ input_register_device(corgi_ts->input);
corgi_ts->power_mode = PWR_MODE_ACTIVE;
@@ -337,17 +331,17 @@ static int __init corgits_probe(struct platform_device *pdev)
return 0;
- fail2: free_irq(corgi_ts->irq_gpio, corgi_ts);
- fail1: input_free_device(input_dev);
+ fail: input_free_device(input_dev);
kfree(corgi_ts);
return err;
+
}
static int corgits_remove(struct platform_device *pdev)
{
struct corgi_ts *corgi_ts = platform_get_drvdata(pdev);
- free_irq(corgi_ts->irq_gpio, corgi_ts);
+ free_irq(corgi_ts->irq_gpio, NULL);
del_timer_sync(&corgi_ts->timer);
corgi_ts->machinfo->put_hsync();
input_unregister_device(corgi_ts->input);
diff --git a/trunk/drivers/input/touchscreen/elo.c b/trunk/drivers/input/touchscreen/elo.c
index 9d61cd133d01..913e1b73bb0e 100644
--- a/trunk/drivers/input/touchscreen/elo.c
+++ b/trunk/drivers/input/touchscreen/elo.c
@@ -397,7 +397,8 @@ static struct serio_driver elo_drv = {
static int __init elo_init(void)
{
- return serio_register_driver(&elo_drv);
+ serio_register_driver(&elo_drv);
+ return 0;
}
static void __exit elo_exit(void)
diff --git a/trunk/drivers/input/touchscreen/gunze.c b/trunk/drivers/input/touchscreen/gunze.c
index 9157eb148e84..817c2198933d 100644
--- a/trunk/drivers/input/touchscreen/gunze.c
+++ b/trunk/drivers/input/touchscreen/gunze.c
@@ -123,7 +123,7 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
input_dev = input_allocate_device();
if (!gunze || !input_dev) {
err = -ENOMEM;
- goto fail1;
+ goto fail;
}
gunze->serio = serio;
@@ -146,17 +146,13 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
-
- err = input_register_device(gunze->dev);
- if (err)
- goto fail3;
+ goto fail;
+ input_register_device(gunze->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(gunze);
return err;
}
@@ -194,7 +190,8 @@ static struct serio_driver gunze_drv = {
static int __init gunze_init(void)
{
- return serio_register_driver(&gunze_drv);
+ serio_register_driver(&gunze_drv);
+ return 0;
}
static void __exit gunze_exit(void)
diff --git a/trunk/drivers/input/touchscreen/h3600_ts_input.c b/trunk/drivers/input/touchscreen/h3600_ts_input.c
index c4116d4f64e7..d9e61ee05ea9 100644
--- a/trunk/drivers/input/touchscreen/h3600_ts_input.c
+++ b/trunk/drivers/input/touchscreen/h3600_ts_input.c
@@ -478,7 +478,8 @@ static struct serio_driver h3600ts_drv = {
static int __init h3600ts_init(void)
{
- return serio_register_driver(&h3600ts_drv);
+ serio_register_driver(&h3600ts_drv);
+ return 0;
}
static void __exit h3600ts_exit(void)
diff --git a/trunk/drivers/input/touchscreen/hp680_ts_input.c b/trunk/drivers/input/touchscreen/hp680_ts_input.c
index 249087472740..58fca316786c 100644
--- a/trunk/drivers/input/touchscreen/hp680_ts_input.c
+++ b/trunk/drivers/input/touchscreen/hp680_ts_input.c
@@ -76,47 +76,38 @@ static irqreturn_t hp680_ts_interrupt(int irq, void *dev)
static int __init hp680_ts_init(void)
{
- int err;
-
hp680_ts_dev = input_allocate_device();
if (!hp680_ts_dev)
return -ENOMEM;
hp680_ts_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY);
+ hp680_ts_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
hp680_ts_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
- input_set_abs_params(hp680_ts_dev, ABS_X,
- HP680_TS_ABS_X_MIN, HP680_TS_ABS_X_MAX, 0, 0);
- input_set_abs_params(hp680_ts_dev, ABS_Y,
- HP680_TS_ABS_Y_MIN, HP680_TS_ABS_Y_MAX, 0, 0);
+ hp680_ts_dev->absmin[ABS_X] = HP680_TS_ABS_X_MIN;
+ hp680_ts_dev->absmin[ABS_Y] = HP680_TS_ABS_Y_MIN;
+ hp680_ts_dev->absmax[ABS_X] = HP680_TS_ABS_X_MAX;
+ hp680_ts_dev->absmax[ABS_Y] = HP680_TS_ABS_Y_MAX;
hp680_ts_dev->name = "HP Jornada touchscreen";
hp680_ts_dev->phys = "hp680_ts/input0";
+ input_register_device(hp680_ts_dev);
+
if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt,
IRQF_DISABLED, MODNAME, 0) < 0) {
printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n",
HP680_TS_IRQ);
- err = -EBUSY;
- goto fail1;
+ input_unregister_device(hp680_ts_dev);
+ return -EBUSY;
}
- err = input_register_device(hp680_ts_dev);
- if (err)
- goto fail2;
-
return 0;
-
- fail2: free_irq(HP680_TS_IRQ, NULL);
- cancel_delayed_work(&work);
- flush_scheduled_work();
- fail1: input_free_device(hp680_ts_dev);
- return err;
}
static void __exit hp680_ts_exit(void)
{
- free_irq(HP680_TS_IRQ, NULL);
+ free_irq(HP680_TS_IRQ, 0);
cancel_delayed_work(&work);
flush_scheduled_work();
input_unregister_device(hp680_ts_dev);
diff --git a/trunk/drivers/input/touchscreen/mk712.c b/trunk/drivers/input/touchscreen/mk712.c
index 44140feeffc5..4cbcaa6a71e5 100644
--- a/trunk/drivers/input/touchscreen/mk712.c
+++ b/trunk/drivers/input/touchscreen/mk712.c
@@ -96,13 +96,15 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id)
goto end;
}
- if (~status & MK712_STATUS_TOUCH) {
+ if (~status & MK712_STATUS_TOUCH)
+ {
debounce = 1;
input_report_key(mk712_dev, BTN_TOUCH, 0);
goto end;
}
- if (debounce) {
+ if (debounce)
+ {
debounce = 0;
goto end;
}
@@ -111,7 +113,8 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id)
input_report_abs(mk712_dev, ABS_X, last_x);
input_report_abs(mk712_dev, ABS_Y, last_y);
- end:
+end:
+
last_x = inw(mk712_io + MK712_X) & 0x0fff;
last_y = inw(mk712_io + MK712_Y) & 0x0fff;
input_sync(mk712_dev);
@@ -166,14 +169,13 @@ static int __init mk712_init(void)
(inw(mk712_io + MK712_STATUS) & 0xf333)) {
printk(KERN_WARNING "mk712: device not present\n");
err = -ENODEV;
- goto fail1;
+ goto fail;
}
- mk712_dev = input_allocate_device();
- if (!mk712_dev) {
+ if (!(mk712_dev = input_allocate_device())) {
printk(KERN_ERR "mk712: not enough memory\n");
err = -ENOMEM;
- goto fail1;
+ goto fail;
}
mk712_dev->name = "ICS MicroClock MK712 TouchScreen";
@@ -194,17 +196,13 @@ static int __init mk712_init(void)
if (request_irq(mk712_irq, mk712_interrupt, 0, "mk712", mk712_dev)) {
printk(KERN_WARNING "mk712: unable to get IRQ\n");
err = -EBUSY;
- goto fail1;
+ goto fail;
}
- err = input_register_device(mk712_dev);
- if (err)
- goto fail2;
-
+ input_register_device(mk712_dev);
return 0;
- fail2: free_irq(mk712_irq, mk712_dev);
- fail1: input_free_device(mk712_dev);
+ fail: input_free_device(mk712_dev);
release_region(mk712_io, 8);
return err;
}
diff --git a/trunk/drivers/input/touchscreen/mtouch.c b/trunk/drivers/input/touchscreen/mtouch.c
index c3c2d735d0ec..3b4c61664b63 100644
--- a/trunk/drivers/input/touchscreen/mtouch.c
+++ b/trunk/drivers/input/touchscreen/mtouch.c
@@ -137,7 +137,7 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
input_dev = input_allocate_device();
if (!mtouch || !input_dev) {
err = -ENOMEM;
- goto fail1;
+ goto fail;
}
mtouch->serio = serio;
@@ -160,17 +160,14 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail2;
+ goto fail;
- err = input_register_device(mtouch->dev);
- if (err)
- goto fail3;
+ input_register_device(mtouch->dev);
return 0;
- fail3: serio_close(serio);
- fail2: serio_set_drvdata(serio, NULL);
- fail1: input_free_device(input_dev);
+ fail: serio_set_drvdata(serio, NULL);
+ input_free_device(input_dev);
kfree(mtouch);
return err;
}
@@ -208,7 +205,8 @@ static struct serio_driver mtouch_drv = {
static int __init mtouch_init(void)
{
- return serio_register_driver(&mtouch_drv);
+ serio_register_driver(&mtouch_drv);
+ return 0;
}
static void __exit mtouch_exit(void)
diff --git a/trunk/drivers/input/touchscreen/penmount.c b/trunk/drivers/input/touchscreen/penmount.c
index bd2767991ae9..6c7d0c2c76cc 100644
--- a/trunk/drivers/input/touchscreen/penmount.c
+++ b/trunk/drivers/input/touchscreen/penmount.c
@@ -171,7 +171,8 @@ static struct serio_driver pm_drv = {
static int __init pm_init(void)
{
- return serio_register_driver(&pm_drv);
+ serio_register_driver(&pm_drv);
+ return 0;
}
static void __exit pm_exit(void)
diff --git a/trunk/drivers/input/touchscreen/touchright.c b/trunk/drivers/input/touchscreen/touchright.c
index 35ba46c6ad2d..c74f74e57af0 100644
--- a/trunk/drivers/input/touchscreen/touchright.c
+++ b/trunk/drivers/input/touchscreen/touchright.c
@@ -182,7 +182,8 @@ static struct serio_driver tr_drv = {
static int __init tr_init(void)
{
- return serio_register_driver(&tr_drv);
+ serio_register_driver(&tr_drv);
+ return 0;
}
static void __exit tr_exit(void)
diff --git a/trunk/drivers/input/touchscreen/touchwin.c b/trunk/drivers/input/touchscreen/touchwin.c
index 4dc073dacabb..9911820fa2fe 100644
--- a/trunk/drivers/input/touchscreen/touchwin.c
+++ b/trunk/drivers/input/touchscreen/touchwin.c
@@ -189,7 +189,8 @@ static struct serio_driver tw_drv = {
static int __init tw_init(void)
{
- return serio_register_driver(&tw_drv);
+ serio_register_driver(&tw_drv);
+ return 0;
}
static void __exit tw_exit(void)
diff --git a/trunk/drivers/input/touchscreen/ucb1400_ts.c b/trunk/drivers/input/touchscreen/ucb1400_ts.c
deleted file mode 100644
index 6ef08369f65b..000000000000
--- a/trunk/drivers/input/touchscreen/ucb1400_ts.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- * Philips UCB1400 touchscreen driver
- *
- * Author: Nicolas Pitre
- * Created: September 25, 2006
- * Copyright: MontaVista Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This code is heavily based on ucb1x00-*.c copyrighted by Russell King
- * covering the UCB1100, UCB1200 and UCB1300.. Support for the UCB1400 has
- * been made separate from ucb1x00-core/ucb1x00-ts on Russell's request.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-
-/*
- * Interesting UCB1400 AC-link registers
- */
-
-#define UCB_IE_RIS 0x5e
-#define UCB_IE_FAL 0x60
-#define UCB_IE_STATUS 0x62
-#define UCB_IE_CLEAR 0x62
-#define UCB_IE_ADC (1 << 11)
-#define UCB_IE_TSPX (1 << 12)
-
-#define UCB_TS_CR 0x64
-#define UCB_TS_CR_TSMX_POW (1 << 0)
-#define UCB_TS_CR_TSPX_POW (1 << 1)
-#define UCB_TS_CR_TSMY_POW (1 << 2)
-#define UCB_TS_CR_TSPY_POW (1 << 3)
-#define UCB_TS_CR_TSMX_GND (1 << 4)
-#define UCB_TS_CR_TSPX_GND (1 << 5)
-#define UCB_TS_CR_TSMY_GND (1 << 6)
-#define UCB_TS_CR_TSPY_GND (1 << 7)
-#define UCB_TS_CR_MODE_INT (0 << 8)
-#define UCB_TS_CR_MODE_PRES (1 << 8)
-#define UCB_TS_CR_MODE_POS (2 << 8)
-#define UCB_TS_CR_BIAS_ENA (1 << 11)
-#define UCB_TS_CR_TSPX_LOW (1 << 12)
-#define UCB_TS_CR_TSMX_LOW (1 << 13)
-
-#define UCB_ADC_CR 0x66
-#define UCB_ADC_SYNC_ENA (1 << 0)
-#define UCB_ADC_VREFBYP_CON (1 << 1)
-#define UCB_ADC_INP_TSPX (0 << 2)
-#define UCB_ADC_INP_TSMX (1 << 2)
-#define UCB_ADC_INP_TSPY (2 << 2)
-#define UCB_ADC_INP_TSMY (3 << 2)
-#define UCB_ADC_INP_AD0 (4 << 2)
-#define UCB_ADC_INP_AD1 (5 << 2)
-#define UCB_ADC_INP_AD2 (6 << 2)
-#define UCB_ADC_INP_AD3 (7 << 2)
-#define UCB_ADC_EXT_REF (1 << 5)
-#define UCB_ADC_START (1 << 7)
-#define UCB_ADC_ENA (1 << 15)
-
-#define UCB_ADC_DATA 0x68
-#define UCB_ADC_DAT_VALID (1 << 15)
-#define UCB_ADC_DAT_VALUE(x) ((x) & 0x3ff)
-
-#define UCB_ID 0x7e
-#define UCB_ID_1400 0x4304
-
-
-struct ucb1400 {
- ac97_t *ac97;
- struct input_dev *ts_idev;
-
- int irq;
-
- wait_queue_head_t ts_wait;
- struct task_struct *ts_task;
-
- unsigned int irq_pending; /* not bit field shared */
- unsigned int ts_restart:1;
- unsigned int adcsync:1;
-};
-
-static int adcsync;
-
-static inline u16 ucb1400_reg_read(struct ucb1400 *ucb, u16 reg)
-{
- return ucb->ac97->bus->ops->read(ucb->ac97, reg);
-}
-
-static inline void ucb1400_reg_write(struct ucb1400 *ucb, u16 reg, u16 val)
-{
- ucb->ac97->bus->ops->write(ucb->ac97, reg, val);
-}
-
-static inline void ucb1400_adc_enable(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA);
-}
-
-static unsigned int ucb1400_adc_read(struct ucb1400 *ucb, u16 adc_channel)
-{
- unsigned int val;
-
- if (ucb->adcsync)
- adc_channel |= UCB_ADC_SYNC_ENA;
-
- ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
- ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | UCB_ADC_START);
-
- for (;;) {
- val = ucb1400_reg_read(ucb, UCB_ADC_DATA);
- if (val & UCB_ADC_DAT_VALID)
- break;
- /* yield to other processes */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
-
- return UCB_ADC_DAT_VALUE(val);
-}
-
-static inline void ucb1400_adc_disable(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_ADC_CR, 0);
-}
-
-/* Switch to interrupt mode. */
-static inline void ucb1400_ts_mode_int(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
- UCB_TS_CR_MODE_INT);
-}
-
-/*
- * Switch to pressure mode, and read pressure. We don't need to wait
- * here, since both plates are being driven.
- */
-static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY);
-}
-
-/*
- * Switch to X position mode and measure Y plate. We switch the plate
- * configuration in pressure mode, then switch to position mode. This
- * gives a faster response time. Even so, we need to wait about 55us
- * for things to stabilise.
- */
-static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
-
- udelay(55);
-
- return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY);
-}
-
-/*
- * Switch to Y position mode and measure X plate. We switch the plate
- * configuration in pressure mode, then switch to position mode. This
- * gives a faster response time. Even so, we need to wait about 55us
- * for things to stabilise.
- */
-static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
- UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
-
- udelay(55);
-
- return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPX);
-}
-
-/*
- * Switch to X plate resistance mode. Set MX to ground, PX to
- * supply. Measure current.
- */
-static inline unsigned int ucb1400_ts_read_xres(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- return ucb1400_adc_read(ucb, 0);
-}
-
-/*
- * Switch to Y plate resistance mode. Set MY to ground, PY to
- * supply. Measure current.
- */
-static inline unsigned int ucb1400_ts_read_yres(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_TS_CR,
- UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
- UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
- return ucb1400_adc_read(ucb, 0);
-}
-
-static inline int ucb1400_ts_pen_down(struct ucb1400 *ucb)
-{
- unsigned short val = ucb1400_reg_read(ucb, UCB_TS_CR);
- return (val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW));
-}
-
-static inline void ucb1400_ts_irq_enable(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, UCB_IE_TSPX);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0);
- ucb1400_reg_write(ucb, UCB_IE_FAL, UCB_IE_TSPX);
-}
-
-static inline void ucb1400_ts_irq_disable(struct ucb1400 *ucb)
-{
- ucb1400_reg_write(ucb, UCB_IE_FAL, 0);
-}
-
-static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y)
-{
- input_report_abs(idev, ABS_X, x);
- input_report_abs(idev, ABS_Y, y);
- input_report_abs(idev, ABS_PRESSURE, pressure);
- input_sync(idev);
-}
-
-static void ucb1400_ts_event_release(struct input_dev *idev)
-{
- input_report_abs(idev, ABS_PRESSURE, 0);
- input_sync(idev);
-}
-
-static void ucb1400_handle_pending_irq(struct ucb1400 *ucb)
-{
- unsigned int isr;
-
- isr = ucb1400_reg_read(ucb, UCB_IE_STATUS);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, isr);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0);
-
- if (isr & UCB_IE_TSPX)
- ucb1400_ts_irq_disable(ucb);
- else
- printk(KERN_ERR "ucb1400: unexpected IE_STATUS = %#x\n", isr);
-
- enable_irq(ucb->irq);
-}
-
-static int ucb1400_ts_thread(void *_ucb)
-{
- struct ucb1400 *ucb = _ucb;
- struct task_struct *tsk = current;
- int valid = 0;
-
- tsk->policy = SCHED_FIFO;
- tsk->rt_priority = 1;
-
- while (!kthread_should_stop()) {
- unsigned int x, y, p;
- long timeout;
-
- ucb->ts_restart = 0;
-
- if (ucb->irq_pending) {
- ucb->irq_pending = 0;
- ucb1400_handle_pending_irq(ucb);
- }
-
- ucb1400_adc_enable(ucb);
- x = ucb1400_ts_read_xpos(ucb);
- y = ucb1400_ts_read_ypos(ucb);
- p = ucb1400_ts_read_pressure(ucb);
- ucb1400_adc_disable(ucb);
-
- /* Switch back to interrupt mode. */
- ucb1400_ts_mode_int(ucb);
-
- msleep(10);
-
- if (ucb1400_ts_pen_down(ucb)) {
- ucb1400_ts_irq_enable(ucb);
-
- /*
- * If we spat out a valid sample set last time,
- * spit out a "pen off" sample here.
- */
- if (valid) {
- ucb1400_ts_event_release(ucb->ts_idev);
- valid = 0;
- }
-
- timeout = MAX_SCHEDULE_TIMEOUT;
- } else {
- valid = 1;
- ucb1400_ts_evt_add(ucb->ts_idev, p, x, y);
- timeout = msecs_to_jiffies(10);
- }
-
- wait_event_interruptible_timeout(ucb->ts_wait,
- ucb->irq_pending || ucb->ts_restart || kthread_should_stop(),
- timeout);
- try_to_freeze();
- }
-
- /* Send the "pen off" if we are stopping with the pen still active */
- if (valid)
- ucb1400_ts_event_release(ucb->ts_idev);
-
- ucb->ts_task = NULL;
- return 0;
-}
-
-/*
- * A restriction with interrupts exists when using the ucb1400, as
- * the codec read/write routines may sleep while waiting for codec
- * access completion and uses semaphores for access control to the
- * AC97 bus. A complete codec read cycle could take anywhere from
- * 60 to 100uSec so we *definitely* don't want to spin inside the
- * interrupt handler waiting for codec access. So, we handle the
- * interrupt by scheduling a RT kernel thread to run in process
- * context instead of interrupt context.
- */
-static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid)
-{
- struct ucb1400 *ucb = devid;
-
- if (irqnr == ucb->irq) {
- disable_irq(ucb->irq);
- ucb->irq_pending = 1;
- wake_up(&ucb->ts_wait);
- return IRQ_HANDLED;
- }
- return IRQ_NONE;
-}
-
-static int ucb1400_ts_open(struct input_dev *idev)
-{
- struct ucb1400 *ucb = idev->private;
- int ret = 0;
-
- BUG_ON(ucb->ts_task);
-
- ucb->ts_task = kthread_run(ucb1400_ts_thread, ucb, "UCB1400_ts");
- if (IS_ERR(ucb->ts_task)) {
- ret = PTR_ERR(ucb->ts_task);
- ucb->ts_task = NULL;
- }
-
- return ret;
-}
-
-static void ucb1400_ts_close(struct input_dev *idev)
-{
- struct ucb1400 *ucb = idev->private;
-
- if (ucb->ts_task)
- kthread_stop(ucb->ts_task);
-
- ucb1400_ts_irq_disable(ucb);
- ucb1400_reg_write(ucb, UCB_TS_CR, 0);
-}
-
-#ifdef CONFIG_PM
-static int ucb1400_ts_resume(struct device *dev)
-{
- struct ucb1400 *ucb = dev_get_drvdata(dev);
-
- if (ucb->ts_task) {
- /*
- * Restart the TS thread to ensure the
- * TS interrupt mode is set up again
- * after sleep.
- */
- ucb->ts_restart = 1;
- wake_up(&ucb->ts_wait);
- }
- return 0;
-}
-#else
-#define ucb1400_ts_resume NULL
-#endif
-
-#ifndef NO_IRQ
-#define NO_IRQ 0
-#endif
-
-/*
- * Try to probe our interrupt, rather than relying on lots of
- * hard-coded machine dependencies.
- */
-static int ucb1400_detect_irq(struct ucb1400 *ucb)
-{
- unsigned long mask, timeout;
-
- mask = probe_irq_on();
- if (!mask) {
- probe_irq_off(mask);
- return -EBUSY;
- }
-
- /* Enable the ADC interrupt. */
- ucb1400_reg_write(ucb, UCB_IE_RIS, UCB_IE_ADC);
- ucb1400_reg_write(ucb, UCB_IE_FAL, UCB_IE_ADC);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0xffff);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0);
-
- /* Cause an ADC interrupt. */
- ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA);
- ucb1400_reg_write(ucb, UCB_ADC_CR, UCB_ADC_ENA | UCB_ADC_START);
-
- /* Wait for the conversion to complete. */
- timeout = jiffies + HZ/2;
- while (!(ucb1400_reg_read(ucb, UCB_ADC_DATA) & UCB_ADC_DAT_VALID)) {
- cpu_relax();
- if (time_after(jiffies, timeout)) {
- printk(KERN_ERR "ucb1400: timed out in IRQ probe\n");
- probe_irq_off(mask);
- return -ENODEV;
- }
- }
- ucb1400_reg_write(ucb, UCB_ADC_CR, 0);
-
- /* Disable and clear interrupt. */
- ucb1400_reg_write(ucb, UCB_IE_RIS, 0);
- ucb1400_reg_write(ucb, UCB_IE_FAL, 0);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0xffff);
- ucb1400_reg_write(ucb, UCB_IE_CLEAR, 0);
-
- /* Read triggered interrupt. */
- ucb->irq = probe_irq_off(mask);
- if (ucb->irq < 0 || ucb->irq == NO_IRQ)
- return -ENODEV;
-
- return 0;
-}
-
-static int ucb1400_ts_probe(struct device *dev)
-{
- struct ucb1400 *ucb;
- struct input_dev *idev;
- int error, id, x_res, y_res;
-
- ucb = kzalloc(sizeof(struct ucb1400), GFP_KERNEL);
- idev = input_allocate_device();
- if (!ucb || !idev) {
- error = -ENOMEM;
- goto err_free_devs;
- }
-
- ucb->ts_idev = idev;
- ucb->adcsync = adcsync;
- ucb->ac97 = to_ac97_t(dev);
- init_waitqueue_head(&ucb->ts_wait);
-
- id = ucb1400_reg_read(ucb, UCB_ID);
- if (id != UCB_ID_1400) {
- error = -ENODEV;
- goto err_free_devs;
- }
-
- error = ucb1400_detect_irq(ucb);
- if (error) {
- printk(KERN_ERR "UCB1400: IRQ probe failed\n");
- goto err_free_devs;
- }
-
- error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
- "UCB1400", ucb);
- if (error) {
- printk(KERN_ERR "ucb1400: unable to grab irq%d: %d\n",
- ucb->irq, error);
- goto err_free_devs;
- }
- printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq);
-
- idev->private = ucb;
- idev->cdev.dev = dev;
- idev->name = "UCB1400 touchscreen interface";
- idev->id.vendor = ucb1400_reg_read(ucb, AC97_VENDOR_ID1);
- idev->id.product = id;
- idev->open = ucb1400_ts_open;
- idev->close = ucb1400_ts_close;
- idev->evbit[0] = BIT(EV_ABS);
-
- ucb1400_adc_enable(ucb);
- x_res = ucb1400_ts_read_xres(ucb);
- y_res = ucb1400_ts_read_yres(ucb);
- ucb1400_adc_disable(ucb);
- printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res);
-
- input_set_abs_params(idev, ABS_X, 0, x_res, 0, 0);
- input_set_abs_params(idev, ABS_Y, 0, y_res, 0, 0);
- input_set_abs_params(idev, ABS_PRESSURE, 0, 0, 0, 0);
-
- error = input_register_device(idev);
- if (error)
- goto err_free_irq;
-
- dev_set_drvdata(dev, ucb);
- return 0;
-
- err_free_irq:
- free_irq(ucb->irq, ucb);
- err_free_devs:
- input_free_device(idev);
- kfree(ucb);
- return error;
-}
-
-static int ucb1400_ts_remove(struct device *dev)
-{
- struct ucb1400 *ucb = dev_get_drvdata(dev);
-
- free_irq(ucb->irq, ucb);
- input_unregister_device(ucb->ts_idev);
- dev_set_drvdata(dev, NULL);
- kfree(ucb);
- return 0;
-}
-
-static struct device_driver ucb1400_ts_driver = {
- .owner = THIS_MODULE,
- .bus = &ac97_bus_type,
- .probe = ucb1400_ts_probe,
- .remove = ucb1400_ts_remove,
- .resume = ucb1400_ts_resume,
-};
-
-static int __init ucb1400_ts_init(void)
-{
- return driver_register(&ucb1400_ts_driver);
-}
-
-static void __exit ucb1400_ts_exit(void)
-{
- driver_unregister(&ucb1400_ts_driver);
-}
-
-module_param(adcsync, int, 0444);
-
-module_init(ucb1400_ts_init);
-module_exit(ucb1400_ts_exit);
-
-MODULE_DESCRIPTION("Philips UCB1400 touchscreen driver");
-MODULE_LICENSE("GPL");
diff --git a/trunk/drivers/macintosh/Kconfig b/trunk/drivers/macintosh/Kconfig
index 31015d55d353..7f8477d3a661 100644
--- a/trunk/drivers/macintosh/Kconfig
+++ b/trunk/drivers/macintosh/Kconfig
@@ -162,6 +162,7 @@ config INPUT_ADBHID
config MAC_EMUMOUSEBTN
bool "Support for mouse button 2+3 emulation"
+ depends on INPUT_ADBHID
help
This provides generic support for emulating the 2nd and 3rd mouse
button with keypresses. If you say Y here, the emulation is still
diff --git a/trunk/drivers/macintosh/adbhid.c b/trunk/drivers/macintosh/adbhid.c
index 1c7d6f221b55..5066e7a8ea9c 100644
--- a/trunk/drivers/macintosh/adbhid.c
+++ b/trunk/drivers/macintosh/adbhid.c
@@ -689,6 +689,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
if (!hid || !input_dev) {
err = -ENOMEM;
goto fail;
+
}
sprintf(hid->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id);
@@ -806,9 +807,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
input_dev->keycode = hid->keycode;
- err = input_register_device(input_dev);
- if (err)
- goto fail;
+ input_register_device(input_dev);
if (default_id == ADB_KEYBOARD) {
/* HACK WARNING!! This should go away as soon there is an utility
@@ -821,10 +820,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
return 0;
fail: input_free_device(input_dev);
- if (hid) {
- kfree(hid->keycode);
- kfree(hid);
- }
+ kfree(hid);
adbhid[id] = NULL;
return err;
}
diff --git a/trunk/drivers/macintosh/mac_hid.c b/trunk/drivers/macintosh/mac_hid.c
index ee6b4ca69130..6b129eef7987 100644
--- a/trunk/drivers/macintosh/mac_hid.c
+++ b/trunk/drivers/macintosh/mac_hid.c
@@ -106,8 +106,6 @@ EXPORT_SYMBOL(mac_hid_mouse_emulate_buttons);
static int emumousebtn_input_register(void)
{
- int ret;
-
emumousebtn = input_allocate_device();
if (!emumousebtn)
return -ENOMEM;
@@ -122,11 +120,9 @@ static int emumousebtn_input_register(void)
emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y);
- ret = input_register_device(emumousebtn);
- if (ret)
- input_free_device(emumousebtn);
+ input_register_device(emumousebtn);
- return ret;
+ return 0;
}
int __init mac_hid_init(void)
diff --git a/trunk/drivers/usb/input/appletouch.c b/trunk/drivers/usb/input/appletouch.c
index c77291d3d063..4c213513484d 100644
--- a/trunk/drivers/usb/input/appletouch.c
+++ b/trunk/drivers/usb/input/appletouch.c
@@ -38,29 +38,14 @@
#define APPLE_VENDOR_ID 0x05AC
/* These names come from Info.plist in AppleUSBTrackpad.kext */
-#define FOUNTAIN_ANSI_PRODUCT_ID 0x020E
-#define FOUNTAIN_ISO_PRODUCT_ID 0x020F
-
-#define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A
-
-#define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
-
-#define GEYSER_ANSI_PRODUCT_ID 0x0214
-#define GEYSER_ISO_PRODUCT_ID 0x0215
-#define GEYSER_JIS_PRODUCT_ID 0x0216
+#define GEYSER_ANSI_PRODUCT_ID 0x0214
+#define GEYSER_ISO_PRODUCT_ID 0x0215
+#define GEYSER_JIS_PRODUCT_ID 0x0216
/* MacBook devices */
-#define GEYSER3_ANSI_PRODUCT_ID 0x0217
-#define GEYSER3_ISO_PRODUCT_ID 0x0218
-#define GEYSER3_JIS_PRODUCT_ID 0x0219
-
-/*
- * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
- * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
- */
-#define GEYSER4_ANSI_PRODUCT_ID 0x021A
-#define GEYSER4_ISO_PRODUCT_ID 0x021B
-#define GEYSER4_JIS_PRODUCT_ID 0x021C
+#define GEYSER3_ANSI_PRODUCT_ID 0x0217
+#define GEYSER3_ISO_PRODUCT_ID 0x0218
+#define GEYSER3_JIS_PRODUCT_ID 0x0219
#define ATP_DEVICE(prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
@@ -73,26 +58,20 @@
/* table of devices that work with this driver */
static struct usb_device_id atp_table [] = {
- { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) },
+ { ATP_DEVICE(0x020E) },
+ { ATP_DEVICE(0x020F) },
+ { ATP_DEVICE(0x030A) },
+ { ATP_DEVICE(0x030B) },
/* PowerBooks Oct 2005 */
{ ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) },
{ ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) },
{ ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) },
- /* Core Duo MacBook & MacBook Pro */
{ ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) },
{ ATP_DEVICE(GEYSER3_ISO_PRODUCT_ID) },
{ ATP_DEVICE(GEYSER3_JIS_PRODUCT_ID) },
- /* Core2 Duo MacBook & MacBook Pro */
- { ATP_DEVICE(GEYSER4_ANSI_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },
-
/* Terminating entry */
{ }
};
@@ -129,7 +108,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
*/
#define ATP_THRESHOLD 5
-/* MacBook Pro (Geyser 3 & 4) initialization constants */
+/* MacBook Pro (Geyser 3) initialization constants */
#define ATP_GEYSER3_MODE_READ_REQUEST_ID 1
#define ATP_GEYSER3_MODE_WRITE_REQUEST_ID 9
#define ATP_GEYSER3_MODE_REQUEST_VALUE 0x300
@@ -175,13 +154,6 @@ MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
MODULE_LICENSE("GPL");
-/*
- * Make the threshold a module parameter
- */
-static int threshold = ATP_THRESHOLD;
-module_param(threshold, int, 0644);
-MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value");
-
static int debug = 1;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Activate debugging output");
@@ -202,10 +174,7 @@ static inline int atp_is_geyser_3(struct atp *dev)
return (productId == GEYSER3_ANSI_PRODUCT_ID) ||
(productId == GEYSER3_ISO_PRODUCT_ID) ||
- (productId == GEYSER3_JIS_PRODUCT_ID) ||
- (productId == GEYSER4_ANSI_PRODUCT_ID) ||
- (productId == GEYSER4_ISO_PRODUCT_ID) ||
- (productId == GEYSER4_JIS_PRODUCT_ID);
+ (productId == GEYSER3_JIS_PRODUCT_ID);
}
static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
@@ -214,48 +183,16 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
int i;
/* values to calculate mean */
int pcum = 0, psum = 0;
- int is_increasing = 0;
*fingers = 0;
for (i = 0; i < nb_sensors; i++) {
- if (xy_sensors[i] < threshold) {
- if (is_increasing)
- is_increasing = 0;
-
+ if (xy_sensors[i] < ATP_THRESHOLD)
continue;
- }
-
- /*
- * Makes the finger detection more versatile. For example,
- * two fingers with no gap will be detected. Also, my
- * tests show it less likely to have intermittent loss
- * of multiple finger readings while moving around (scrolling).
- *
- * Changes the multiple finger detection to counting humps on
- * sensors (transitions from nonincreasing to increasing)
- * instead of counting transitions from low sensors (no
- * finger reading) to high sensors (finger above
- * sensor)
- *
- * - Jason Parekh
- */
- if (i < 1 || (!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) {
+ if ((i - 1 < 0) || (xy_sensors[i - 1] < ATP_THRESHOLD))
(*fingers)++;
- is_increasing = 1;
- } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) {
- is_increasing = 0;
- }
-
- /*
- * Subtracts threshold so a high sensor that just passes the threshold
- * won't skew the calculated absolute coordinate. Fixes an issue
- * where slowly moving the mouse would occassionaly jump a number of
- * pixels (let me restate--slowly moving the mouse makes this issue
- * most apparent).
- */
- pcum += (xy_sensors[i] - threshold) * i;
- psum += (xy_sensors[i] - threshold);
+ pcum += xy_sensors[i] * i;
+ psum += xy_sensors[i];
}
if (psum > 0) {
diff --git a/trunk/drivers/usb/input/hid-core.c b/trunk/drivers/usb/input/hid-core.c
index 6095d9cedb7e..6daf85c6eeee 100644
--- a/trunk/drivers/usb/input/hid-core.c
+++ b/trunk/drivers/usb/input/hid-core.c
@@ -1643,9 +1643,6 @@ void hid_init_reports(struct hid_device *hid)
#define USB_VENDOR_ID_AIRCABLE 0x16CA
#define USB_DEVICE_ID_AIRCABLE1 0x1502
-#define USB_VENDOR_ID_LOGITECH 0x046d
-#define USB_DEVICE_ID_LOGITECH_USB_RECEIVER 0xc101
-
/*
* Alphabetically sorted blacklist by quirk type.
*/
@@ -1814,9 +1811,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
-
- { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_USB_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS },
-
+
{ 0, 0 }
};
diff --git a/trunk/drivers/usb/input/hid-input.c b/trunk/drivers/usb/input/hid-input.c
index c8ce65c70a42..9a808a3b4d37 100644
--- a/trunk/drivers/usb/input/hid-input.c
+++ b/trunk/drivers/usb/input/hid-input.c
@@ -564,10 +564,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|| ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007)))
goto ignore;
- if ((device->quirks & HID_QUIRK_BAD_RELATIVE_KEYS) &&
- usage->type == EV_KEY && (field->flags & HID_MAIN_ITEM_RELATIVE))
- field->flags &= ~HID_MAIN_ITEM_RELATIVE;
-
set_bit(usage->type, input->evbit);
while (usage->code <= max && test_and_set_bit(usage->code, bit))
diff --git a/trunk/drivers/usb/input/hid.h b/trunk/drivers/usb/input/hid.h
index 8aa9ec08e8ab..9b50effef758 100644
--- a/trunk/drivers/usb/input/hid.h
+++ b/trunk/drivers/usb/input/hid.h
@@ -260,7 +260,6 @@ struct hid_item {
#define HID_QUIRK_POWERBOOK_HAS_FN 0x00001000
#define HID_QUIRK_POWERBOOK_FN_ON 0x00002000
#define HID_QUIRK_INVERT_HWHEEL 0x00004000
-#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
/*
* This is the global environment of the parser. This information is
diff --git a/trunk/include/asm-sparc/unistd.h b/trunk/include/asm-sparc/unistd.h
index c7a495afc82e..f7827fa4cd5e 100644
--- a/trunk/include/asm-sparc/unistd.h
+++ b/trunk/include/asm-sparc/unistd.h
@@ -318,12 +318,15 @@
#define __NR_unshare 299
#define __NR_set_robust_list 300
#define __NR_get_robust_list 301
+#define __NR_migrate_pages 302
+
+#define NR_SYSCALLS 303
#ifdef __KERNEL__
-/* WARNING: You MAY NOT add syscall numbers larger than 301, since
+/* WARNING: You MAY NOT add syscall numbers larger than 302, since
* all of the syscall tables in the Sparc kernel are
- * sized to have 301 entries (starting at zero). Therefore
- * find a free slot in the 0-301 range.
+ * sized to have 302 entries (starting at zero). Therefore
+ * find a free slot in the 0-302 range.
*/
#define _syscall0(type,name) \
diff --git a/trunk/include/asm-sparc64/unistd.h b/trunk/include/asm-sparc64/unistd.h
index 124cf076717f..63669dad0d72 100644
--- a/trunk/include/asm-sparc64/unistd.h
+++ b/trunk/include/asm-sparc64/unistd.h
@@ -320,12 +320,16 @@
#define __NR_unshare 299
#define __NR_set_robust_list 300
#define __NR_get_robust_list 301
+#define __NR_migrate_pages 302
+
+#define NR_SYSCALLS 303
#ifdef __KERNEL__
-/* WARNING: You MAY NOT add syscall numbers larger than 301, since
+
+/* WARNING: You MAY NOT add syscall numbers larger than 302, since
* all of the syscall tables in the Sparc kernel are
- * sized to have 301 entries (starting at zero). Therefore
- * find a free slot in the 0-301 range.
+ * sized to have 302 entries (starting at zero). Therefore
+ * find a free slot in the 0-302 range.
*/
#define _syscall0(type,name) \
diff --git a/trunk/include/linux/input.h b/trunk/include/linux/input.h
index 4e61158b06a0..c38507ba38b5 100644
--- a/trunk/include/linux/input.h
+++ b/trunk/include/linux/input.h
@@ -663,7 +663,7 @@ struct input_absinfo {
#define BUS_GSC 0x1A
/*
- * Values describing the status of a force-feedback effect
+ * Values describing the status of an effect
*/
#define FF_STATUS_STOPPED 0x00
#define FF_STATUS_PLAYING 0x01
@@ -680,7 +680,7 @@ struct input_absinfo {
*/
/**
- * struct ff_replay - defines scheduling of the force-feedback effect
+ * struct ff_replay - defines scheduling of the effect
* @length: duration of the effect
* @delay: delay before effect should start playing
*/
@@ -690,7 +690,7 @@ struct ff_replay {
};
/**
- * struct ff_trigger - defines what triggers the force-feedback effect
+ * struct ff_trigger - defines what triggers the effect
* @button: number of the button triggering the effect
* @interval: controls how soon the effect can be re-triggered
*/
@@ -700,7 +700,7 @@ struct ff_trigger {
};
/**
- * struct ff_envelope - generic force-feedback effect envelope
+ * struct ff_envelope - generic effect envelope
* @attack_length: duration of the attack (ms)
* @attack_level: level at the beginning of the attack
* @fade_length: duration of fade (ms)
@@ -719,7 +719,7 @@ struct ff_envelope {
};
/**
- * struct ff_constant_effect - defines parameters of a constant force-feedback effect
+ * struct ff_constant_effect - defines parameters of a constant effect
* @level: strength of the effect; may be negative
* @envelope: envelope data
*/
@@ -729,7 +729,7 @@ struct ff_constant_effect {
};
/**
- * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
+ * struct ff_ramp_effect - defines parameters of a ramp effect
* @start_level: beginning strength of the effect; may be negative
* @end_level: final strength of the effect; may be negative
* @envelope: envelope data
@@ -741,7 +741,7 @@ struct ff_ramp_effect {
};
/**
- * struct ff_condition_effect - defines a spring or friction force-feedback effect
+ * struct ff_condition_effect - defines a spring or friction effect
* @right_saturation: maximum level when joystick moved all way to the right
* @left_saturation: same for the left side
* @right_coeff: controls how fast the force grows when the joystick moves
@@ -762,7 +762,7 @@ struct ff_condition_effect {
};
/**
- * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
+ * struct ff_periodic_effect - defines parameters of a periodic effect
* @waveform: kind of the effect (wave)
* @period: period of the wave (ms)
* @magnitude: peak value
@@ -793,7 +793,7 @@ struct ff_periodic_effect {
};
/**
- * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
+ * struct ff_rumble_effect - defines parameters of a periodic effect
* @strong_magnitude: magnitude of the heavy motor
* @weak_magnitude: magnitude of the light one
*
diff --git a/trunk/include/linux/serio.h b/trunk/include/linux/serio.h
index 0f478a8791a2..b99c5ca9708d 100644
--- a/trunk/include/linux/serio.h
+++ b/trunk/include/linux/serio.h
@@ -85,8 +85,18 @@ static inline void serio_register_port(struct serio *serio)
void serio_unregister_port(struct serio *serio);
void serio_unregister_child_port(struct serio *serio);
+void __serio_unregister_port_delayed(struct serio *serio, struct module *owner);
+static inline void serio_unregister_port_delayed(struct serio *serio)
+{
+ __serio_unregister_port_delayed(serio, THIS_MODULE);
+}
+
+void __serio_register_driver(struct serio_driver *drv, struct module *owner);
+static inline void serio_register_driver(struct serio_driver *drv)
+{
+ __serio_register_driver(drv, THIS_MODULE);
+}
-int serio_register_driver(struct serio_driver *drv);
void serio_unregister_driver(struct serio_driver *drv);
static inline int serio_write(struct serio *serio, unsigned char data)