diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-08-07 04:55:03 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-08-07 04:55:03 -0400 |
commit | 4fb8af10d0fd09372d52966b76922b9e82bbc950 (patch) | |
tree | d240e4d40357583e3f3eb228dccf20122a5b31ed /drivers/input/keyboard | |
parent | f44f82e8a20b98558486eb14497b2f71c78fa325 (diff) | |
parent | 64a99d2a8c3ed5c4e39f3ae1cc682aa8fd3977fc (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/maple_keyb.c | 173 | ||||
-rw-r--r-- | drivers/input/keyboard/sh_keysc.c | 27 |
2 files changed, 94 insertions, 106 deletions
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index 2b404284c28a..22f17a593be7 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SEGA Dreamcast keyboard driver | 2 | * SEGA Dreamcast keyboard driver |
3 | * Based on drivers/usb/usbkbd.c | 3 | * Based on drivers/usb/usbkbd.c |
4 | * Copyright YAEGASHI Takeshi, 2001 | 4 | * Copyright YAEGASHI Takeshi, 2001 |
5 | * Porting to 2.6 Copyright Adrian McMenamin, 2007 | 5 | * Porting to 2.6 Copyright Adrian McMenamin, 2007, 2008 |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/timer.h> | 28 | #include <linux/timer.h> |
29 | #include <linux/maple.h> | 29 | #include <linux/maple.h> |
30 | #include <asm/mach/maple.h> | ||
31 | 30 | ||
32 | /* Very simple mutex to ensure proper cleanup */ | 31 | /* Very simple mutex to ensure proper cleanup */ |
33 | static DEFINE_MUTEX(maple_keyb_mutex); | 32 | static DEFINE_MUTEX(maple_keyb_mutex); |
@@ -46,39 +45,51 @@ struct dc_kbd { | |||
46 | }; | 45 | }; |
47 | 46 | ||
48 | static const unsigned short dc_kbd_keycode[NR_SCANCODES] = { | 47 | static const unsigned short dc_kbd_keycode[NR_SCANCODES] = { |
49 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B, KEY_C, KEY_D, | 48 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_A, KEY_B, |
50 | KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, | 49 | KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, |
51 | KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, | 50 | KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, |
52 | KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, | 51 | KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, |
53 | KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, | 52 | KEY_7, KEY_8, KEY_9, KEY_0, KEY_ENTER, KEY_ESC, KEY_BACKSPACE, |
54 | KEY_ENTER, KEY_ESC, KEY_BACKSPACE, KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE, | 53 | KEY_TAB, KEY_SPACE, KEY_MINUS, KEY_EQUAL, KEY_LEFTBRACE, |
55 | KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, | 54 | KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, |
56 | KEY_DOT, KEY_SLASH, KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, | 55 | KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, KEY_SLASH, |
56 | KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, | ||
57 | KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SYSRQ, | 57 | KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_SYSRQ, |
58 | KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP, KEY_DELETE, | 58 | KEY_SCROLLLOCK, KEY_PAUSE, KEY_INSERT, KEY_HOME, KEY_PAGEUP, |
59 | KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP, | 59 | KEY_DELETE, KEY_END, KEY_PAGEDOWN, KEY_RIGHT, KEY_LEFT, KEY_DOWN, |
60 | KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, | 60 | KEY_UP, KEY_NUMLOCK, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, |
61 | KEY_KP3, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, | 61 | KEY_KPPLUS, KEY_KPENTER, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP4, KEY_KP5, |
62 | KEY_102ND, KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15, | 62 | KEY_KP6, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KP0, KEY_KPDOT, KEY_102ND, |
63 | KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, | 63 | KEY_COMPOSE, KEY_POWER, KEY_KPEQUAL, KEY_F13, KEY_F14, KEY_F15, |
64 | KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT, | 64 | KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22, |
65 | KEY_STOP, KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE, | 65 | KEY_F23, KEY_F24, KEY_OPEN, KEY_HELP, KEY_PROPS, KEY_FRONT, KEY_STOP, |
66 | KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN, | 66 | KEY_AGAIN, KEY_UNDO, KEY_CUT, KEY_COPY, KEY_PASTE, KEY_FIND, KEY_MUTE, |
67 | KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 67 | KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
68 | KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA, KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 68 | KEY_KPCOMMA, KEY_RESERVED, KEY_RO, KEY_KATAKANAHIRAGANA , KEY_YEN, |
69 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 69 | KEY_HENKAN, KEY_MUHENKAN, KEY_KPJPCOMMA, KEY_RESERVED, KEY_RESERVED, |
70 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 70 | KEY_RESERVED, KEY_HANGEUL, KEY_HANJA, KEY_KATAKANA, KEY_HIRAGANA, |
71 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 71 | KEY_ZENKAKUHANKAKU, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
72 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 72 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
73 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 73 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
74 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 74 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
75 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 75 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
76 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 76 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
77 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | 77 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
78 | KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT, KEY_RIGHTMETA, | 78 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
79 | KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG, KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE, | 79 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
80 | KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP, KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP, | 80 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
81 | KEY_SCREENLOCK, KEY_REFRESH, KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED | 81 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, |
82 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | ||
83 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | ||
84 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | ||
85 | KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, | ||
86 | KEY_RESERVED, KEY_RESERVED, KEY_LEFTCTRL, KEY_LEFTSHIFT, KEY_LEFTALT, | ||
87 | KEY_LEFTMETA, KEY_RIGHTCTRL, KEY_RIGHTSHIFT, KEY_RIGHTALT, | ||
88 | KEY_RIGHTMETA, KEY_PLAYPAUSE, KEY_STOPCD, KEY_PREVIOUSSONG, | ||
89 | KEY_NEXTSONG, KEY_EJECTCD, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE, | ||
90 | KEY_WWW, KEY_BACK, KEY_FORWARD, KEY_STOP, KEY_FIND, KEY_SCROLLUP, | ||
91 | KEY_SCROLLDOWN, KEY_EDIT, KEY_SLEEP, KEY_SCREENLOCK, KEY_REFRESH, | ||
92 | KEY_CALC, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED | ||
82 | }; | 93 | }; |
83 | 94 | ||
84 | static void dc_scan_kbd(struct dc_kbd *kbd) | 95 | static void dc_scan_kbd(struct dc_kbd *kbd) |
@@ -128,12 +139,12 @@ static void dc_scan_kbd(struct dc_kbd *kbd) | |||
128 | static void dc_kbd_callback(struct mapleq *mq) | 139 | static void dc_kbd_callback(struct mapleq *mq) |
129 | { | 140 | { |
130 | struct maple_device *mapledev = mq->dev; | 141 | struct maple_device *mapledev = mq->dev; |
131 | struct dc_kbd *kbd = mapledev->private_data; | 142 | struct dc_kbd *kbd = maple_get_drvdata(mapledev); |
132 | unsigned long *buf = mq->recvbuf; | 143 | unsigned long *buf = mq->recvbuf; |
133 | 144 | ||
134 | /* | 145 | /* |
135 | * We should always be getting the lock because the only | 146 | * We should always get the lock because the only |
136 | * time it may be locked if driver is in cleanup phase. | 147 | * time it may be locked is if the driver is in the cleanup phase. |
137 | */ | 148 | */ |
138 | if (likely(mutex_trylock(&maple_keyb_mutex))) { | 149 | if (likely(mutex_trylock(&maple_keyb_mutex))) { |
139 | 150 | ||
@@ -146,106 +157,96 @@ static void dc_kbd_callback(struct mapleq *mq) | |||
146 | } | 157 | } |
147 | } | 158 | } |
148 | 159 | ||
149 | static int dc_kbd_connect(struct maple_device *mdev) | 160 | static int probe_maple_kbd(struct device *dev) |
150 | { | 161 | { |
162 | struct maple_device *mdev = to_maple_dev(dev); | ||
163 | struct maple_driver *mdrv = to_maple_driver(dev->driver); | ||
151 | int i, error; | 164 | int i, error; |
152 | struct dc_kbd *kbd; | 165 | struct dc_kbd *kbd; |
153 | struct input_dev *dev; | 166 | struct input_dev *idev; |
154 | 167 | ||
155 | if (!(mdev->function & MAPLE_FUNC_KEYBOARD)) | 168 | if (!(mdev->function & MAPLE_FUNC_KEYBOARD)) |
156 | return -EINVAL; | 169 | return -EINVAL; |
157 | 170 | ||
158 | kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL); | 171 | kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL); |
159 | dev = input_allocate_device(); | 172 | idev = input_allocate_device(); |
160 | if (!kbd || !dev) { | 173 | if (!kbd || !idev) { |
161 | error = -ENOMEM; | 174 | error = -ENOMEM; |
162 | goto fail; | 175 | goto fail; |
163 | } | 176 | } |
164 | 177 | ||
165 | mdev->private_data = kbd; | 178 | kbd->dev = idev; |
166 | |||
167 | kbd->dev = dev; | ||
168 | memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); | 179 | memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); |
169 | 180 | ||
170 | dev->name = mdev->product_name; | 181 | idev->name = mdev->product_name; |
171 | dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 182 | idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
172 | dev->keycode = kbd->keycode; | 183 | idev->keycode = kbd->keycode; |
173 | dev->keycodesize = sizeof (unsigned short); | 184 | idev->keycodesize = sizeof(unsigned short); |
174 | dev->keycodemax = ARRAY_SIZE(kbd->keycode); | 185 | idev->keycodemax = ARRAY_SIZE(kbd->keycode); |
175 | dev->id.bustype = BUS_HOST; | 186 | idev->id.bustype = BUS_HOST; |
176 | dev->dev.parent = &mdev->dev; | 187 | idev->dev.parent = &mdev->dev; |
177 | 188 | ||
178 | for (i = 0; i < NR_SCANCODES; i++) | 189 | for (i = 0; i < NR_SCANCODES; i++) |
179 | __set_bit(dc_kbd_keycode[i], dev->keybit); | 190 | __set_bit(dc_kbd_keycode[i], idev->keybit); |
180 | __clear_bit(KEY_RESERVED, dev->keybit); | 191 | __clear_bit(KEY_RESERVED, idev->keybit); |
181 | 192 | ||
182 | input_set_capability(dev, EV_MSC, MSC_SCAN); | 193 | input_set_capability(idev, EV_MSC, MSC_SCAN); |
183 | input_set_drvdata(dev, kbd); | 194 | input_set_drvdata(idev, kbd); |
184 | 195 | ||
185 | error = input_register_device(dev); | 196 | error = input_register_device(idev); |
186 | if (error) | 197 | if (error) |
187 | goto fail; | 198 | goto fail; |
188 | 199 | ||
189 | /* Maple polling is locked to VBLANK - which may be just 50/s */ | 200 | /* Maple polling is locked to VBLANK - which may be just 50/s */ |
190 | maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, MAPLE_FUNC_KEYBOARD); | 201 | maple_getcond_callback(mdev, dc_kbd_callback, HZ/50, |
191 | return 0; | 202 | MAPLE_FUNC_KEYBOARD); |
192 | 203 | ||
193 | fail: | 204 | mdev->driver = mdrv; |
194 | input_free_device(dev); | 205 | |
206 | maple_set_drvdata(mdev, kbd); | ||
207 | |||
208 | return error; | ||
209 | |||
210 | fail: | ||
211 | input_free_device(idev); | ||
195 | kfree(kbd); | 212 | kfree(kbd); |
196 | mdev->private_data = NULL; | 213 | maple_set_drvdata(mdev, NULL); |
197 | return error; | 214 | return error; |
198 | } | 215 | } |
199 | 216 | ||
200 | static void dc_kbd_disconnect(struct maple_device *mdev) | 217 | static int remove_maple_kbd(struct device *dev) |
201 | { | 218 | { |
202 | struct dc_kbd *kbd; | 219 | struct maple_device *mdev = to_maple_dev(dev); |
220 | struct dc_kbd *kbd = maple_get_drvdata(mdev); | ||
203 | 221 | ||
204 | mutex_lock(&maple_keyb_mutex); | 222 | mutex_lock(&maple_keyb_mutex); |
205 | 223 | ||
206 | kbd = mdev->private_data; | ||
207 | mdev->private_data = NULL; | ||
208 | input_unregister_device(kbd->dev); | 224 | input_unregister_device(kbd->dev); |
209 | kfree(kbd); | 225 | kfree(kbd); |
210 | 226 | ||
211 | mutex_unlock(&maple_keyb_mutex); | 227 | maple_set_drvdata(mdev, NULL); |
212 | } | ||
213 | |||
214 | /* allow the keyboard to be used */ | ||
215 | static int probe_maple_kbd(struct device *dev) | ||
216 | { | ||
217 | struct maple_device *mdev = to_maple_dev(dev); | ||
218 | struct maple_driver *mdrv = to_maple_driver(dev->driver); | ||
219 | int error; | ||
220 | |||
221 | error = dc_kbd_connect(mdev); | ||
222 | if (error) | ||
223 | return error; | ||
224 | |||
225 | mdev->driver = mdrv; | ||
226 | mdev->registered = 1; | ||
227 | 228 | ||
229 | mutex_unlock(&maple_keyb_mutex); | ||
228 | return 0; | 230 | return 0; |
229 | } | 231 | } |
230 | 232 | ||
231 | static struct maple_driver dc_kbd_driver = { | 233 | static struct maple_driver dc_kbd_driver = { |
232 | .function = MAPLE_FUNC_KEYBOARD, | 234 | .function = MAPLE_FUNC_KEYBOARD, |
233 | .connect = dc_kbd_connect, | ||
234 | .disconnect = dc_kbd_disconnect, | ||
235 | .drv = { | 235 | .drv = { |
236 | .name = "Dreamcast_keyboard", | 236 | .name = "Dreamcast_keyboard", |
237 | .probe = probe_maple_kbd, | 237 | .probe = probe_maple_kbd, |
238 | }, | 238 | .remove = remove_maple_kbd, |
239 | }, | ||
239 | }; | 240 | }; |
240 | 241 | ||
241 | static int __init dc_kbd_init(void) | 242 | static int __init dc_kbd_init(void) |
242 | { | 243 | { |
243 | return maple_driver_register(&dc_kbd_driver.drv); | 244 | return maple_driver_register(&dc_kbd_driver); |
244 | } | 245 | } |
245 | 246 | ||
246 | static void __exit dc_kbd_exit(void) | 247 | static void __exit dc_kbd_exit(void) |
247 | { | 248 | { |
248 | driver_unregister(&dc_kbd_driver.drv); | 249 | maple_driver_unregister(&dc_kbd_driver); |
249 | } | 250 | } |
250 | 251 | ||
251 | module_init(dc_kbd_init); | 252 | module_init(dc_kbd_init); |
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 8486abc457ed..c600ab7f93e8 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -158,25 +158,18 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
158 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); | 158 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); |
159 | pdata = &priv->pdata; | 159 | pdata = &priv->pdata; |
160 | 160 | ||
161 | res = request_mem_region(res->start, res_size(res), pdev->name); | ||
162 | if (res == NULL) { | ||
163 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
164 | error = -EBUSY; | ||
165 | goto err1; | ||
166 | } | ||
167 | |||
168 | priv->iomem_base = ioremap_nocache(res->start, res_size(res)); | 161 | priv->iomem_base = ioremap_nocache(res->start, res_size(res)); |
169 | if (priv->iomem_base == NULL) { | 162 | if (priv->iomem_base == NULL) { |
170 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | 163 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); |
171 | error = -ENXIO; | 164 | error = -ENXIO; |
172 | goto err2; | 165 | goto err1; |
173 | } | 166 | } |
174 | 167 | ||
175 | priv->input = input_allocate_device(); | 168 | priv->input = input_allocate_device(); |
176 | if (!priv->input) { | 169 | if (!priv->input) { |
177 | dev_err(&pdev->dev, "failed to allocate input device\n"); | 170 | dev_err(&pdev->dev, "failed to allocate input device\n"); |
178 | error = -ENOMEM; | 171 | error = -ENOMEM; |
179 | goto err3; | 172 | goto err2; |
180 | } | 173 | } |
181 | 174 | ||
182 | input = priv->input; | 175 | input = priv->input; |
@@ -194,7 +187,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
194 | error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); | 187 | error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); |
195 | if (error) { | 188 | if (error) { |
196 | dev_err(&pdev->dev, "failed to request IRQ\n"); | 189 | dev_err(&pdev->dev, "failed to request IRQ\n"); |
197 | goto err4; | 190 | goto err3; |
198 | } | 191 | } |
199 | 192 | ||
200 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { | 193 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { |
@@ -206,7 +199,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
206 | error = input_register_device(input); | 199 | error = input_register_device(input); |
207 | if (error) { | 200 | if (error) { |
208 | dev_err(&pdev->dev, "failed to register input device\n"); | 201 | dev_err(&pdev->dev, "failed to register input device\n"); |
209 | goto err5; | 202 | goto err4; |
210 | } | 203 | } |
211 | 204 | ||
212 | iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) | | 205 | iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) | |
@@ -214,14 +207,12 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
214 | iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); | 207 | iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); |
215 | iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); | 208 | iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); |
216 | return 0; | 209 | return 0; |
217 | err5: | ||
218 | free_irq(irq, pdev); | ||
219 | err4: | 210 | err4: |
220 | input_free_device(input); | 211 | free_irq(irq, pdev); |
221 | err3: | 212 | err3: |
222 | iounmap(priv->iomem_base); | 213 | input_free_device(input); |
223 | err2: | 214 | err2: |
224 | release_mem_region(res->start, res_size(res)); | 215 | iounmap(priv->iomem_base); |
225 | err1: | 216 | err1: |
226 | platform_set_drvdata(pdev, NULL); | 217 | platform_set_drvdata(pdev, NULL); |
227 | kfree(priv); | 218 | kfree(priv); |
@@ -232,7 +223,6 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
232 | static int __devexit sh_keysc_remove(struct platform_device *pdev) | 223 | static int __devexit sh_keysc_remove(struct platform_device *pdev) |
233 | { | 224 | { |
234 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); | 225 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); |
235 | struct resource *res; | ||
236 | 226 | ||
237 | iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS); | 227 | iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS); |
238 | 228 | ||
@@ -240,9 +230,6 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev) | |||
240 | free_irq(platform_get_irq(pdev, 0), pdev); | 230 | free_irq(platform_get_irq(pdev, 0), pdev); |
241 | iounmap(priv->iomem_base); | 231 | iounmap(priv->iomem_base); |
242 | 232 | ||
243 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
244 | release_mem_region(res->start, res_size(res)); | ||
245 | |||
246 | platform_set_drvdata(pdev, NULL); | 233 | platform_set_drvdata(pdev, NULL); |
247 | kfree(priv); | 234 | kfree(priv); |
248 | return 0; | 235 | return 0; |