diff options
-rw-r--r-- | drivers/input/keyboard/maple_keyb.c | 15 | ||||
-rw-r--r-- | drivers/sh/maple/maple.c | 1 | ||||
-rw-r--r-- | include/linux/maple.h | 4 |
3 files changed, 12 insertions, 8 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 | } |
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c index a6b4dc3cfcba..be77a39f224c 100644 --- a/drivers/sh/maple/maple.c +++ b/drivers/sh/maple/maple.c | |||
@@ -94,6 +94,7 @@ void maple_driver_unregister(struct maple_driver *drv) | |||
94 | { | 94 | { |
95 | driver_unregister(&drv->drv); | 95 | driver_unregister(&drv->drv); |
96 | } | 96 | } |
97 | EXPORT_SYMBOL_GPL(maple_driver_unregister); | ||
97 | 98 | ||
98 | /* set hardware registers to enable next round of dma */ | 99 | /* set hardware registers to enable next round of dma */ |
99 | static void maplebus_dma_reset(void) | 100 | static void maplebus_dma_reset(void) |
diff --git a/include/linux/maple.h b/include/linux/maple.h index b2b7ce0fb1f7..c23d3f51ba40 100644 --- a/include/linux/maple.h +++ b/include/linux/maple.h | |||
@@ -51,7 +51,6 @@ struct maple_devinfo { | |||
51 | struct maple_device { | 51 | struct maple_device { |
52 | struct maple_driver *driver; | 52 | struct maple_driver *driver; |
53 | struct mapleq *mq; | 53 | struct mapleq *mq; |
54 | void *private_data; | ||
55 | void (*callback) (struct mapleq * mq); | 54 | void (*callback) (struct mapleq * mq); |
56 | unsigned long when, interval, function; | 55 | unsigned long when, interval, function; |
57 | struct maple_devinfo devinfo; | 56 | struct maple_devinfo devinfo; |
@@ -80,4 +79,7 @@ void maple_clear_dev(struct maple_device *mdev); | |||
80 | #define to_maple_dev(n) container_of(n, struct maple_device, dev) | 79 | #define to_maple_dev(n) container_of(n, struct maple_device, dev) |
81 | #define to_maple_driver(n) container_of(n, struct maple_driver, drv) | 80 | #define to_maple_driver(n) container_of(n, struct maple_driver, drv) |
82 | 81 | ||
82 | #define maple_get_drvdata(d) dev_get_drvdata(&(d)->dev) | ||
83 | #define maple_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) | ||
84 | |||
83 | #endif /* __LINUX_MAPLE_H */ | 85 | #endif /* __LINUX_MAPLE_H */ |