diff options
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/maple_keyb.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index 3f5151a0fd15..22f17a593be7 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c | |||
@@ -139,7 +139,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd) | |||
139 | static void dc_kbd_callback(struct mapleq *mq) | 139 | static void dc_kbd_callback(struct mapleq *mq) |
140 | { | 140 | { |
141 | struct maple_device *mapledev = mq->dev; | 141 | struct maple_device *mapledev = mq->dev; |
142 | struct dc_kbd *kbd = mapledev->private_data; | 142 | struct dc_kbd *kbd = maple_get_drvdata(mapledev); |
143 | unsigned long *buf = mq->recvbuf; | 143 | unsigned long *buf = mq->recvbuf; |
144 | 144 | ||
145 | /* | 145 | /* |
@@ -175,8 +175,6 @@ static int probe_maple_kbd(struct device *dev) | |||
175 | goto fail; | 175 | goto fail; |
176 | } | 176 | } |
177 | 177 | ||
178 | mdev->private_data = kbd; | ||
179 | |||
180 | kbd->dev = idev; | 178 | kbd->dev = idev; |
181 | memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); | 179 | memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); |
182 | 180 | ||
@@ -204,27 +202,30 @@ static int probe_maple_kbd(struct device *dev) | |||
204 | MAPLE_FUNC_KEYBOARD); | 202 | MAPLE_FUNC_KEYBOARD); |
205 | 203 | ||
206 | mdev->driver = mdrv; | 204 | mdev->driver = mdrv; |
205 | |||
206 | maple_set_drvdata(mdev, kbd); | ||
207 | |||
207 | return error; | 208 | return error; |
208 | 209 | ||
209 | fail: | 210 | fail: |
210 | input_free_device(idev); | 211 | input_free_device(idev); |
211 | kfree(kbd); | 212 | kfree(kbd); |
212 | mdev->private_data = NULL; | 213 | maple_set_drvdata(mdev, NULL); |
213 | return error; | 214 | return error; |
214 | } | 215 | } |
215 | 216 | ||
216 | static int remove_maple_kbd(struct device *dev) | 217 | static int remove_maple_kbd(struct device *dev) |
217 | { | 218 | { |
218 | struct maple_device *mdev = to_maple_dev(dev); | 219 | struct maple_device *mdev = to_maple_dev(dev); |
219 | struct dc_kbd *kbd; | 220 | struct dc_kbd *kbd = maple_get_drvdata(mdev); |
220 | 221 | ||
221 | mutex_lock(&maple_keyb_mutex); | 222 | mutex_lock(&maple_keyb_mutex); |
222 | 223 | ||
223 | kbd = mdev->private_data; | ||
224 | mdev->private_data = NULL; | ||
225 | input_unregister_device(kbd->dev); | 224 | input_unregister_device(kbd->dev); |
226 | kfree(kbd); | 225 | kfree(kbd); |
227 | 226 | ||
227 | maple_set_drvdata(mdev, NULL); | ||
228 | |||
228 | mutex_unlock(&maple_keyb_mutex); | 229 | mutex_unlock(&maple_keyb_mutex); |
229 | return 0; | 230 | return 0; |
230 | } | 231 | } |