Input: serio - offload resume to kseriod

When resuming AUX ports psmouse driver calls psmouse_extensions()
to determine if the attached mouse is still the same, which may take
a while to complete for generic mice. Offload the resume process to
kseriod so the rest of the system may continue resuming without
waiting for the mouse.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Shaohua Li and committed by
Dmitry Torokhov
6aabcdff a822bea7

+37 -18
+37 -18
drivers/input/serio/serio.c
··· 63 static struct bus_type serio_bus; 64 65 static void serio_add_port(struct serio *serio); 66 - static void serio_reconnect_port(struct serio *serio); 67 static void serio_disconnect_port(struct serio *serio); 68 static void serio_attach_driver(struct serio_driver *drv); 69 70 static int serio_connect_driver(struct serio *serio, struct serio_driver *drv) ··· 162 enum serio_event_type { 163 SERIO_RESCAN_PORT, 164 SERIO_RECONNECT_PORT, 165 SERIO_REGISTER_PORT, 166 SERIO_ATTACH_DRIVER, 167 }; ··· 315 case SERIO_RESCAN_PORT: 316 serio_disconnect_port(event->object); 317 serio_find_driver(event->object); 318 break; 319 320 case SERIO_ATTACH_DRIVER: ··· 476 if (!strncmp(buf, "none", count)) { 477 serio_disconnect_port(serio); 478 } else if (!strncmp(buf, "reconnect", count)) { 479 - serio_reconnect_port(serio); 480 } else if (!strncmp(buf, "rescan", count)) { 481 serio_disconnect_port(serio); 482 serio_find_driver(serio); ··· 626 } 627 628 /* 629 * Reconnect serio port and all its children (re-initialize attached devices) 630 */ 631 - static void serio_reconnect_port(struct serio *serio) 632 { 633 do { 634 - if (serio_reconnect_driver(serio)) { 635 - serio_disconnect_port(serio); 636 - serio_find_driver(serio); 637 /* Ok, old children are now gone, we are done */ 638 break; 639 } ··· 695 696 void serio_reconnect(struct serio *serio) 697 { 698 - serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); 699 } 700 701 /* ··· 949 950 static int serio_resume(struct device *dev) 951 { 952 - struct serio *serio = to_serio_port(dev); 953 - 954 - if (dev->power.power_state.event != PM_EVENT_ON && 955 - serio_reconnect_driver(serio)) { 956 - /* 957 - * Driver re-probing can take a while, so better let kseriod 958 - * deal with it. 959 - */ 960 - serio_rescan(serio); 961 } 962 - 963 - dev->power.power_state = PMSG_ON; 964 965 return 0; 966 }
··· 63 static struct bus_type serio_bus; 64 65 static void serio_add_port(struct serio *serio); 66 + static int serio_reconnect_port(struct serio *serio); 67 static void serio_disconnect_port(struct serio *serio); 68 + static void serio_reconnect_chain(struct serio *serio); 69 static void serio_attach_driver(struct serio_driver *drv); 70 71 static int serio_connect_driver(struct serio *serio, struct serio_driver *drv) ··· 161 enum serio_event_type { 162 SERIO_RESCAN_PORT, 163 SERIO_RECONNECT_PORT, 164 + SERIO_RECONNECT_CHAIN, 165 SERIO_REGISTER_PORT, 166 SERIO_ATTACH_DRIVER, 167 }; ··· 313 case SERIO_RESCAN_PORT: 314 serio_disconnect_port(event->object); 315 serio_find_driver(event->object); 316 + break; 317 + 318 + case SERIO_RECONNECT_CHAIN: 319 + serio_reconnect_chain(event->object); 320 break; 321 322 case SERIO_ATTACH_DRIVER: ··· 470 if (!strncmp(buf, "none", count)) { 471 serio_disconnect_port(serio); 472 } else if (!strncmp(buf, "reconnect", count)) { 473 + serio_reconnect_chain(serio); 474 } else if (!strncmp(buf, "rescan", count)) { 475 serio_disconnect_port(serio); 476 serio_find_driver(serio); ··· 620 } 621 622 /* 623 + * Reconnect serio port (re-initialize attached device). 624 + * If reconnect fails (old device is no longer attached or 625 + * there was no device to begin with) we do full rescan in 626 + * hope of finding a driver for the port. 627 + */ 628 + static int serio_reconnect_port(struct serio *serio) 629 + { 630 + int error = serio_reconnect_driver(serio); 631 + 632 + if (error) { 633 + serio_disconnect_port(serio); 634 + serio_find_driver(serio); 635 + } 636 + 637 + return error; 638 + } 639 + 640 + /* 641 * Reconnect serio port and all its children (re-initialize attached devices) 642 */ 643 + static void serio_reconnect_chain(struct serio *serio) 644 { 645 do { 646 + if (serio_reconnect_port(serio)) { 647 /* Ok, old children are now gone, we are done */ 648 break; 649 } ··· 673 674 void serio_reconnect(struct serio *serio) 675 { 676 + serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN); 677 } 678 679 /* ··· 927 928 static int serio_resume(struct device *dev) 929 { 930 + /* 931 + * Driver reconnect can take a while, so better let kseriod 932 + * deal with it. 933 + */ 934 + if (dev->power.power_state.event != PM_EVENT_ON) { 935 + dev->power.power_state = PMSG_ON; 936 + serio_queue_event(to_serio_port(dev), NULL, 937 + SERIO_RECONNECT_PORT); 938 } 939 940 return 0; 941 }