aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2009-04-21 15:24:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-21 16:41:49 -0400
commitaa0b8f3687f06ac0e5a2b24547fdf431e923c475 (patch)
tree94150412078aeb2e32c9927b13e0cd0a60a1aac0 /drivers/input/serio
parente638c1394010859a015a3b533ee452d768e62cea (diff)
drivers/input/serio/hp_sdc.c: fix crash when removing hp_sdc module
On parisc machines, which don't have HIL, removing the hp_sdc module panics the kernel. Fix this by returning early in hp_sdc_exit() if no HP SDC controller was found. Add functionality to probe for the hp_sdc_mlc kernel module (which takes care of the upper layer HIL functionality on parisc) after two seconds. This is needed to get all the other HIL drivers (keyboard / mouse/ ..) drivers automatically loaded by udev later as well. Signed-off-by: Helge Deller <deller@gmx.de> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Frans Pop <elendil@planet.nl> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Grant Grundler <grundler@parisc-linux.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/hp_sdc.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index bfe49243f38b..1c9410d1822c 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -819,6 +819,7 @@ static const struct parisc_device_id hp_sdc_tbl[] = {
819MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); 819MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl);
820 820
821static int __init hp_sdc_init_hppa(struct parisc_device *d); 821static int __init hp_sdc_init_hppa(struct parisc_device *d);
822static struct delayed_work moduleloader_work;
822 823
823static struct parisc_driver hp_sdc_driver = { 824static struct parisc_driver hp_sdc_driver = {
824 .name = "hp_sdc", 825 .name = "hp_sdc",
@@ -930,8 +931,15 @@ static int __init hp_sdc_init(void)
930 931
931#if defined(__hppa__) 932#if defined(__hppa__)
932 933
934static void request_module_delayed(struct work_struct *work)
935{
936 request_module("hp_sdc_mlc");
937}
938
933static int __init hp_sdc_init_hppa(struct parisc_device *d) 939static int __init hp_sdc_init_hppa(struct parisc_device *d)
934{ 940{
941 int ret;
942
935 if (!d) 943 if (!d)
936 return 1; 944 return 1;
937 if (hp_sdc.dev != NULL) 945 if (hp_sdc.dev != NULL)
@@ -944,13 +952,26 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
944 hp_sdc.data_io = d->hpa.start + 0x800; 952 hp_sdc.data_io = d->hpa.start + 0x800;
945 hp_sdc.status_io = d->hpa.start + 0x801; 953 hp_sdc.status_io = d->hpa.start + 0x801;
946 954
947 return hp_sdc_init(); 955 INIT_DELAYED_WORK(&moduleloader_work, request_module_delayed);
956
957 ret = hp_sdc_init();
958 /* after sucessfull initialization give SDC some time to settle
959 * and then load the hp_sdc_mlc upper layer driver */
960 if (!ret)
961 schedule_delayed_work(&moduleloader_work,
962 msecs_to_jiffies(2000));
963
964 return ret;
948} 965}
949 966
950#endif /* __hppa__ */ 967#endif /* __hppa__ */
951 968
952static void hp_sdc_exit(void) 969static void hp_sdc_exit(void)
953{ 970{
971 /* do nothing if we don't have a SDC */
972 if (!hp_sdc.dev)
973 return;
974
954 write_lock_irq(&hp_sdc.lock); 975 write_lock_irq(&hp_sdc.lock);
955 976
956 /* Turn off all maskable "sub-function" irq's. */ 977 /* Turn off all maskable "sub-function" irq's. */
@@ -969,6 +990,7 @@ static void hp_sdc_exit(void)
969 tasklet_kill(&hp_sdc.task); 990 tasklet_kill(&hp_sdc.task);
970 991
971#if defined(__hppa__) 992#if defined(__hppa__)
993 cancel_delayed_work_sync(&moduleloader_work);
972 if (unregister_parisc_driver(&hp_sdc_driver)) 994 if (unregister_parisc_driver(&hp_sdc_driver))
973 printk(KERN_WARNING PREFIX "Error unregistering HP SDC"); 995 printk(KERN_WARNING PREFIX "Error unregistering HP SDC");
974#endif 996#endif