aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/serio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r--drivers/input/serio/serio.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index bc033250dfcd..fb17573f8f2d 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -41,17 +41,6 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
41MODULE_DESCRIPTION("Serio abstraction core"); 41MODULE_DESCRIPTION("Serio abstraction core");
42MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
43 43
44EXPORT_SYMBOL(serio_interrupt);
45EXPORT_SYMBOL(__serio_register_port);
46EXPORT_SYMBOL(serio_unregister_port);
47EXPORT_SYMBOL(serio_unregister_child_port);
48EXPORT_SYMBOL(__serio_register_driver);
49EXPORT_SYMBOL(serio_unregister_driver);
50EXPORT_SYMBOL(serio_open);
51EXPORT_SYMBOL(serio_close);
52EXPORT_SYMBOL(serio_rescan);
53EXPORT_SYMBOL(serio_reconnect);
54
55/* 44/*
56 * serio_mutex protects entire serio subsystem and is taken every time 45 * serio_mutex protects entire serio subsystem and is taken every time
57 * serio port or driver registrered or unregistered. 46 * serio port or driver registrered or unregistered.
@@ -506,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
506 495
507 retval = count; 496 retval = count;
508 if (!strncmp(buf, "manual", count)) { 497 if (!strncmp(buf, "manual", count)) {
509 serio->manual_bind = 1; 498 serio->manual_bind = true;
510 } else if (!strncmp(buf, "auto", count)) { 499 } else if (!strncmp(buf, "auto", count)) {
511 serio->manual_bind = 0; 500 serio->manual_bind = false;
512 } else { 501 } else {
513 retval = -EINVAL; 502 retval = -EINVAL;
514 } 503 }
@@ -581,7 +570,7 @@ static void serio_add_port(struct serio *serio)
581 "serio: device_add() failed for %s (%s), error: %d\n", 570 "serio: device_add() failed for %s (%s), error: %d\n",
582 serio->phys, serio->name, error); 571 serio->phys, serio->name, error);
583 else { 572 else {
584 serio->registered = 1; 573 serio->registered = true;
585 error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); 574 error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
586 if (error) 575 if (error)
587 printk(KERN_ERR 576 printk(KERN_ERR
@@ -617,7 +606,7 @@ static void serio_destroy_port(struct serio *serio)
617 if (serio->registered) { 606 if (serio->registered) {
618 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); 607 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
619 device_del(&serio->dev); 608 device_del(&serio->dev);
620 serio->registered = 0; 609 serio->registered = false;
621 } 610 }
622 611
623 list_del_init(&serio->node); 612 list_del_init(&serio->node);
@@ -692,11 +681,13 @@ void serio_rescan(struct serio *serio)
692{ 681{
693 serio_queue_event(serio, NULL, SERIO_RESCAN_PORT); 682 serio_queue_event(serio, NULL, SERIO_RESCAN_PORT);
694} 683}
684EXPORT_SYMBOL(serio_rescan);
695 685
696void serio_reconnect(struct serio *serio) 686void serio_reconnect(struct serio *serio)
697{ 687{
698 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN); 688 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN);
699} 689}
690EXPORT_SYMBOL(serio_reconnect);
700 691
701/* 692/*
702 * Submits register request to kseriod for subsequent execution. 693 * Submits register request to kseriod for subsequent execution.
@@ -707,6 +698,7 @@ void __serio_register_port(struct serio *serio, struct module *owner)
707 serio_init_port(serio); 698 serio_init_port(serio);
708 serio_queue_event(serio, owner, SERIO_REGISTER_PORT); 699 serio_queue_event(serio, owner, SERIO_REGISTER_PORT);
709} 700}
701EXPORT_SYMBOL(__serio_register_port);
710 702
711/* 703/*
712 * Synchronously unregisters serio port. 704 * Synchronously unregisters serio port.
@@ -718,6 +710,7 @@ void serio_unregister_port(struct serio *serio)
718 serio_destroy_port(serio); 710 serio_destroy_port(serio);
719 mutex_unlock(&serio_mutex); 711 mutex_unlock(&serio_mutex);
720} 712}
713EXPORT_SYMBOL(serio_unregister_port);
721 714
722/* 715/*
723 * Safely unregisters child port if one is present. 716 * Safely unregisters child port if one is present.
@@ -731,6 +724,7 @@ void serio_unregister_child_port(struct serio *serio)
731 } 724 }
732 mutex_unlock(&serio_mutex); 725 mutex_unlock(&serio_mutex);
733} 726}
727EXPORT_SYMBOL(serio_unregister_child_port);
734 728
735 729
736/* 730/*
@@ -756,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char
756 750
757 retval = count; 751 retval = count;
758 if (!strncmp(buf, "manual", count)) { 752 if (!strncmp(buf, "manual", count)) {
759 serio_drv->manual_bind = 1; 753 serio_drv->manual_bind = true;
760 } else if (!strncmp(buf, "auto", count)) { 754 } else if (!strncmp(buf, "auto", count)) {
761 serio_drv->manual_bind = 0; 755 serio_drv->manual_bind = false;
762 } else { 756 } else {
763 retval = -EINVAL; 757 retval = -EINVAL;
764 } 758 }
@@ -818,7 +812,7 @@ static void serio_attach_driver(struct serio_driver *drv)
818 812
819int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) 813int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
820{ 814{
821 int manual_bind = drv->manual_bind; 815 bool manual_bind = drv->manual_bind;
822 int error; 816 int error;
823 817
824 drv->driver.bus = &serio_bus; 818 drv->driver.bus = &serio_bus;
@@ -829,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
829 * Temporarily disable automatic binding because probing 823 * Temporarily disable automatic binding because probing
830 * takes long time and we are better off doing it in kseriod 824 * takes long time and we are better off doing it in kseriod
831 */ 825 */
832 drv->manual_bind = 1; 826 drv->manual_bind = true;
833 827
834 error = driver_register(&drv->driver); 828 error = driver_register(&drv->driver);
835 if (error) { 829 if (error) {
@@ -844,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
844 * driver to free ports 838 * driver to free ports
845 */ 839 */
846 if (!manual_bind) { 840 if (!manual_bind) {
847 drv->manual_bind = 0; 841 drv->manual_bind = false;
848 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); 842 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
849 if (error) { 843 if (error) {
850 driver_unregister(&drv->driver); 844 driver_unregister(&drv->driver);
@@ -854,6 +848,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
854 848
855 return 0; 849 return 0;
856} 850}
851EXPORT_SYMBOL(__serio_register_driver);
857 852
858void serio_unregister_driver(struct serio_driver *drv) 853void serio_unregister_driver(struct serio_driver *drv)
859{ 854{
@@ -861,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv)
861 856
862 mutex_lock(&serio_mutex); 857 mutex_lock(&serio_mutex);
863 858
864 drv->manual_bind = 1; /* so serio_find_driver ignores it */ 859 drv->manual_bind = true; /* so serio_find_driver ignores it */
865 serio_remove_pending_events(drv); 860 serio_remove_pending_events(drv);
866 861
867start_over: 862start_over:
@@ -877,6 +872,7 @@ start_over:
877 driver_unregister(&drv->driver); 872 driver_unregister(&drv->driver);
878 mutex_unlock(&serio_mutex); 873 mutex_unlock(&serio_mutex);
879} 874}
875EXPORT_SYMBOL(serio_unregister_driver);
880 876
881static void serio_set_drv(struct serio *serio, struct serio_driver *drv) 877static void serio_set_drv(struct serio *serio, struct serio_driver *drv)
882{ 878{
@@ -937,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
937#ifdef CONFIG_PM 933#ifdef CONFIG_PM
938static int serio_suspend(struct device *dev, pm_message_t state) 934static int serio_suspend(struct device *dev, pm_message_t state)
939{ 935{
940 if (dev->power.power_state.event != state.event) { 936 struct serio *serio = to_serio_port(dev);
941 if (state.event == PM_EVENT_SUSPEND)
942 serio_cleanup(to_serio_port(dev));
943 937
944 dev->power.power_state = state; 938 if (!serio->suspended && state.event == PM_EVENT_SUSPEND) {
939 serio_cleanup(serio);
940 serio->suspended = true;
945 } 941 }
946 942
947 return 0; 943 return 0;
@@ -949,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state)
949 945
950static int serio_resume(struct device *dev) 946static int serio_resume(struct device *dev)
951{ 947{
948 struct serio *serio = to_serio_port(dev);
949
952 /* 950 /*
953 * Driver reconnect can take a while, so better let kseriod 951 * Driver reconnect can take a while, so better let kseriod
954 * deal with it. 952 * deal with it.
955 */ 953 */
956 if (dev->power.power_state.event != PM_EVENT_ON) { 954 if (serio->suspended) {
957 dev->power.power_state = PMSG_ON; 955 serio->suspended = false;
958 serio_queue_event(to_serio_port(dev), NULL, 956 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
959 SERIO_RECONNECT_PORT);
960 } 957 }
961 958
962 return 0; 959 return 0;
@@ -974,6 +971,7 @@ int serio_open(struct serio *serio, struct serio_driver *drv)
974 } 971 }
975 return 0; 972 return 0;
976} 973}
974EXPORT_SYMBOL(serio_open);
977 975
978/* called from serio_driver->connect/disconnect methods under serio_mutex */ 976/* called from serio_driver->connect/disconnect methods under serio_mutex */
979void serio_close(struct serio *serio) 977void serio_close(struct serio *serio)
@@ -983,6 +981,7 @@ void serio_close(struct serio *serio)
983 981
984 serio_set_drv(serio, NULL); 982 serio_set_drv(serio, NULL);
985} 983}
984EXPORT_SYMBOL(serio_close);
986 985
987irqreturn_t serio_interrupt(struct serio *serio, 986irqreturn_t serio_interrupt(struct serio *serio,
988 unsigned char data, unsigned int dfl) 987 unsigned char data, unsigned int dfl)
@@ -1003,6 +1002,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
1003 1002
1004 return ret; 1003 return ret;
1005} 1004}
1005EXPORT_SYMBOL(serio_interrupt);
1006 1006
1007static struct bus_type serio_bus = { 1007static struct bus_type serio_bus = {
1008 .name = "serio", 1008 .name = "serio",