提交 5c457083 编写于 作者: S Stephen Rothwell 提交者: David S. Miller

[SPARC/64]: Consolidate of_register_driver

Also of_unregister_driver.  These will be shortly also used by the
PowerPC code.
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7b96dc02
...@@ -585,24 +585,6 @@ static int __init of_debug(char *str) ...@@ -585,24 +585,6 @@ static int __init of_debug(char *str)
__setup("of_debug=", of_debug); __setup("of_debug=", of_debug);
int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
{
/* initialize common driver fields */
if (!drv->driver.name)
drv->driver.name = drv->name;
if (!drv->driver.owner)
drv->driver.owner = drv->owner;
drv->driver.bus = bus;
/* register with core */
return driver_register(&drv->driver);
}
void of_unregister_driver(struct of_platform_driver *drv)
{
driver_unregister(&drv->driver);
}
struct of_device* of_platform_device_create(struct device_node *np, struct of_device* of_platform_device_create(struct device_node *np,
const char *bus_id, const char *bus_id,
struct device *parent, struct device *parent,
...@@ -628,6 +610,4 @@ struct of_device* of_platform_device_create(struct device_node *np, ...@@ -628,6 +610,4 @@ struct of_device* of_platform_device_create(struct device_node *np,
return dev; return dev;
} }
EXPORT_SYMBOL(of_register_driver);
EXPORT_SYMBOL(of_unregister_driver);
EXPORT_SYMBOL(of_platform_device_create); EXPORT_SYMBOL(of_platform_device_create);
...@@ -869,26 +869,6 @@ static int __init of_debug(char *str) ...@@ -869,26 +869,6 @@ static int __init of_debug(char *str)
__setup("of_debug=", of_debug); __setup("of_debug=", of_debug);
int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
{
/* initialize common driver fields */
if (!drv->driver.name)
drv->driver.name = drv->name;
if (!drv->driver.owner)
drv->driver.owner = drv->owner;
drv->driver.bus = bus;
/* register with core */
return driver_register(&drv->driver);
}
EXPORT_SYMBOL(of_register_driver);
void of_unregister_driver(struct of_platform_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(of_unregister_driver);
struct of_device* of_platform_device_create(struct device_node *np, struct of_device* of_platform_device_create(struct device_node *np,
const char *bus_id, const char *bus_id,
struct device *parent, struct device *parent,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* *
*/ */
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
...@@ -94,3 +95,23 @@ int of_bus_type_init(struct bus_type *bus, const char *name) ...@@ -94,3 +95,23 @@ int of_bus_type_init(struct bus_type *bus, const char *name)
bus->resume = of_platform_device_resume; bus->resume = of_platform_device_resume;
return bus_register(bus); return bus_register(bus);
} }
int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
{
/* initialize common driver fields */
if (!drv->driver.name)
drv->driver.name = drv->name;
if (!drv->driver.owner)
drv->driver.owner = drv->owner;
drv->driver.bus = bus;
/* register with core */
return driver_register(&drv->driver);
}
EXPORT_SYMBOL(of_register_driver);
void of_unregister_driver(struct of_platform_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(of_unregister_driver);
...@@ -18,12 +18,9 @@ ...@@ -18,12 +18,9 @@
extern struct bus_type ebus_bus_type; extern struct bus_type ebus_bus_type;
extern struct bus_type sbus_bus_type; extern struct bus_type sbus_bus_type;
extern struct bus_type of_platform_bus_type;
#define of_bus_type of_platform_bus_type /* for compatibility */ #define of_bus_type of_platform_bus_type /* for compatibility */
extern int of_register_driver(struct of_platform_driver *drv,
struct bus_type *bus);
extern void of_unregister_driver(struct of_platform_driver *drv);
extern struct of_device *of_platform_device_create(struct device_node *np, extern struct of_device *of_platform_device_create(struct device_node *np,
const char *bus_id, const char *bus_id,
struct device *parent, struct device *parent,
......
...@@ -19,12 +19,9 @@ ...@@ -19,12 +19,9 @@
extern struct bus_type isa_bus_type; extern struct bus_type isa_bus_type;
extern struct bus_type ebus_bus_type; extern struct bus_type ebus_bus_type;
extern struct bus_type sbus_bus_type; extern struct bus_type sbus_bus_type;
extern struct bus_type of_platform_bus_type;
#define of_bus_type of_platform_bus_type /* for compatibility */ #define of_bus_type of_platform_bus_type /* for compatibility */
extern int of_register_driver(struct of_platform_driver *drv,
struct bus_type *bus);
extern void of_unregister_driver(struct of_platform_driver *drv);
extern struct of_device *of_platform_device_create(struct device_node *np, extern struct of_device *of_platform_device_create(struct device_node *np,
const char *bus_id, const char *bus_id,
struct device *parent, struct device *parent,
......
...@@ -48,6 +48,10 @@ struct of_platform_driver ...@@ -48,6 +48,10 @@ struct of_platform_driver
#define to_of_platform_driver(drv) \ #define to_of_platform_driver(drv) \
container_of(drv,struct of_platform_driver, driver) container_of(drv,struct of_platform_driver, driver)
extern int of_register_driver(struct of_platform_driver *drv,
struct bus_type *bus);
extern void of_unregister_driver(struct of_platform_driver *drv);
#include <asm/of_platform.h> #include <asm/of_platform.h>
extern struct of_device *of_find_device_by_node(struct device_node *np); extern struct of_device *of_find_device_by_node(struct device_node *np);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册