diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/maplemouse.c | 43 | ||||
-rw-r--r-- | drivers/input/serio/ambakmi.c | 2 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc.c | 24 |
3 files changed, 47 insertions, 22 deletions
diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c index d196abfb68bc..5f278176eb9b 100644 --- a/drivers/input/mouse/maplemouse.c +++ b/drivers/input/mouse/maplemouse.c | |||
@@ -2,8 +2,8 @@ | |||
2 | * SEGA Dreamcast mouse driver | 2 | * SEGA Dreamcast mouse driver |
3 | * Based on drivers/usb/usbmouse.c | 3 | * Based on drivers/usb/usbmouse.c |
4 | * | 4 | * |
5 | * Copyright Yaegashi Takeshi, 2001 | 5 | * Copyright (c) Yaegashi Takeshi, 2001 |
6 | * Adrian McMenamin, 2008 | 6 | * Copyright (c) Adrian McMenamin, 2008 - 2009 |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
@@ -29,7 +29,7 @@ static void dc_mouse_callback(struct mapleq *mq) | |||
29 | struct maple_device *mapledev = mq->dev; | 29 | struct maple_device *mapledev = mq->dev; |
30 | struct dc_mouse *mse = maple_get_drvdata(mapledev); | 30 | struct dc_mouse *mse = maple_get_drvdata(mapledev); |
31 | struct input_dev *dev = mse->dev; | 31 | struct input_dev *dev = mse->dev; |
32 | unsigned char *res = mq->recvbuf; | 32 | unsigned char *res = mq->recvbuf->buf; |
33 | 33 | ||
34 | buttons = ~res[8]; | 34 | buttons = ~res[8]; |
35 | relx = *(unsigned short *)(res + 12) - 512; | 35 | relx = *(unsigned short *)(res + 12) - 512; |
@@ -47,7 +47,7 @@ static void dc_mouse_callback(struct mapleq *mq) | |||
47 | 47 | ||
48 | static int dc_mouse_open(struct input_dev *dev) | 48 | static int dc_mouse_open(struct input_dev *dev) |
49 | { | 49 | { |
50 | struct dc_mouse *mse = dev->dev.platform_data; | 50 | struct dc_mouse *mse = maple_get_drvdata(to_maple_dev(&dev->dev)); |
51 | 51 | ||
52 | maple_getcond_callback(mse->mdev, dc_mouse_callback, HZ/50, | 52 | maple_getcond_callback(mse->mdev, dc_mouse_callback, HZ/50, |
53 | MAPLE_FUNC_MOUSE); | 53 | MAPLE_FUNC_MOUSE); |
@@ -57,29 +57,33 @@ static int dc_mouse_open(struct input_dev *dev) | |||
57 | 57 | ||
58 | static void dc_mouse_close(struct input_dev *dev) | 58 | static void dc_mouse_close(struct input_dev *dev) |
59 | { | 59 | { |
60 | struct dc_mouse *mse = dev->dev.platform_data; | 60 | struct dc_mouse *mse = maple_get_drvdata(to_maple_dev(&dev->dev)); |
61 | 61 | ||
62 | maple_getcond_callback(mse->mdev, dc_mouse_callback, 0, | 62 | maple_getcond_callback(mse->mdev, dc_mouse_callback, 0, |
63 | MAPLE_FUNC_MOUSE); | 63 | MAPLE_FUNC_MOUSE); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | /* allow the mouse to be used */ | |
67 | static int __devinit probe_maple_mouse(struct device *dev) | 67 | static int __devinit probe_maple_mouse(struct device *dev) |
68 | { | 68 | { |
69 | struct maple_device *mdev = to_maple_dev(dev); | 69 | struct maple_device *mdev = to_maple_dev(dev); |
70 | struct maple_driver *mdrv = to_maple_driver(dev->driver); | 70 | struct maple_driver *mdrv = to_maple_driver(dev->driver); |
71 | int error; | ||
71 | struct input_dev *input_dev; | 72 | struct input_dev *input_dev; |
72 | struct dc_mouse *mse; | 73 | struct dc_mouse *mse; |
73 | int error; | ||
74 | 74 | ||
75 | mse = kzalloc(sizeof(struct dc_mouse), GFP_KERNEL); | 75 | mse = kzalloc(sizeof(struct dc_mouse), GFP_KERNEL); |
76 | input_dev = input_allocate_device(); | 76 | if (!mse) { |
77 | |||
78 | if (!mse || !input_dev) { | ||
79 | error = -ENOMEM; | 77 | error = -ENOMEM; |
80 | goto fail; | 78 | goto fail; |
81 | } | 79 | } |
82 | 80 | ||
81 | input_dev = input_allocate_device(); | ||
82 | if (!input_dev) { | ||
83 | error = -ENOMEM; | ||
84 | goto fail_nomem; | ||
85 | } | ||
86 | |||
83 | mse->dev = input_dev; | 87 | mse->dev = input_dev; |
84 | mse->mdev = mdev; | 88 | mse->mdev = mdev; |
85 | 89 | ||
@@ -89,25 +93,24 @@ static int __devinit probe_maple_mouse(struct device *dev) | |||
89 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); | 93 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); |
90 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y) | | 94 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y) | |
91 | BIT_MASK(REL_WHEEL); | 95 | BIT_MASK(REL_WHEEL); |
92 | input_dev->name = mdev->product_name; | ||
93 | input_dev->id.bustype = BUS_HOST; | ||
94 | input_dev->open = dc_mouse_open; | 96 | input_dev->open = dc_mouse_open; |
95 | input_dev->close = dc_mouse_close; | 97 | input_dev->close = dc_mouse_close; |
98 | input_dev->name = mdev->product_name; | ||
99 | input_dev->id.bustype = BUS_HOST; | ||
100 | error = input_register_device(input_dev); | ||
101 | if (error) | ||
102 | goto fail_register; | ||
96 | 103 | ||
97 | mdev->driver = mdrv; | 104 | mdev->driver = mdrv; |
98 | maple_set_drvdata(mdev, mse); | 105 | maple_set_drvdata(mdev, mse); |
99 | 106 | ||
100 | error = input_register_device(input_dev); | 107 | return error; |
101 | if (error) | ||
102 | goto fail; | ||
103 | |||
104 | return 0; | ||
105 | 108 | ||
106 | fail: | 109 | fail_register: |
107 | input_free_device(input_dev); | 110 | input_free_device(input_dev); |
108 | maple_set_drvdata(mdev, NULL); | 111 | fail_nomem: |
109 | kfree(mse); | 112 | kfree(mse); |
110 | mdev->driver = NULL; | 113 | fail: |
111 | return error; | 114 | return error; |
112 | } | 115 | } |
113 | 116 | ||
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index e29cdc13a199..a28c06d686e1 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -107,7 +107,7 @@ static void amba_kmi_close(struct serio *io) | |||
107 | clk_disable(kmi->clk); | 107 | clk_disable(kmi->clk); |
108 | } | 108 | } |
109 | 109 | ||
110 | static int amba_kmi_probe(struct amba_device *dev, void *id) | 110 | static int amba_kmi_probe(struct amba_device *dev, struct amba_id *id) |
111 | { | 111 | { |
112 | struct amba_kmi_port *kmi; | 112 | struct amba_kmi_port *kmi; |
113 | struct serio *io; | 113 | struct serio *io; |
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[] = { | |||
819 | MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); | 819 | MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); |
820 | 820 | ||
821 | static int __init hp_sdc_init_hppa(struct parisc_device *d); | 821 | static int __init hp_sdc_init_hppa(struct parisc_device *d); |
822 | static struct delayed_work moduleloader_work; | ||
822 | 823 | ||
823 | static struct parisc_driver hp_sdc_driver = { | 824 | static 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 | ||
934 | static void request_module_delayed(struct work_struct *work) | ||
935 | { | ||
936 | request_module("hp_sdc_mlc"); | ||
937 | } | ||
938 | |||
933 | static int __init hp_sdc_init_hppa(struct parisc_device *d) | 939 | static 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 | ||
952 | static void hp_sdc_exit(void) | 969 | static 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 |