aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
author <jgarzik@pretzel.yyz.us>2005-06-03 23:54:56 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-03 23:54:56 -0400
commit73561695b2e77473e353a5ae63bab81ed5098d8e (patch)
treed039affaa54d38985e41566e4d62e0aa6a170287 /drivers/input
parent6f2f38128170814e151cfedf79532e19cd179567 (diff)
parent8be3de3fd8469154a2b3e18a4712032dac5b4a53 (diff)
Automatic merge of /spare/repo/linux-2.6/.git branch HEAD
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/gameport/Kconfig20
-rw-r--r--drivers/input/joydev.c2
-rw-r--r--drivers/input/keyboard/atkbd.c12
-rw-r--r--drivers/input/mouse/alps.c4
-rw-r--r--drivers/input/mouse/psmouse-base.c7
-rw-r--r--drivers/input/mouse/synaptics.c39
-rw-r--r--drivers/input/mousedev.c15
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h32
-rw-r--r--drivers/input/serio/i8042.c50
-rw-r--r--drivers/input/serio/serio.c25
-rw-r--r--drivers/input/serio/serport.c98
-rw-r--r--drivers/input/touchscreen/gunze.c3
12 files changed, 174 insertions, 133 deletions
diff --git a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig
index 6282f460aba0..1d93f5092904 100644
--- a/drivers/input/gameport/Kconfig
+++ b/drivers/input/gameport/Kconfig
@@ -68,23 +68,3 @@ config GAMEPORT_CS461X
68 depends on PCI 68 depends on PCI
69 69
70endif 70endif
71
72# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on
73# in every .config. Please don't touch it. It is here to handle an
74# unusual dependency between GAMEPORT and sound drivers.
75#
76# Some sound drivers call gameport functions. If GAMEPORT is
77# not selected, empty stubs are provided for the functions and all is
78# well.
79# If GAMEPORT is built in, everything is fine.
80# If GAMEPORT is a module, however, it would need to be loaded for the
81# sound driver to be able to link properly. Therefore, the sound
82# driver must be a module as well in that case. Since there's no way
83# to express that directly in Kconfig, we use SOUND_GAMEPORT to
84# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm',
85# anything that depends on SOUND_GAMEPORT must be 'm' as well. if
86# GAMEPORT is 'y' or 'n', it can be anything".
87config SOUND_GAMEPORT
88 tristate
89 default m if GAMEPORT=m
90 default y
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 7d7527f8b02d..627d343dfba1 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
422 joydev->nkey++; 422 joydev->nkey++;
423 } 423 }
424 424
425 for (i = 0; i < BTN_JOYSTICK - BTN_MISC + 1; i++) 425 for (i = 0; i < BTN_JOYSTICK - BTN_MISC; i++)
426 if (test_bit(i + BTN_MISC, dev->keybit)) { 426 if (test_bit(i + BTN_MISC, dev->keybit)) {
427 joydev->keymap[i] = joydev->nkey; 427 joydev->keymap[i] = joydev->nkey;
428 joydev->keypam[joydev->nkey] = i + BTN_MISC; 428 joydev->keypam[joydev->nkey] = i + BTN_MISC;
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index ff66ed4ee2cd..af0446c6de82 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -171,9 +171,9 @@ static struct {
171 unsigned char set2; 171 unsigned char set2;
172} atkbd_scroll_keys[] = { 172} atkbd_scroll_keys[] = {
173 { ATKBD_SCR_1, 0xc5 }, 173 { ATKBD_SCR_1, 0xc5 },
174 { ATKBD_SCR_2, 0xa9 }, 174 { ATKBD_SCR_2, 0x9d },
175 { ATKBD_SCR_4, 0xb6 }, 175 { ATKBD_SCR_4, 0xa4 },
176 { ATKBD_SCR_8, 0xa7 }, 176 { ATKBD_SCR_8, 0x9b },
177 { ATKBD_SCR_CLICK, 0xe0 }, 177 { ATKBD_SCR_CLICK, 0xe0 },
178 { ATKBD_SCR_LEFT, 0xcb }, 178 { ATKBD_SCR_LEFT, 0xcb },
179 { ATKBD_SCR_RIGHT, 0xd2 }, 179 { ATKBD_SCR_RIGHT, 0xd2 },
@@ -465,8 +465,10 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int co
465 if (atkbd->softrepeat) return 0; 465 if (atkbd->softrepeat) return 0;
466 466
467 i = j = 0; 467 i = j = 0;
468 while (i < 32 && period[i] < dev->rep[REP_PERIOD]) i++; 468 while (i < 31 && period[i] < dev->rep[REP_PERIOD])
469 while (j < 4 && delay[j] < dev->rep[REP_DELAY]) j++; 469 i++;
470 while (j < 3 && delay[j] < dev->rep[REP_DELAY])
471 j++;
470 dev->rep[REP_PERIOD] = period[i]; 472 dev->rep[REP_PERIOD] = period[i];
471 dev->rep[REP_DELAY] = delay[j]; 473 dev->rep[REP_DELAY] = delay[j];
472 param[0] = i | (j << 5); 474 param[0] = i | (j << 5);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 1f85a9718c89..42a9f7f6f8cb 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -341,6 +341,8 @@ static int alps_reconnect(struct psmouse *psmouse)
341 unsigned char param[4]; 341 unsigned char param[4];
342 int version; 342 int version;
343 343
344 psmouse_reset(psmouse);
345
344 if (!(priv->i = alps_get_model(psmouse, &version))) 346 if (!(priv->i = alps_get_model(psmouse, &version)))
345 return -1; 347 return -1;
346 348
@@ -395,7 +397,7 @@ int alps_init(struct psmouse *psmouse)
395 } 397 }
396 398
397 if (param[0] & 0x04) { 399 if (param[0] & 0x04) {
398 printk(KERN_INFO " Enabling hardware tapping\n"); 400 printk(KERN_INFO "alps.c: Enabling hardware tapping\n");
399 if (alps_tap_mode(psmouse, 1)) 401 if (alps_tap_mode(psmouse, 1))
400 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); 402 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
401 } 403 }
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index cd8509549eac..019034b21a0b 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)
518/* 518/*
519 * First, we check if it's a mouse. It should send 0x00 or 0x03 519 * First, we check if it's a mouse. It should send 0x00 or 0x03
520 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. 520 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer.
521 * Sunrex K8561 IR Keyboard/Mouse reports 0xff on second and subsequent
522 * ID queries, probably due to a firmware bug.
521 */ 523 */
522 524
523 param[0] = 0xa5; 525 param[0] = 0xa5;
524 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID)) 526 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID))
525 return -1; 527 return -1;
526 528
527 if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04) 529 if (param[0] != 0x00 && param[0] != 0x03 &&
530 param[0] != 0x04 && param[0] != 0xff)
528 return -1; 531 return -1;
529 532
530/* 533/*
@@ -972,7 +975,7 @@ static int psmouse_set_maxproto(const char *val, struct kernel_param *kp)
972 return -EINVAL; 975 return -EINVAL;
973 976
974 if (!strncmp(val, "any", 3)) { 977 if (!strncmp(val, "any", 3)) {
975 *((unsigned int *)kp->arg) = -1UL; 978 *((unsigned int *)kp->arg) = -1U;
976 return 0; 979 return 0;
977 } 980 }
978 981
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 69832f8fb720..36c721227b68 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -143,39 +143,6 @@ static int synaptics_identify(struct psmouse *psmouse)
143 return -1; 143 return -1;
144} 144}
145 145
146static void print_ident(struct synaptics_data *priv)
147{
148 printk(KERN_INFO "Synaptics Touchpad, model: %ld\n", SYN_ID_MODEL(priv->identity));
149 printk(KERN_INFO " Firmware: %ld.%ld\n", SYN_ID_MAJOR(priv->identity),
150 SYN_ID_MINOR(priv->identity));
151 if (SYN_MODEL_ROT180(priv->model_id))
152 printk(KERN_INFO " 180 degree mounted touchpad\n");
153 if (SYN_MODEL_PORTRAIT(priv->model_id))
154 printk(KERN_INFO " portrait touchpad\n");
155 printk(KERN_INFO " Sensor: %ld\n", SYN_MODEL_SENSOR(priv->model_id));
156 if (SYN_MODEL_NEWABS(priv->model_id))
157 printk(KERN_INFO " new absolute packet format\n");
158 if (SYN_MODEL_PEN(priv->model_id))
159 printk(KERN_INFO " pen detection\n");
160
161 if (SYN_CAP_EXTENDED(priv->capabilities)) {
162 printk(KERN_INFO " Touchpad has extended capability bits\n");
163 if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
164 printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n",
165 (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)));
166 if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
167 printk(KERN_INFO " -> middle button\n");
168 if (SYN_CAP_FOUR_BUTTON(priv->capabilities))
169 printk(KERN_INFO " -> four buttons\n");
170 if (SYN_CAP_MULTIFINGER(priv->capabilities))
171 printk(KERN_INFO " -> multifinger detection\n");
172 if (SYN_CAP_PALMDETECT(priv->capabilities))
173 printk(KERN_INFO " -> palm detection\n");
174 if (SYN_CAP_PASS_THROUGH(priv->capabilities))
175 printk(KERN_INFO " -> pass-through port\n");
176 }
177}
178
179static int synaptics_query_hardware(struct psmouse *psmouse) 146static int synaptics_query_hardware(struct psmouse *psmouse)
180{ 147{
181 int retries = 0; 148 int retries = 0;
@@ -666,7 +633,11 @@ int synaptics_init(struct psmouse *psmouse)
666 633
667 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 634 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
668 635
669 print_ident(priv); 636 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n",
637 SYN_ID_MODEL(priv->identity),
638 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
639 priv->model_id, priv->capabilities, priv->ext_cap);
640
670 set_input_params(&psmouse->dev, priv); 641 set_input_params(&psmouse->dev, priv);
671 642
672 psmouse->protocol_handler = synaptics_process_byte; 643 psmouse->protocol_handler = synaptics_process_byte;
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 564974ce5793..96fb9870834a 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -101,6 +101,7 @@ struct mousedev_list {
101 unsigned char ready, buffer, bufsiz; 101 unsigned char ready, buffer, bufsiz;
102 unsigned char imexseq, impsseq; 102 unsigned char imexseq, impsseq;
103 enum mousedev_emul mode; 103 enum mousedev_emul mode;
104 unsigned long last_buttons;
104}; 105};
105 106
106#define MOUSEDEV_SEQ_LEN 6 107#define MOUSEDEV_SEQ_LEN 6
@@ -224,7 +225,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h
224 spin_lock_irqsave(&list->packet_lock, flags); 225 spin_lock_irqsave(&list->packet_lock, flags);
225 226
226 p = &list->packets[list->head]; 227 p = &list->packets[list->head];
227 if (list->ready && p->buttons != packet->buttons) { 228 if (list->ready && p->buttons != mousedev->packet.buttons) {
228 unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN; 229 unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN;
229 if (new_head != list->tail) { 230 if (new_head != list->tail) {
230 p = &list->packets[list->head = new_head]; 231 p = &list->packets[list->head = new_head];
@@ -249,10 +250,13 @@ static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_h
249 p->dz += packet->dz; 250 p->dz += packet->dz;
250 p->buttons = mousedev->packet.buttons; 251 p->buttons = mousedev->packet.buttons;
251 252
252 list->ready = 1; 253 if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons)
254 list->ready = 1;
253 255
254 spin_unlock_irqrestore(&list->packet_lock, flags); 256 spin_unlock_irqrestore(&list->packet_lock, flags);
255 kill_fasync(&list->fasync, SIGIO, POLL_IN); 257
258 if (list->ready)
259 kill_fasync(&list->fasync, SIGIO, POLL_IN);
256 } 260 }
257 261
258 wake_up_interruptible(&mousedev->wait); 262 wake_up_interruptible(&mousedev->wait);
@@ -477,9 +481,10 @@ static void mousedev_packet(struct mousedev_list *list, signed char *ps2_data)
477 } 481 }
478 482
479 if (!p->dx && !p->dy && !p->dz) { 483 if (!p->dx && !p->dy && !p->dz) {
480 if (list->tail == list->head) 484 if (list->tail == list->head) {
481 list->ready = 0; 485 list->ready = 0;
482 else 486 list->last_buttons = p->buttons;
487 } else
483 list->tail = (list->tail + 1) % PACKET_QUEUE_LEN; 488 list->tail = (list->tail + 1) % PACKET_QUEUE_LEN;
484 } 489 }
485 490
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index f64867808fea..0487ecbb8a49 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[] = {
88}; 88};
89 89
90/* 90/*
91 * Some Fujitsu notebooks are ahving trouble with touhcpads if 91 * Some Fujitsu notebooks are having trouble with touchpads if
92 * active multiplexing mode is activated. Luckily they don't have 92 * active multiplexing mode is activated. Luckily they don't have
93 * external PS/2 ports so we can safely disable it. 93 * external PS/2 ports so we can safely disable it.
94 * ... apparently some Toshibas don't like MUX mode either and
95 * die horrible death on reboot.
94 */ 96 */
95static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { 97static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
96 { 98 {
@@ -115,12 +117,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
115 }, 117 },
116 }, 118 },
117 { 119 {
120 .ident = "Fujitsu Lifebook S6230",
121 .matches = {
122 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
123 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
124 },
125 },
126 {
118 .ident = "Fujitsu T70H", 127 .ident = "Fujitsu T70H",
119 .matches = { 128 .matches = {
120 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 129 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
121 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), 130 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
122 }, 131 },
123 }, 132 },
133 {
134 .ident = "Toshiba P10",
135 .matches = {
136 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
138 },
139 },
124 { } 140 { }
125}; 141};
126 142
@@ -215,11 +231,15 @@ static struct pnp_driver i8042_pnp_aux_driver = {
215 231
216static void i8042_pnp_exit(void) 232static void i8042_pnp_exit(void)
217{ 233{
218 if (i8042_pnp_kbd_registered) 234 if (i8042_pnp_kbd_registered) {
235 i8042_pnp_kbd_registered = 0;
219 pnp_unregister_driver(&i8042_pnp_kbd_driver); 236 pnp_unregister_driver(&i8042_pnp_kbd_driver);
237 }
220 238
221 if (i8042_pnp_aux_registered) 239 if (i8042_pnp_aux_registered) {
240 i8042_pnp_aux_registered = 0;
222 pnp_unregister_driver(&i8042_pnp_aux_driver); 241 pnp_unregister_driver(&i8042_pnp_aux_driver);
242 }
223} 243}
224 244
225static int i8042_pnp_init(void) 245static int i8042_pnp_init(void)
@@ -227,7 +247,7 @@ static int i8042_pnp_init(void)
227 int result_kbd, result_aux; 247 int result_kbd, result_aux;
228 248
229 if (i8042_nopnp) { 249 if (i8042_nopnp) {
230 printk("i8042: PNP detection disabled\n"); 250 printk(KERN_INFO "i8042: PNP detection disabled\n");
231 return 0; 251 return 0;
232 } 252 }
233 253
@@ -241,7 +261,7 @@ static int i8042_pnp_init(void)
241#if defined(__ia64__) 261#if defined(__ia64__)
242 return -ENODEV; 262 return -ENODEV;
243#else 263#else
244 printk(KERN_WARNING "PNP: No PS/2 controller found. Probing ports directly.\n"); 264 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
245 return 0; 265 return 0;
246#endif 266#endif
247 } 267 }
@@ -265,7 +285,7 @@ static int i8042_pnp_init(void)
265 i8042_pnp_kbd_irq = i8042_kbd_irq; 285 i8042_pnp_kbd_irq = i8042_kbd_irq;
266 } 286 }
267 287
268 if (result_aux > 0 && !i8042_pnp_aux_irq) { 288 if (!i8042_pnp_aux_irq) {
269 printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq); 289 printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq);
270 i8042_pnp_aux_irq = i8042_aux_irq; 290 i8042_pnp_aux_irq = i8042_aux_irq;
271 } 291 }
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 8e63e464d361..5900de3c3f4f 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)
698 i8042_interrupt(0, NULL, NULL); 698 i8042_interrupt(0, NULL, NULL);
699} 699}
700 700
701static int i8042_ctl_test(void)
702{
703 unsigned char param;
704
705 if (!i8042_reset)
706 return 0;
707
708 if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
709 printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
710 return -1;
711 }
712
713 if (param != I8042_RET_CTL_TEST) {
714 printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n",
715 param, I8042_RET_CTL_TEST);
716 return -1;
717 }
718
719 return 0;
720}
701 721
702/* 722/*
703 * i8042_controller init initializes the i8042 controller, and, 723 * i8042_controller init initializes the i8042 controller, and,
@@ -719,21 +739,8 @@ static int i8042_controller_init(void)
719 return -1; 739 return -1;
720 } 740 }
721 741
722 if (i8042_reset) { 742 if (i8042_ctl_test())
723 743 return -1;
724 unsigned char param;
725
726 if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
727 printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
728 return -1;
729 }
730
731 if (param != I8042_RET_CTL_TEST) {
732 printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n",
733 param, I8042_RET_CTL_TEST);
734 return -1;
735 }
736 }
737 744
738/* 745/*
739 * Save the CTR for restoral on unload / reboot. 746 * Save the CTR for restoral on unload / reboot.
@@ -802,15 +809,11 @@ static int i8042_controller_init(void)
802 */ 809 */
803static void i8042_controller_reset(void) 810static void i8042_controller_reset(void)
804{ 811{
805 unsigned char param;
806
807/* 812/*
808 * Reset the controller if requested. 813 * Reset the controller if requested.
809 */ 814 */
810 815
811 if (i8042_reset) 816 i8042_ctl_test();
812 if (i8042_command(&param, I8042_CMD_CTL_TEST))
813 printk(KERN_ERR "i8042.c: i8042 controller reset timeout.\n");
814 817
815/* 818/*
816 * Disable MUX mode if present. 819 * Disable MUX mode if present.
@@ -922,8 +925,11 @@ static int i8042_resume(struct device *dev, u32 level)
922 if (level != RESUME_ENABLE) 925 if (level != RESUME_ENABLE)
923 return 0; 926 return 0;
924 927
925 if (i8042_controller_init()) { 928 if (i8042_ctl_test())
926 printk(KERN_ERR "i8042: resume failed\n"); 929 return -1;
930
931 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
932 printk(KERN_ERR "i8042: Can't write CTR\n");
927 return -1; 933 return -1;
928 } 934 }
929 935
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 3313e2daeab0..0beacb77ee18 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -388,6 +388,24 @@ static ssize_t serio_show_id_extra(struct device *dev, char *buf)
388 return sprintf(buf, "%02x\n", serio->id.extra); 388 return sprintf(buf, "%02x\n", serio->id.extra);
389} 389}
390 390
391static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL);
392static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
393static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
394static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
395
396static struct attribute *serio_device_id_attrs[] = {
397 &dev_attr_type.attr,
398 &dev_attr_proto.attr,
399 &dev_attr_id.attr,
400 &dev_attr_extra.attr,
401 NULL
402};
403
404static struct attribute_group serio_id_attr_group = {
405 .name = "id",
406 .attrs = serio_device_id_attrs,
407};
408
391static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) 409static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count)
392{ 410{
393 struct serio *serio = to_serio_port(dev); 411 struct serio *serio = to_serio_port(dev);
@@ -444,10 +462,6 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c
444 462
445static struct device_attribute serio_device_attrs[] = { 463static struct device_attribute serio_device_attrs[] = {
446 __ATTR(description, S_IRUGO, serio_show_description, NULL), 464 __ATTR(description, S_IRUGO, serio_show_description, NULL),
447 __ATTR(id_type, S_IRUGO, serio_show_id_type, NULL),
448 __ATTR(id_proto, S_IRUGO, serio_show_id_proto, NULL),
449 __ATTR(id_id, S_IRUGO, serio_show_id_id, NULL),
450 __ATTR(id_extra, S_IRUGO, serio_show_id_extra, NULL),
451 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 465 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
452 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 466 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
453 __ATTR_NULL 467 __ATTR_NULL
@@ -498,6 +512,7 @@ static void serio_add_port(struct serio *serio)
498 if (serio->start) 512 if (serio->start)
499 serio->start(serio); 513 serio->start(serio);
500 device_add(&serio->dev); 514 device_add(&serio->dev);
515 sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
501 serio->registered = 1; 516 serio->registered = 1;
502} 517}
503 518
@@ -526,6 +541,7 @@ static void serio_destroy_port(struct serio *serio)
526 } 541 }
527 542
528 if (serio->registered) { 543 if (serio->registered) {
544 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
529 device_del(&serio->dev); 545 device_del(&serio->dev);
530 list_del_init(&serio->node); 546 list_del_init(&serio->node);
531 serio->registered = 0; 547 serio->registered = 0;
@@ -779,7 +795,6 @@ static int serio_resume(struct device *dev)
779 struct serio *serio = to_serio_port(dev); 795 struct serio *serio = to_serio_port(dev);
780 796
781 if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { 797 if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) {
782 serio_disconnect_port(serio);
783 /* 798 /*
784 * Driver re-probing can take a while, so better let kseriod 799 * Driver re-probing can take a while, so better let kseriod
785 * deal with it. 800 * deal with it.
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
index 22f73683952b..f6b85222ba3d 100644
--- a/drivers/input/serio/serport.c
+++ b/drivers/input/serio/serport.c
@@ -27,11 +27,15 @@ MODULE_LICENSE("GPL");
27MODULE_ALIAS_LDISC(N_MOUSE); 27MODULE_ALIAS_LDISC(N_MOUSE);
28 28
29#define SERPORT_BUSY 1 29#define SERPORT_BUSY 1
30#define SERPORT_ACTIVE 2
31#define SERPORT_DEAD 3
30 32
31struct serport { 33struct serport {
32 struct tty_struct *tty; 34 struct tty_struct *tty;
33 wait_queue_head_t wait; 35 wait_queue_head_t wait;
34 struct serio *serio; 36 struct serio *serio;
37 struct serio_device_id id;
38 spinlock_t lock;
35 unsigned long flags; 39 unsigned long flags;
36}; 40};
37 41
@@ -45,11 +49,29 @@ static int serport_serio_write(struct serio *serio, unsigned char data)
45 return -(serport->tty->driver->write(serport->tty, &data, 1) != 1); 49 return -(serport->tty->driver->write(serport->tty, &data, 1) != 1);
46} 50}
47 51
52static int serport_serio_open(struct serio *serio)
53{
54 struct serport *serport = serio->port_data;
55 unsigned long flags;
56
57 spin_lock_irqsave(&serport->lock, flags);
58 set_bit(SERPORT_ACTIVE, &serport->flags);
59 spin_unlock_irqrestore(&serport->lock, flags);
60
61 return 0;
62}
63
64
48static void serport_serio_close(struct serio *serio) 65static void serport_serio_close(struct serio *serio)
49{ 66{
50 struct serport *serport = serio->port_data; 67 struct serport *serport = serio->port_data;
68 unsigned long flags;
69
70 spin_lock_irqsave(&serport->lock, flags);
71 clear_bit(SERPORT_ACTIVE, &serport->flags);
72 set_bit(SERPORT_DEAD, &serport->flags);
73 spin_unlock_irqrestore(&serport->lock, flags);
51 74
52 serport->serio->id.type = 0;
53 wake_up_interruptible(&serport->wait); 75 wake_up_interruptible(&serport->wait);
54} 76}
55 77
@@ -61,36 +83,21 @@ static void serport_serio_close(struct serio *serio)
61static int serport_ldisc_open(struct tty_struct *tty) 83static int serport_ldisc_open(struct tty_struct *tty)
62{ 84{
63 struct serport *serport; 85 struct serport *serport;
64 struct serio *serio;
65 char name[64];
66 86
67 if (!capable(CAP_SYS_ADMIN)) 87 if (!capable(CAP_SYS_ADMIN))
68 return -EPERM; 88 return -EPERM;
69 89
70 serport = kmalloc(sizeof(struct serport), GFP_KERNEL); 90 serport = kcalloc(1, sizeof(struct serport), GFP_KERNEL);
71 serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 91 if (!serport)
72 if (unlikely(!serport || !serio)) {
73 kfree(serport);
74 kfree(serio);
75 return -ENOMEM; 92 return -ENOMEM;
76 }
77 93
78 memset(serport, 0, sizeof(struct serport));
79 serport->serio = serio;
80 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
81 serport->tty = tty; 94 serport->tty = tty;
82 tty->disc_data = serport; 95 spin_lock_init(&serport->lock);
83
84 memset(serio, 0, sizeof(struct serio));
85 strlcpy(serio->name, "Serial port", sizeof(serio->name));
86 snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name));
87 serio->id.type = SERIO_RS232;
88 serio->write = serport_serio_write;
89 serio->close = serport_serio_close;
90 serio->port_data = serport;
91
92 init_waitqueue_head(&serport->wait); 96 init_waitqueue_head(&serport->wait);
93 97
98 tty->disc_data = serport;
99 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
100
94 return 0; 101 return 0;
95} 102}
96 103
@@ -100,7 +107,8 @@ static int serport_ldisc_open(struct tty_struct *tty)
100 107
101static void serport_ldisc_close(struct tty_struct *tty) 108static void serport_ldisc_close(struct tty_struct *tty)
102{ 109{
103 struct serport *serport = (struct serport*) tty->disc_data; 110 struct serport *serport = (struct serport *) tty->disc_data;
111
104 kfree(serport); 112 kfree(serport);
105} 113}
106 114
@@ -116,9 +124,19 @@ static void serport_ldisc_close(struct tty_struct *tty)
116static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) 124static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
117{ 125{
118 struct serport *serport = (struct serport*) tty->disc_data; 126 struct serport *serport = (struct serport*) tty->disc_data;
127 unsigned long flags;
119 int i; 128 int i;
129
130 spin_lock_irqsave(&serport->lock, flags);
131
132 if (!test_bit(SERPORT_ACTIVE, &serport->flags))
133 goto out;
134
120 for (i = 0; i < count; i++) 135 for (i = 0; i < count; i++)
121 serio_interrupt(serport->serio, cp[i], 0, NULL); 136 serio_interrupt(serport->serio, cp[i], 0, NULL);
137
138out:
139 spin_unlock_irqrestore(&serport->lock, flags);
122} 140}
123 141
124/* 142/*
@@ -141,16 +159,33 @@ static int serport_ldisc_room(struct tty_struct *tty)
141static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char __user * buf, size_t nr) 159static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char __user * buf, size_t nr)
142{ 160{
143 struct serport *serport = (struct serport*) tty->disc_data; 161 struct serport *serport = (struct serport*) tty->disc_data;
162 struct serio *serio;
144 char name[64]; 163 char name[64];
145 164
146 if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) 165 if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
147 return -EBUSY; 166 return -EBUSY;
148 167
168 serport->serio = serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
169 if (!serio)
170 return -ENOMEM;
171
172 strlcpy(serio->name, "Serial port", sizeof(serio->name));
173 snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name));
174 serio->id = serport->id;
175 serio->id.type = SERIO_RS232;
176 serio->write = serport_serio_write;
177 serio->open = serport_serio_open;
178 serio->close = serport_serio_close;
179 serio->port_data = serport;
180
149 serio_register_port(serport->serio); 181 serio_register_port(serport->serio);
150 printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name)); 182 printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name));
151 wait_event_interruptible(serport->wait, !serport->serio->id.type); 183
184 wait_event_interruptible(serport->wait, test_bit(SERPORT_DEAD, &serport->flags));
152 serio_unregister_port(serport->serio); 185 serio_unregister_port(serport->serio);
186 serport->serio = NULL;
153 187
188 clear_bit(SERPORT_DEAD, &serport->flags);
154 clear_bit(SERPORT_BUSY, &serport->flags); 189 clear_bit(SERPORT_BUSY, &serport->flags);
155 190
156 return 0; 191 return 0;
@@ -163,16 +198,15 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u
163static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) 198static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg)
164{ 199{
165 struct serport *serport = (struct serport*) tty->disc_data; 200 struct serport *serport = (struct serport*) tty->disc_data;
166 struct serio *serio = serport->serio;
167 unsigned long type; 201 unsigned long type;
168 202
169 if (cmd == SPIOCSTYPE) { 203 if (cmd == SPIOCSTYPE) {
170 if (get_user(type, (unsigned long __user *) arg)) 204 if (get_user(type, (unsigned long __user *) arg))
171 return -EFAULT; 205 return -EFAULT;
172 206
173 serio->id.proto = type & 0x000000ff; 207 serport->id.proto = type & 0x000000ff;
174 serio->id.id = (type & 0x0000ff00) >> 8; 208 serport->id.id = (type & 0x0000ff00) >> 8;
175 serio->id.extra = (type & 0x00ff0000) >> 16; 209 serport->id.extra = (type & 0x00ff0000) >> 16;
176 210
177 return 0; 211 return 0;
178 } 212 }
@@ -182,9 +216,13 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi
182 216
183static void serport_ldisc_write_wakeup(struct tty_struct * tty) 217static void serport_ldisc_write_wakeup(struct tty_struct * tty)
184{ 218{
185 struct serport *sp = (struct serport *) tty->disc_data; 219 struct serport *serport = (struct serport *) tty->disc_data;
220 unsigned long flags;
186 221
187 serio_drv_write_wakeup(sp->serio); 222 spin_lock_irqsave(&serport->lock, flags);
223 if (test_bit(SERPORT_ACTIVE, &serport->flags))
224 serio_drv_write_wakeup(serport->serio);
225 spin_unlock_irqrestore(&serport->lock, flags);
188} 226}
189 227
190/* 228/*
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index c9d0a153671c..53a27e43dd23 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)
68 68
69 if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' || 69 if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' ||
70 (gunze->data[0] != 'T' && gunze->data[0] != 'R')) { 70 (gunze->data[0] != 'T' && gunze->data[0] != 'R')) {
71 gunze->data[10] = 0; 71 printk(KERN_WARNING "gunze.c: bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data);
72 printk(KERN_WARNING "gunze.c: bad packet: >%s<\n", gunze->data);
73 return; 72 return;
74 } 73 }
75 74