aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-08-03 21:39:46 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-08-03 21:39:46 -0400
commit63870295de9adb365cd121dab94379b8cfdf986a (patch)
tree16c0b5288fa10f4f365f75d5c4fcad9c8a15e2c9
parent459021fe3627083ea6678a7b29f9f74accf9c6fd (diff)
maple: Clean up maple_driver_register/unregister routines.
These were completely inconsistent. Clean these up to take a maple_driver pointer directly for consistency. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--drivers/input/keyboard/maple_keyb.c6
-rw-r--r--drivers/sh/maple/maple.c37
-rw-r--r--include/linux/maple.h4
3 files changed, 32 insertions, 15 deletions
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
index 42f5d4ec39ab..3f5151a0fd15 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -235,17 +235,17 @@ static struct maple_driver dc_kbd_driver = {
235 .name = "Dreamcast_keyboard", 235 .name = "Dreamcast_keyboard",
236 .probe = probe_maple_kbd, 236 .probe = probe_maple_kbd,
237 .remove = remove_maple_kbd, 237 .remove = remove_maple_kbd,
238 }, 238 },
239}; 239};
240 240
241static int __init dc_kbd_init(void) 241static int __init dc_kbd_init(void)
242{ 242{
243 return maple_driver_register(&dc_kbd_driver.drv); 243 return maple_driver_register(&dc_kbd_driver);
244} 244}
245 245
246static void __exit dc_kbd_exit(void) 246static void __exit dc_kbd_exit(void)
247{ 247{
248 driver_unregister(&dc_kbd_driver.drv); 248 maple_driver_unregister(&dc_kbd_driver);
249} 249}
250 250
251module_init(dc_kbd_init); 251module_init(dc_kbd_init);
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index be97789fa5fd..a6b4dc3cfcba 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -2,6 +2,7 @@
2 * Core maple bus functionality 2 * Core maple bus functionality
3 * 3 *
4 * Copyright (C) 2007, 2008 Adrian McMenamin 4 * Copyright (C) 2007, 2008 Adrian McMenamin
5 * Copyright (C) 2001 - 2008 Paul Mundt
5 * 6 *
6 * Based on 2.4 code by: 7 * Based on 2.4 code by:
7 * 8 *
@@ -31,7 +32,7 @@
31#include <mach/dma.h> 32#include <mach/dma.h>
32#include <mach/sysasic.h> 33#include <mach/sysasic.h>
33 34
34MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin"); 35MODULE_AUTHOR("Yaegashi Takeshi, Paul Mundt, M. R. Brown, Adrian McMenamin");
35MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); 36MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
36MODULE_LICENSE("GPL v2"); 37MODULE_LICENSE("GPL v2");
37MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); 38MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
@@ -65,19 +66,35 @@ static bool checked[4];
65static struct maple_device *baseunits[4]; 66static struct maple_device *baseunits[4];
66 67
67/** 68/**
68 * maple_driver_register - register a device driver 69 * maple_driver_register - register a maple driver
69 * automatically makes the driver bus a maple bus 70 * @drv: maple driver to be registered.
70 * @drv: the driver to be registered 71 *
72 * Registers the passed in @drv, while updating the bus type.
73 * Devices with matching function IDs will be automatically probed.
71 */ 74 */
72int maple_driver_register(struct device_driver *drv) 75int maple_driver_register(struct maple_driver *drv)
73{ 76{
74 if (!drv) 77 if (!drv)
75 return -EINVAL; 78 return -EINVAL;
76 drv->bus = &maple_bus_type; 79
77 return driver_register(drv); 80 drv->drv.bus = &maple_bus_type;
81
82 return driver_register(&drv->drv);
78} 83}
79EXPORT_SYMBOL_GPL(maple_driver_register); 84EXPORT_SYMBOL_GPL(maple_driver_register);
80 85
86/**
87 * maple_driver_unregister - unregister a maple driver.
88 * @drv: maple driver to unregister.
89 *
90 * Cleans up after maple_driver_register(). To be invoked in the exit
91 * path of any module drivers.
92 */
93void maple_driver_unregister(struct maple_driver *drv)
94{
95 driver_unregister(&drv->drv);
96}
97
81/* set hardware registers to enable next round of dma */ 98/* set hardware registers to enable next round of dma */
82static void maplebus_dma_reset(void) 99static void maplebus_dma_reset(void)
83{ 100{
@@ -724,11 +741,9 @@ static int maple_get_dma_buffer(void)
724static int match_maple_bus_driver(struct device *devptr, 741static int match_maple_bus_driver(struct device *devptr,
725 struct device_driver *drvptr) 742 struct device_driver *drvptr)
726{ 743{
727 struct maple_driver *maple_drv; 744 struct maple_driver *maple_drv = to_maple_driver(drvptr);
728 struct maple_device *maple_dev; 745 struct maple_device *maple_dev = to_maple_dev(devptr);
729 746
730 maple_drv = container_of(drvptr, struct maple_driver, drv);
731 maple_dev = container_of(devptr, struct maple_device, dev);
732 /* Trap empty port case */ 747 /* Trap empty port case */
733 if (maple_dev->devinfo.function == 0xFFFFFFFF) 748 if (maple_dev->devinfo.function == 0xFFFFFFFF)
734 return 0; 749 return 0;
diff --git a/include/linux/maple.h b/include/linux/maple.h
index c853b1066018..b2b7ce0fb1f7 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -70,7 +70,9 @@ void maple_getcond_callback(struct maple_device *dev,
70 void (*callback) (struct mapleq * mq), 70 void (*callback) (struct mapleq * mq),
71 unsigned long interval, 71 unsigned long interval,
72 unsigned long function); 72 unsigned long function);
73int maple_driver_register(struct device_driver *drv); 73int maple_driver_register(struct maple_driver *);
74void maple_driver_unregister(struct maple_driver *);
75
74int maple_add_packet_sleeps(struct maple_device *mdev, u32 function, 76int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
75 u32 command, u32 length, void *data); 77 u32 command, u32 length, void *data);
76void maple_clear_dev(struct maple_device *mdev); 78void maple_clear_dev(struct maple_device *mdev);