mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
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>
This commit is contained in:
parent
459021fe36
commit
63870295de
3 changed files with 32 additions and 15 deletions
|
@ -240,12 +240,12 @@ static struct maple_driver dc_kbd_driver = {
|
||||||
|
|
||||||
static int __init dc_kbd_init(void)
|
static int __init dc_kbd_init(void)
|
||||||
{
|
{
|
||||||
return maple_driver_register(&dc_kbd_driver.drv);
|
return maple_driver_register(&dc_kbd_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit dc_kbd_exit(void)
|
static void __exit dc_kbd_exit(void)
|
||||||
{
|
{
|
||||||
driver_unregister(&dc_kbd_driver.drv);
|
maple_driver_unregister(&dc_kbd_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(dc_kbd_init);
|
module_init(dc_kbd_init);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* Core maple bus functionality
|
* Core maple bus functionality
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Adrian McMenamin
|
* Copyright (C) 2007, 2008 Adrian McMenamin
|
||||||
|
* Copyright (C) 2001 - 2008 Paul Mundt
|
||||||
*
|
*
|
||||||
* Based on 2.4 code by:
|
* Based on 2.4 code by:
|
||||||
*
|
*
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
#include <mach/dma.h>
|
#include <mach/dma.h>
|
||||||
#include <mach/sysasic.h>
|
#include <mach/sysasic.h>
|
||||||
|
|
||||||
MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin");
|
MODULE_AUTHOR("Yaegashi Takeshi, Paul Mundt, M. R. Brown, Adrian McMenamin");
|
||||||
MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
|
MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
|
MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
|
||||||
|
@ -65,19 +66,35 @@ static bool checked[4];
|
||||||
static struct maple_device *baseunits[4];
|
static struct maple_device *baseunits[4];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* maple_driver_register - register a device driver
|
* maple_driver_register - register a maple driver
|
||||||
* automatically makes the driver bus a maple bus
|
* @drv: maple driver to be registered.
|
||||||
* @drv: the driver to be registered
|
*
|
||||||
|
* Registers the passed in @drv, while updating the bus type.
|
||||||
|
* Devices with matching function IDs will be automatically probed.
|
||||||
*/
|
*/
|
||||||
int maple_driver_register(struct device_driver *drv)
|
int maple_driver_register(struct maple_driver *drv)
|
||||||
{
|
{
|
||||||
if (!drv)
|
if (!drv)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
drv->bus = &maple_bus_type;
|
|
||||||
return driver_register(drv);
|
drv->drv.bus = &maple_bus_type;
|
||||||
|
|
||||||
|
return driver_register(&drv->drv);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(maple_driver_register);
|
EXPORT_SYMBOL_GPL(maple_driver_register);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* maple_driver_unregister - unregister a maple driver.
|
||||||
|
* @drv: maple driver to unregister.
|
||||||
|
*
|
||||||
|
* Cleans up after maple_driver_register(). To be invoked in the exit
|
||||||
|
* path of any module drivers.
|
||||||
|
*/
|
||||||
|
void maple_driver_unregister(struct maple_driver *drv)
|
||||||
|
{
|
||||||
|
driver_unregister(&drv->drv);
|
||||||
|
}
|
||||||
|
|
||||||
/* 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)
|
||||||
{
|
{
|
||||||
|
@ -724,11 +741,9 @@ static int maple_get_dma_buffer(void)
|
||||||
static int match_maple_bus_driver(struct device *devptr,
|
static int match_maple_bus_driver(struct device *devptr,
|
||||||
struct device_driver *drvptr)
|
struct device_driver *drvptr)
|
||||||
{
|
{
|
||||||
struct maple_driver *maple_drv;
|
struct maple_driver *maple_drv = to_maple_driver(drvptr);
|
||||||
struct maple_device *maple_dev;
|
struct maple_device *maple_dev = to_maple_dev(devptr);
|
||||||
|
|
||||||
maple_drv = container_of(drvptr, struct maple_driver, drv);
|
|
||||||
maple_dev = container_of(devptr, struct maple_device, dev);
|
|
||||||
/* Trap empty port case */
|
/* Trap empty port case */
|
||||||
if (maple_dev->devinfo.function == 0xFFFFFFFF)
|
if (maple_dev->devinfo.function == 0xFFFFFFFF)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -70,7 +70,9 @@ void maple_getcond_callback(struct maple_device *dev,
|
||||||
void (*callback) (struct mapleq * mq),
|
void (*callback) (struct mapleq * mq),
|
||||||
unsigned long interval,
|
unsigned long interval,
|
||||||
unsigned long function);
|
unsigned long function);
|
||||||
int maple_driver_register(struct device_driver *drv);
|
int maple_driver_register(struct maple_driver *);
|
||||||
|
void maple_driver_unregister(struct maple_driver *);
|
||||||
|
|
||||||
int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
|
int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
|
||||||
u32 command, u32 length, void *data);
|
u32 command, u32 length, void *data);
|
||||||
void maple_clear_dev(struct maple_device *mdev);
|
void maple_clear_dev(struct maple_device *mdev);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue