diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-08-03 21:39:46 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-08-03 21:39:46 -0400 |
commit | 63870295de9adb365cd121dab94379b8cfdf986a (patch) | |
tree | 16c0b5288fa10f4f365f75d5c4fcad9c8a15e2c9 /drivers/sh/maple | |
parent | 459021fe3627083ea6678a7b29f9f74accf9c6fd (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>
Diffstat (limited to 'drivers/sh/maple')
-rw-r--r-- | drivers/sh/maple/maple.c | 37 |
1 files changed, 26 insertions, 11 deletions
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 | ||
34 | MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin"); | 35 | MODULE_AUTHOR("Yaegashi Takeshi, Paul Mundt, M. R. Brown, Adrian McMenamin"); |
35 | MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); | 36 | MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); |
36 | MODULE_LICENSE("GPL v2"); | 37 | MODULE_LICENSE("GPL v2"); |
37 | MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); | 38 | MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}"); |
@@ -65,19 +66,35 @@ static bool checked[4]; | |||
65 | static struct maple_device *baseunits[4]; | 66 | static 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 | */ |
72 | int maple_driver_register(struct device_driver *drv) | 75 | int 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 | } |
79 | EXPORT_SYMBOL_GPL(maple_driver_register); | 84 | EXPORT_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 | */ | ||
93 | void 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 */ |
82 | static void maplebus_dma_reset(void) | 99 | static void maplebus_dma_reset(void) |
83 | { | 100 | { |
@@ -724,11 +741,9 @@ static int maple_get_dma_buffer(void) | |||
724 | static int match_maple_bus_driver(struct device *devptr, | 741 | static 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; |