diff options
author | Jeff Garzik <jgarzik@pretzel.yyz.us> | 2005-06-23 01:50:57 (GMT) |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-23 01:50:57 (GMT) |
commit | a5324343955997d1439f26518ddac567cd5d134b (patch) | |
tree | f43558389c41e3a0f076c4ee55d77c4aa1561779 /drivers/input | |
parent | 8199d3a79c224bbe5943fa08684e1f93a17881b0 (diff) | |
parent | a4936044001694f033fe4ea94d6034d51a6b465c (diff) | |
download | linux-fsl-qoriq-a5324343955997d1439f26518ddac567cd5d134b.tar.xz |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/evdev.c | 9 | ||||
-rw-r--r-- | drivers/input/gameport/Kconfig | 20 | ||||
-rw-r--r-- | drivers/input/gameport/gameport.c | 6 | ||||
-rw-r--r-- | drivers/input/input.c | 10 | ||||
-rw-r--r-- | drivers/input/joydev.c | 10 | ||||
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 18 | ||||
-rw-r--r-- | drivers/input/mouse/alps.c | 6 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 7 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse.h | 4 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 39 | ||||
-rw-r--r-- | drivers/input/mousedev.c | 31 | ||||
-rw-r--r-- | drivers/input/serio/i8042-x86ia64io.h | 32 | ||||
-rw-r--r-- | drivers/input/serio/i8042.c | 50 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 41 | ||||
-rw-r--r-- | drivers/input/serio/serport.c | 98 | ||||
-rw-r--r-- | drivers/input/touchscreen/gunze.c | 3 | ||||
-rw-r--r-- | drivers/input/tsdev.c | 9 |
17 files changed, 219 insertions, 174 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 17552a2..556264b 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -431,9 +431,9 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor); - class_simple_device_add(input_class, - MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), - dev->dev, "event%d", minor); + class_device_create(input_class, + MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), + dev->dev, "event%d", minor); return &evdev->handle; } @@ -443,7 +443,8 @@ static void evdev_disconnect(struct input_handle *handle) struct evdev *evdev = handle->private; struct evdev_list *list; - class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); + class_device_destroy(input_class, + MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); devfs_remove("input/event%d", evdev->minor); evdev->exist = 0; diff --git a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig index 6282f46..1d93f50 100644 --- a/drivers/input/gameport/Kconfig +++ b/drivers/input/gameport/Kconfig @@ -68,23 +68,3 @@ config GAMEPORT_CS461X depends on PCI endif - -# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on -# in every .config. Please don't touch it. It is here to handle an -# unusual dependency between GAMEPORT and sound drivers. -# -# Some sound drivers call gameport functions. If GAMEPORT is -# not selected, empty stubs are provided for the functions and all is -# well. -# If GAMEPORT is built in, everything is fine. -# If GAMEPORT is a module, however, it would need to be loaded for the -# sound driver to be able to link properly. Therefore, the sound -# driver must be a module as well in that case. Since there's no way -# to express that directly in Kconfig, we use SOUND_GAMEPORT to -# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm', -# anything that depends on SOUND_GAMEPORT must be 'm' as well. if -# GAMEPORT is 'y' or 'n', it can be anything". -config SOUND_GAMEPORT - tristate - default m if GAMEPORT=m - default y diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index f20c3f2..e152d0f 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c @@ -134,7 +134,7 @@ static int gameport_measure_speed(struct gameport *gameport) } gameport_close(gameport); - return (cpu_data[_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); + return (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); #else @@ -453,13 +453,13 @@ static int gameport_thread(void *nothing) * Gameport port operations */ -static ssize_t gameport_show_description(struct device *dev, char *buf) +static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) { struct gameport *gameport = to_gameport_port(dev); return sprintf(buf, "%s\n", gameport->name); } -static ssize_t gameport_rebind_driver(struct device *dev, const char *buf, size_t count) +static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct gameport *gameport = to_gameport_port(dev); struct device_driver *drv; diff --git a/drivers/input/input.c b/drivers/input/input.c index 3385dd0..83c77c9 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -702,13 +702,13 @@ static int __init input_proc_init(void) static inline int input_proc_init(void) { return 0; } #endif -struct class_simple *input_class; +struct class *input_class; static int __init input_init(void) { int retval = -ENOMEM; - input_class = class_simple_create(THIS_MODULE, "input"); + input_class = class_create(THIS_MODULE, "input"); if (IS_ERR(input_class)) return PTR_ERR(input_class); input_proc_init(); @@ -718,7 +718,7 @@ static int __init input_init(void) remove_proc_entry("devices", proc_bus_input_dir); remove_proc_entry("handlers", proc_bus_input_dir); remove_proc_entry("input", proc_bus); - class_simple_destroy(input_class); + class_destroy(input_class); return retval; } @@ -728,7 +728,7 @@ static int __init input_init(void) remove_proc_entry("handlers", proc_bus_input_dir); remove_proc_entry("input", proc_bus); unregister_chrdev(INPUT_MAJOR, "input"); - class_simple_destroy(input_class); + class_destroy(input_class); } return retval; } @@ -741,7 +741,7 @@ static void __exit input_exit(void) devfs_remove("input"); unregister_chrdev(INPUT_MAJOR, "input"); - class_simple_destroy(input_class); + class_destroy(input_class); } subsys_initcall(input_init); diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 7d7527f..39775fc 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -422,7 +422,7 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct joydev->nkey++; } - for (i = 0; i < BTN_JOYSTICK - BTN_MISC + 1; i++) + for (i = 0; i < BTN_JOYSTICK - BTN_MISC; i++) if (test_bit(i + BTN_MISC, dev->keybit)) { joydev->keymap[i] = joydev->nkey; joydev->keypam[joydev->nkey] = i + BTN_MISC; @@ -452,9 +452,9 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor); - class_simple_device_add(input_class, - MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), - dev->dev, "js%d", minor); + class_device_create(input_class, + MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), + dev->dev, "js%d", minor); return &joydev->handle; } @@ -464,7 +464,7 @@ static void joydev_disconnect(struct input_handle *handle) struct joydev *joydev = handle->private; struct joydev_list *list; - class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); + class_device_destroy(input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); devfs_remove("input/js%d", joydev->minor); joydev->exist = 0; diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index ff66ed4..82fad9a 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -54,7 +54,7 @@ static int atkbd_softraw = 1; module_param_named(softraw, atkbd_softraw, bool, 0); MODULE_PARM_DESC(softraw, "Use software generated rawmode"); -static int atkbd_scroll = 1; +static int atkbd_scroll = 0; module_param_named(scroll, atkbd_scroll, bool, 0); MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); @@ -171,9 +171,9 @@ static struct { unsigned char set2; } atkbd_scroll_keys[] = { { ATKBD_SCR_1, 0xc5 }, - { ATKBD_SCR_2, 0xa9 }, - { ATKBD_SCR_4, 0xb6 }, - { ATKBD_SCR_8, 0xa7 }, + { ATKBD_SCR_2, 0x9d }, + { ATKBD_SCR_4, 0xa4 }, + { ATKBD_SCR_8, 0x9b }, { ATKBD_SCR_CLICK, 0xe0 }, { ATKBD_SCR_LEFT, 0xcb }, { ATKBD_SCR_RIGHT, 0xd2 }, @@ -219,11 +219,11 @@ static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t #define ATKBD_DEFINE_ATTR(_name) \ static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ -static ssize_t atkbd_do_show_##_name(struct device *d, char *b) \ +static ssize_t atkbd_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ { \ return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ } \ -static ssize_t atkbd_do_set_##_name(struct device *d, const char *b, size_t s) \ +static ssize_t atkbd_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s) \ { \ return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ } \ @@ -465,8 +465,10 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int co if (atkbd->softrepeat) return 0; i = j = 0; - while (i < 32 && period[i] < dev->rep[REP_PERIOD]) i++; - while (j < 4 && delay[j] < dev->rep[REP_DELAY]) j++; + while (i < 31 && period[i] < dev->rep[REP_PERIOD]) + i++; + while (j < 3 && delay[j] < dev->rep[REP_DELAY]) + j++; dev->rep[REP_PERIOD] = period[i]; dev->rep[REP_DELAY] = delay[j]; param[0] = i | (j << 5); diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 1f85a97..7bf4be7 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -341,6 +341,8 @@ static int alps_reconnect(struct psmouse *psmouse) unsigned char param[4]; int version; + psmouse_reset(psmouse); + if (!(priv->i = alps_get_model(psmouse, &version))) return -1; @@ -350,7 +352,7 @@ static int alps_reconnect(struct psmouse *psmouse) if (alps_get_status(psmouse, param)) return -1; - if (param[0] & 0x04) + if (!(param[0] & 0x04)) alps_tap_mode(psmouse, 1); if (alps_absolute_mode(psmouse)) { @@ -395,7 +397,7 @@ int alps_init(struct psmouse *psmouse) } if (param[0] & 0x04) { - printk(KERN_INFO " Enabling hardware tapping\n"); + printk(KERN_INFO "alps.c: Enabling hardware tapping\n"); if (alps_tap_mode(psmouse, 1)) printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); } diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index cd85095..019034b 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -518,13 +518,16 @@ static int psmouse_probe(struct psmouse *psmouse) /* * First, we check if it's a mouse. It should send 0x00 or 0x03 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. + * Sunrex K8561 IR Keyboard/Mouse reports 0xff on second and subsequent + * ID queries, probably due to a firmware bug. */ param[0] = 0xa5; if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID)) return -1; - if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04) + if (param[0] != 0x00 && param[0] != 0x03 && + param[0] != 0x04 && param[0] != 0xff) return -1; /* @@ -972,7 +975,7 @@ static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) return -EINVAL; if (!strncmp(val, "any", 3)) { - *((unsigned int *)kp->arg) = -1UL; + *((unsigned int *)kp->arg) = -1U; return 0; } diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index bda5b06..79e17a0 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -91,11 +91,11 @@ ssize_t psmouse_attr_set_helper(struct device *dev, const char *buf, size_t coun #define PSMOUSE_DEFINE_ATTR(_name) \ static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \ static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\ -static ssize_t psmouse_do_show_##_name(struct device *d, char *b) \ +static ssize_t psmouse_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ { \ return psmouse_attr_show_helper(d, b, psmouse_attr_show_##_name); \ } \ -static ssize_t psmouse_do_set_##_name(struct device *d, const char *b, size_t s)\ +static ssize_t psmouse_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s)\ { \ return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \ } \ diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 69832f8..36c7212 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -143,39 +143,6 @@ static int synaptics_identify(struct psmouse *psmouse) return -1; } -static void print_ident(struct synaptics_data *priv) -{ - printk(KERN_INFO "Synaptics Touchpad, model: %ld\n", SYN_ID_MODEL(priv->identity)); - printk(KERN_INFO " Firmware: %ld.%ld\n", SYN_ID_MAJOR(priv->identity), - SYN_ID_MINOR(priv->identity)); - if (SYN_MODEL_ROT180(priv->model_id)) - printk(KERN_INFO " 180 degree mounted touchpad\n"); - if (SYN_MODEL_PORTRAIT(priv->model_id)) - printk(KERN_INFO " portrait touchpad\n"); - printk(KERN_INFO " Sensor: %ld\n", SYN_MODEL_SENSOR(priv->model_id)); - if (SYN_MODEL_NEWABS(priv->model_id)) - printk(KERN_INFO " new absolute packet format\n"); - if (SYN_MODEL_PEN(priv->model_id)) - printk(KERN_INFO " pen detection\n"); - - if (SYN_CAP_EXTENDED(priv->capabilities)) { - printk(KERN_INFO " Touchpad has extended capability bits\n"); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) - printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", - (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); - if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) - printk(KERN_INFO " -> middle button\n"); - if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) - printk(KERN_INFO " -> four buttons\n"); - if (SYN_CAP_MULTIFINGER(priv->capabilities)) - printk(KERN_INFO " -> multifinger detection\n"); - if (SYN_CAP_PALMDETECT(priv->capabilities)) - printk(KERN_INFO " -> palm detection\n"); - if (SYN_CAP_PASS_THROUGH(priv->capabilities)) - printk(KERN_INFO " -> pass-through port\n"); - } -} - static int synaptics_query_hardware(struct psmouse *psmouse) { int retries = 0; @@ -666,7 +633,11 @@ int synaptics_init(struct psmouse *psmouse) priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; - print_ident(priv); + printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n", + SYN_ID_MODEL(priv->identity), + SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), + priv->model_id, priv->capabilities, priv->ext_cap); + set_input_params(&psmouse->dev, priv); psmouse->protocol_handler = synaptics_process_byte; diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 564974c..062848a 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -101,6 +101,7 @@ struct mousedev_list { unsigned char ready, buffer, bufsiz; unsigned char imexseq, impsseq; enum mousedev_emul mode; + unsigned long last_buttons; }; #define MOUSEDEV_SEQ_LEN 6 @@ -224,7 +225,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h spin_lock_irqsave(&list->packet_lock, flags); p = &list->packets[list->head]; - if (list->ready && p->buttons != packet->buttons) { + if (list->ready && p->buttons != mousedev->packet.buttons) { unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; if (new_head != list->tail) { p = &list->packets[list->head = new_head]; @@ -249,10 +250,13 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h p->dz += packet->dz; p->buttons = mousedev->packet.buttons; - list->ready = 1; + if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons) + list->ready = 1; spin_unlock_irqrestore(&list->packet_lock, flags); - kill_fasync(&list->fasync, SIGIO, POLL_IN); + + if (list->ready) + kill_fasync(&list->fasync, SIGIO, POLL_IN); } wake_up_interruptible(&mousedev->wait); @@ -477,9 +481,10 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data) } if (!p->dx && !p->dy && !p->dz) { - if (list->tail == list->head) + if (list->tail == list->head) { list->ready = 0; - else + list->last_buttons = p->buttons; + } else list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; } @@ -642,9 +647,9 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); - class_simple_device_add(input_class, - MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), - dev->dev, "mouse%d", minor); + class_device_create(input_class, + MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), + dev->dev, "mouse%d", minor); return &mousedev->handle; } @@ -654,7 +659,8 @@ static void mousedev_disconnect(struct input_handle *handle) struct mousedev *mousedev = handle->private; struct mousedev_list *list; - class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); + class_device_destroy(input_class, + MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); devfs_remove("input/mouse%d", mousedev->minor); mousedev->exist = 0; @@ -730,8 +736,8 @@ static int __init mousedev_init(void) devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); - class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), - NULL, "mice"); + class_device_create(input_class, + MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX if (!(psaux_registered = !misc_register(&psaux_mouse))) @@ -750,7 +756,8 @@ static void __exit mousedev_exit(void) misc_deregister(&psaux_mouse); #endif devfs_remove("input/mice"); - class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); + class_device_destroy(input_class, + MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); input_unregister_handler(&mousedev_handler); } diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index f648678..0487ecb 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -88,9 +88,11 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { }; /* - * Some Fujitsu notebooks are ahving trouble with touhcpads if + * Some Fujitsu notebooks are having trouble with touchpads if * active multiplexing mode is activated. Luckily they don't have * external PS/2 ports so we can safely disable it. + * ... apparently some Toshibas don't like MUX mode either and + * die horrible death on reboot. */ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { { @@ -115,12 +117,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { }, }, { + .ident = "Fujitsu Lifebook S6230", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), + }, + }, + { .ident = "Fujitsu T70H", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), }, }, + { + .ident = "Toshiba P10", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), + }, + }, { } }; @@ -215,11 +231,15 @@ static struct pnp_driver i8042_pnp_aux_driver = { static void i8042_pnp_exit(void) { - if (i8042_pnp_kbd_registered) + if (i8042_pnp_kbd_registered) { + i8042_pnp_kbd_registered = 0; pnp_unregister_driver(&i8042_pnp_kbd_driver); + } - if (i8042_pnp_aux_registered) + if (i8042_pnp_aux_registered) { + i8042_pnp_aux_registered = 0; pnp_unregister_driver(&i8042_pnp_aux_driver); + } } static int i8042_pnp_init(void) @@ -227,7 +247,7 @@ static int i8042_pnp_init(void) int result_kbd, result_aux; if (i8042_nopnp) { - printk("i8042: PNP detection disabled\n"); + printk(KERN_INFO "i8042: PNP detection disabled\n"); return 0; } @@ -241,7 +261,7 @@ static int i8042_pnp_init(void) #if defined(__ia64__) return -ENODEV; #else - printk(KERN_WARNING "PNP: No PS/2 controller found. Probing ports directly.\n"); + printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n"); return 0; #endif } @@ -265,7 +285,7 @@ static int i8042_pnp_init(void) i8042_pnp_kbd_irq = i8042_kbd_irq; } - if (result_aux > 0 && !i8042_pnp_aux_irq) { + if (!i8042_pnp_aux_irq) { printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq); i8042_pnp_aux_irq = i8042_aux_irq; } diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 8e63e46..5900de3 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -698,6 +698,26 @@ static void i8042_timer_func(unsigned long data) i8042_interrupt(0, NULL, NULL); } +static int i8042_ctl_test(void) +{ + unsigned char param; + + if (!i8042_reset) + return 0; + + if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { + printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); + return -1; + } + + if (param != I8042_RET_CTL_TEST) { + printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", + param, I8042_RET_CTL_TEST); + return -1; + } + + return 0; +} /* * i8042_controller init initializes the i8042 controller, and, @@ -719,21 +739,8 @@ static int i8042_controller_init(void) return -1; } - if (i8042_reset) { - - unsigned char param; - - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { - printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); - return -1; - } - - if (param != I8042_RET_CTL_TEST) { - printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", - param, I8042_RET_CTL_TEST); - return -1; - } - } + if (i8042_ctl_test()) + return -1; /* * Save the CTR for restoral on unload / reboot. @@ -802,15 +809,11 @@ static int i8042_controller_init(void) */ static void i8042_controller_reset(void) { - unsigned char param; - /* * Reset the controller if requested. */ - if (i8042_reset) - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) - printk(KERN_ERR "i8042.c: i8042 controller reset timeout.\n"); + i8042_ctl_test(); /* * Disable MUX mode if present. @@ -922,8 +925,11 @@ static int i8042_resume(struct device *dev, u32 level) if (level != RESUME_ENABLE) return 0; - if (i8042_controller_init()) { - printk(KERN_ERR "i8042: resume failed\n"); + if (i8042_ctl_test()) + return -1; + + if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { + printk(KERN_ERR "i8042: Can't write CTR\n"); return -1; } diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 3313e2d..feab497 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -358,37 +358,55 @@ static int serio_thread(void *nothing) * Serio port operations */ -static ssize_t serio_show_description(struct device *dev, char *buf) +static ssize_t serio_show_description(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%s\n", serio->name); } -static ssize_t serio_show_id_type(struct device *dev, char *buf) +static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%02x\n", serio->id.type); } -static ssize_t serio_show_id_proto(struct device *dev, char *buf) +static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%02x\n", serio->id.proto); } -static ssize_t serio_show_id_id(struct device *dev, char *buf) +static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%02x\n", serio->id.id); } -static ssize_t serio_show_id_extra(struct device *dev, char *buf) +static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%02x\n", serio->id.extra); } -static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) +static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL); +static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL); +static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL); +static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL); + +static struct attribute *serio_device_id_attrs[] = { + &dev_attr_type.attr, + &dev_attr_proto.attr, + &dev_attr_id.attr, + &dev_attr_extra.attr, + NULL +}; + +static struct attribute_group serio_id_attr_group = { + .name = "id", + .attrs = serio_device_id_attrs, +}; + +static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct serio *serio = to_serio_port(dev); struct device_driver *drv; @@ -419,13 +437,13 @@ static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t c return retval; } -static ssize_t serio_show_bind_mode(struct device *dev, char *buf) +static ssize_t serio_show_bind_mode(struct device *dev, struct device_attribute *attr, char *buf) { struct serio *serio = to_serio_port(dev); return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto"); } -static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t count) +static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct serio *serio = to_serio_port(dev); int retval; @@ -444,10 +462,6 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c static struct device_attribute serio_device_attrs[] = { __ATTR(description, S_IRUGO, serio_show_description, NULL), - __ATTR(id_type, S_IRUGO, serio_show_id_type, NULL), - __ATTR(id_proto, S_IRUGO, serio_show_id_proto, NULL), - __ATTR(id_id, S_IRUGO, serio_show_id_id, NULL), - __ATTR(id_extra, S_IRUGO, serio_show_id_extra, NULL), __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), __ATTR_NULL @@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio) if (serio->start) serio->start(serio); device_add(&serio->dev); + sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); serio->registered = 1; } @@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio) } if (serio->registered) { + sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); device_del(&serio->dev); list_del_init(&serio->node); serio->registered = 0; @@ -779,7 +795,6 @@ static int serio_resume(struct device *dev) struct serio *serio = to_serio_port(dev); if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { - serio_disconnect_port(serio); /* * Driver re-probing can take a while, so better let kseriod * deal with it. diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 22f7368..f6b8522 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -27,11 +27,15 @@ MODULE_LICENSE("GPL"); MODULE_ALIAS_LDISC(N_MOUSE); #define SERPORT_BUSY 1 +#define SERPORT_ACTIVE 2 +#define SERPORT_DEAD 3 struct serport { struct tty_struct *tty; wait_queue_head_t wait; struct serio *serio; + struct serio_device_id id; + spinlock_t lock; unsigned long flags; }; @@ -45,11 +49,29 @@ static int serport_serio_write(struct serio *serio, unsigned char data) return -(serport->tty->driver->write(serport->tty, &data, 1) != 1); } +static int serport_serio_open(struct serio *serio) +{ + struct serport *serport = serio->port_data; + unsigned long flags; + + spin_lock_irqsave(&serport->lock, flags); + set_bit(SERPORT_ACTIVE, &serport->flags); + spin_unlock_irqrestore(&serport->lock, flags); + + return 0; +} + + static void serport_serio_close(struct serio *serio) { struct serport *serport = serio->port_data; + unsigned long flags; + + spin_lock_irqsave(&serport->lock, flags); + clear_bit(SERPORT_ACTIVE, &serport->flags); + set_bit(SERPORT_DEAD, &serport->flags); + spin_unlock_irqrestore(&serport->lock, flags); - serport->serio->id.type = 0; wake_up_interruptible(&serport->wait); } @@ -61,36 +83,21 @@ static void serport_serio_close(struct serio *serio) static int serport_ldisc_open(struct tty_struct *tty) { struct serport *serport; - struct serio *serio; - char name[64]; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - serport = kmalloc(sizeof(struct serport), GFP_KERNEL); - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); - if (unlikely(!serport || !serio)) { - kfree(serport); - kfree(serio); + serport = kcalloc(1, sizeof(struct serport), GFP_KERNEL); + if (!serport) return -ENOMEM; - } - memset(serport, 0, sizeof(struct serport)); - serport->serio = serio; - set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); serport->tty = tty; - tty->disc_data = serport; - - memset(serio, 0, sizeof(struct serio)); - strlcpy(serio->name, "Serial port", sizeof(serio->name)); - snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name)); - serio->id.type = SERIO_RS232; - serio->write = serport_serio_write; - serio->close = serport_serio_close; - serio->port_data = serport; - + spin_lock_init(&serport->lock); init_waitqueue_head(&serport->wait); + tty->disc_data = serport; + set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); + return 0; } @@ -100,7 +107,8 @@ static int serport_ldisc_open(struct tty_struct *tty) static void serport_ldisc_close(struct tty_struct *tty) { - struct serport *serport = (struct serport*) tty->disc_data; + struct serport *serport = (struct serport *) tty->disc_data; + kfree(serport); } @@ -116,9 +124,19 @@ static void serport_ldisc_close(struct tty_struct *tty) static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) { struct serport *serport = (struct serport*) tty->disc_data; + unsigned long flags; int i; + + spin_lock_irqsave(&serport->lock, flags); + + if (!test_bit(SERPORT_ACTIVE, &serport->flags)) + goto out; + for (i = 0; i < count; i++) serio_interrupt(serport->serio, cp[i], 0, NULL); + +out: + spin_unlock_irqrestore(&serport->lock, flags); } /* @@ -141,16 +159,33 @@ static int serport_ldisc_room(struct tty_struct *tty) static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char __user * buf, size_t nr) { struct serport *serport = (struct serport*) tty->disc_data; + struct serio *serio; char name[64]; if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) return -EBUSY; + serport->serio = serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL); + if (!serio) + return -ENOMEM; + + strlcpy(serio->name, "Serial port", sizeof(serio->name)); + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name)); + serio->id = serport->id; + serio->id.type = SERIO_RS232; + serio->write = serport_serio_write; + serio->open = serport_serio_open; + serio->close = serport_serio_close; + serio->port_data = serport; + serio_register_port(serport->serio); printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name)); - wait_event_interruptible(serport->wait, !serport->serio->id.type); + + wait_event_interruptible(serport->wait, test_bit(SERPORT_DEAD, &serport->flags)); serio_unregister_port(serport->serio); + serport->serio = NULL; + clear_bit(SERPORT_DEAD, &serport->flags); clear_bit(SERPORT_BUSY, &serport->flags); return 0; @@ -163,16 +198,15 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) { struct serport *serport = (struct serport*) tty->disc_data; - struct serio *serio = serport->serio; unsigned long type; if (cmd == SPIOCSTYPE) { if (get_user(type, (unsigned long __user *) arg)) return -EFAULT; - serio->id.proto = type & 0x000000ff; - serio->id.id = (type & 0x0000ff00) >> 8; - serio->id.extra = (type & 0x00ff0000) >> 16; + serport->id.proto = type & 0x000000ff; + serport->id.id = (type & 0x0000ff00) >> 8; + serport->id.extra = (type & 0x00ff0000) >> 16; return 0; } @@ -182,9 +216,13 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi static void serport_ldisc_write_wakeup(struct tty_struct * tty) { - struct serport *sp = (struct serport *) tty->disc_data; + struct serport *serport = (struct serport *) tty->disc_data; + unsigned long flags; - serio_drv_write_wakeup(sp->serio); + spin_lock_irqsave(&serport->lock, flags); + if (test_bit(SERPORT_ACTIVE, &serport->flags)) + serio_drv_write_wakeup(serport->serio); + spin_unlock_irqrestore(&serport->lock, flags); } /* diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index c9d0a15..53a27e4 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c @@ -68,8 +68,7 @@ static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs) if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' || (gunze->data[0] != 'T' && gunze->data[0] != 'R')) { - gunze->data[10] = 0; - printk(KERN_WARNING "gunze.c: bad packet: >%s<\n", gunze->data); + printk(KERN_WARNING "gunze.c: bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data); return; } diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index d0afba8..50c63a1 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c @@ -414,9 +414,9 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor); devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2), S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor); - class_simple_device_add(input_class, - MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), - dev->dev, "ts%d", minor); + class_device_create(input_class, + MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), + dev->dev, "ts%d", minor); return &tsdev->handle; } @@ -426,7 +426,8 @@ static void tsdev_disconnect(struct input_handle *handle) struct tsdev *tsdev = handle->private; struct tsdev_list *list; - class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); + class_device_destroy(input_class, + MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); devfs_remove("input/ts%d", tsdev->minor); devfs_remove("input/tsraw%d", tsdev->minor); tsdev->exist = 0; |