Commit 61787063 authored by Paul Mundt's avatar Paul Mundt

maple: Kill useless private_data pointer.

We can simply wrap in to the dev_set/get_drvdata(), there's no reason
to track an extra level of private data on top of the struct device.
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 63870295
...@@ -139,7 +139,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd) ...@@ -139,7 +139,7 @@ static void dc_scan_kbd(struct dc_kbd *kbd)
static void dc_kbd_callback(struct mapleq *mq) static void dc_kbd_callback(struct mapleq *mq)
{ {
struct maple_device *mapledev = mq->dev; struct maple_device *mapledev = mq->dev;
struct dc_kbd *kbd = mapledev->private_data; struct dc_kbd *kbd = maple_get_drvdata(mapledev);
unsigned long *buf = mq->recvbuf; unsigned long *buf = mq->recvbuf;
/* /*
...@@ -175,8 +175,6 @@ static int probe_maple_kbd(struct device *dev) ...@@ -175,8 +175,6 @@ static int probe_maple_kbd(struct device *dev)
goto fail; goto fail;
} }
mdev->private_data = kbd;
kbd->dev = idev; kbd->dev = idev;
memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode)); memcpy(kbd->keycode, dc_kbd_keycode, sizeof(kbd->keycode));
...@@ -204,27 +202,30 @@ static int probe_maple_kbd(struct device *dev) ...@@ -204,27 +202,30 @@ static int probe_maple_kbd(struct device *dev)
MAPLE_FUNC_KEYBOARD); MAPLE_FUNC_KEYBOARD);
mdev->driver = mdrv; mdev->driver = mdrv;
maple_set_drvdata(mdev, kbd);
return error; return error;
fail: fail:
input_free_device(idev); input_free_device(idev);
kfree(kbd); kfree(kbd);
mdev->private_data = NULL; maple_set_drvdata(mdev, NULL);
return error; return error;
} }
static int remove_maple_kbd(struct device *dev) static int remove_maple_kbd(struct device *dev)
{ {
struct maple_device *mdev = to_maple_dev(dev); struct maple_device *mdev = to_maple_dev(dev);
struct dc_kbd *kbd; struct dc_kbd *kbd = maple_get_drvdata(mdev);
mutex_lock(&maple_keyb_mutex); mutex_lock(&maple_keyb_mutex);
kbd = mdev->private_data;
mdev->private_data = NULL;
input_unregister_device(kbd->dev); input_unregister_device(kbd->dev);
kfree(kbd); kfree(kbd);
maple_set_drvdata(mdev, NULL);
mutex_unlock(&maple_keyb_mutex); mutex_unlock(&maple_keyb_mutex);
return 0; return 0;
} }
......
...@@ -94,6 +94,7 @@ void maple_driver_unregister(struct maple_driver *drv) ...@@ -94,6 +94,7 @@ void maple_driver_unregister(struct maple_driver *drv)
{ {
driver_unregister(&drv->drv); driver_unregister(&drv->drv);
} }
EXPORT_SYMBOL_GPL(maple_driver_unregister);
/* set hardware registers to enable next round of dma */ /* set hardware registers to enable next round of dma */
static void maplebus_dma_reset(void) static void maplebus_dma_reset(void)
......
...@@ -51,7 +51,6 @@ struct maple_devinfo { ...@@ -51,7 +51,6 @@ struct maple_devinfo {
struct maple_device { struct maple_device {
struct maple_driver *driver; struct maple_driver *driver;
struct mapleq *mq; struct mapleq *mq;
void *private_data;
void (*callback) (struct mapleq * mq); void (*callback) (struct mapleq * mq);
unsigned long when, interval, function; unsigned long when, interval, function;
struct maple_devinfo devinfo; struct maple_devinfo devinfo;
...@@ -80,4 +79,7 @@ void maple_clear_dev(struct maple_device *mdev); ...@@ -80,4 +79,7 @@ void maple_clear_dev(struct maple_device *mdev);
#define to_maple_dev(n) container_of(n, struct maple_device, dev) #define to_maple_dev(n) container_of(n, struct maple_device, dev)
#define to_maple_driver(n) container_of(n, struct maple_driver, drv) #define to_maple_driver(n) container_of(n, struct maple_driver, drv)
#define maple_get_drvdata(d) dev_get_drvdata(&(d)->dev)
#define maple_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
#endif /* __LINUX_MAPLE_H */ #endif /* __LINUX_MAPLE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment