aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-10-18 00:17:42 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-18 00:17:42 -0400
commit5c45708352a040f19caceb683c78bc86aad466f6 (patch)
tree6541789a623c189c1e91ffd91bd972cad938d130
parent7b96dc023a1b487bce59256fde14b8bb28b45aea (diff)
[SPARC/64]: Consolidate of_register_driver
Also of_unregister_driver. These will be shortly also used by the PowerPC code. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/of_device.c20
-rw-r--r--arch/sparc64/kernel/of_device.c20
-rw-r--r--drivers/of/platform.c21
-rw-r--r--include/asm-sparc/of_platform.h5
-rw-r--r--include/asm-sparc64/of_platform.h5
-rw-r--r--include/linux/of_platform.h4
6 files changed, 27 insertions, 48 deletions
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index fb2caef79cec..3ea000d15e3a 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -585,24 +585,6 @@ static int __init of_debug(char *str)
585 585
586__setup("of_debug=", of_debug); 586__setup("of_debug=", of_debug);
587 587
588int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
589{
590 /* initialize common driver fields */
591 if (!drv->driver.name)
592 drv->driver.name = drv->name;
593 if (!drv->driver.owner)
594 drv->driver.owner = drv->owner;
595 drv->driver.bus = bus;
596
597 /* register with core */
598 return driver_register(&drv->driver);
599}
600
601void of_unregister_driver(struct of_platform_driver *drv)
602{
603 driver_unregister(&drv->driver);
604}
605
606struct of_device* of_platform_device_create(struct device_node *np, 588struct of_device* of_platform_device_create(struct device_node *np,
607 const char *bus_id, 589 const char *bus_id,
608 struct device *parent, 590 struct device *parent,
@@ -628,6 +610,4 @@ struct of_device* of_platform_device_create(struct device_node *np,
628 return dev; 610 return dev;
629} 611}
630 612
631EXPORT_SYMBOL(of_register_driver);
632EXPORT_SYMBOL(of_unregister_driver);
633EXPORT_SYMBOL(of_platform_device_create); 613EXPORT_SYMBOL(of_platform_device_create);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 42d779866fba..fc5c0cc793b8 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -869,26 +869,6 @@ static int __init of_debug(char *str)
869 869
870__setup("of_debug=", of_debug); 870__setup("of_debug=", of_debug);
871 871
872int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
873{
874 /* initialize common driver fields */
875 if (!drv->driver.name)
876 drv->driver.name = drv->name;
877 if (!drv->driver.owner)
878 drv->driver.owner = drv->owner;
879 drv->driver.bus = bus;
880
881 /* register with core */
882 return driver_register(&drv->driver);
883}
884EXPORT_SYMBOL(of_register_driver);
885
886void of_unregister_driver(struct of_platform_driver *drv)
887{
888 driver_unregister(&drv->driver);
889}
890EXPORT_SYMBOL(of_unregister_driver);
891
892struct of_device* of_platform_device_create(struct device_node *np, 872struct of_device* of_platform_device_create(struct device_node *np,
893 const char *bus_id, 873 const char *bus_id,
894 struct device *parent, 874 struct device *parent,
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 864f09fd9f86..b47bb2d7476a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/of_device.h> 17#include <linux/of_device.h>
17#include <linux/of_platform.h> 18#include <linux/of_platform.h>
@@ -94,3 +95,23 @@ int of_bus_type_init(struct bus_type *bus, const char *name)
94 bus->resume = of_platform_device_resume; 95 bus->resume = of_platform_device_resume;
95 return bus_register(bus); 96 return bus_register(bus);
96} 97}
98
99int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
100{
101 /* initialize common driver fields */
102 if (!drv->driver.name)
103 drv->driver.name = drv->name;
104 if (!drv->driver.owner)
105 drv->driver.owner = drv->owner;
106 drv->driver.bus = bus;
107
108 /* register with core */
109 return driver_register(&drv->driver);
110}
111EXPORT_SYMBOL(of_register_driver);
112
113void of_unregister_driver(struct of_platform_driver *drv)
114{
115 driver_unregister(&drv->driver);
116}
117EXPORT_SYMBOL(of_unregister_driver);
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
index 64a230064ef2..d638737ff13c 100644
--- a/include/asm-sparc/of_platform.h
+++ b/include/asm-sparc/of_platform.h
@@ -18,12 +18,9 @@
18 18
19extern struct bus_type ebus_bus_type; 19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type; 20extern struct bus_type sbus_bus_type;
21extern struct bus_type of_platform_bus_type; 21
22#define of_bus_type of_platform_bus_type /* for compatibility */ 22#define of_bus_type of_platform_bus_type /* for compatibility */
23 23
24extern int of_register_driver(struct of_platform_driver *drv,
25 struct bus_type *bus);
26extern void of_unregister_driver(struct of_platform_driver *drv);
27extern struct of_device *of_platform_device_create(struct device_node *np, 24extern struct of_device *of_platform_device_create(struct device_node *np,
28 const char *bus_id, 25 const char *bus_id,
29 struct device *parent, 26 struct device *parent,
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
index f7c1f17c7d52..f15cfa723916 100644
--- a/include/asm-sparc64/of_platform.h
+++ b/include/asm-sparc64/of_platform.h
@@ -19,12 +19,9 @@
19extern struct bus_type isa_bus_type; 19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type; 20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type; 21extern struct bus_type sbus_bus_type;
22extern struct bus_type of_platform_bus_type; 22
23#define of_bus_type of_platform_bus_type /* for compatibility */ 23#define of_bus_type of_platform_bus_type /* for compatibility */
24 24
25extern int of_register_driver(struct of_platform_driver *drv,
26 struct bus_type *bus);
27extern void of_unregister_driver(struct of_platform_driver *drv);
28extern struct of_device *of_platform_device_create(struct device_node *np, 25extern struct of_device *of_platform_device_create(struct device_node *np,
29 const char *bus_id, 26 const char *bus_id,
30 struct device *parent, 27 struct device *parent,
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 448f70b30a0c..a8efcfeea732 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -48,6 +48,10 @@ struct of_platform_driver
48#define to_of_platform_driver(drv) \ 48#define to_of_platform_driver(drv) \
49 container_of(drv,struct of_platform_driver, driver) 49 container_of(drv,struct of_platform_driver, driver)
50 50
51extern int of_register_driver(struct of_platform_driver *drv,
52 struct bus_type *bus);
53extern void of_unregister_driver(struct of_platform_driver *drv);
54
51#include <asm/of_platform.h> 55#include <asm/of_platform.h>
52 56
53extern struct of_device *of_find_device_by_node(struct device_node *np); 57extern struct of_device *of_find_device_by_node(struct device_node *np);