Commit 5c45708352a040f19caceb683c78bc86aad466f6
Committed by
David S. Miller
1 parent
7b96dc023a
Exists in
master
and in
41 other branches
[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>
Showing 6 changed files with 27 additions and 48 deletions Side-by-side Diff
arch/sparc/kernel/of_device.c
... | ... | @@ -585,24 +585,6 @@ |
585 | 585 | |
586 | 586 | __setup("of_debug=", of_debug); |
587 | 587 | |
588 | -int 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 | - | |
601 | -void of_unregister_driver(struct of_platform_driver *drv) | |
602 | -{ | |
603 | - driver_unregister(&drv->driver); | |
604 | -} | |
605 | - | |
606 | 588 | struct of_device* of_platform_device_create(struct device_node *np, |
607 | 589 | const char *bus_id, |
608 | 590 | struct device *parent, |
... | ... | @@ -628,7 +610,5 @@ |
628 | 610 | return dev; |
629 | 611 | } |
630 | 612 | |
631 | -EXPORT_SYMBOL(of_register_driver); | |
632 | -EXPORT_SYMBOL(of_unregister_driver); | |
633 | 613 | EXPORT_SYMBOL(of_platform_device_create); |
arch/sparc64/kernel/of_device.c
... | ... | @@ -869,26 +869,6 @@ |
869 | 869 | |
870 | 870 | __setup("of_debug=", of_debug); |
871 | 871 | |
872 | -int 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 | -} | |
884 | -EXPORT_SYMBOL(of_register_driver); | |
885 | - | |
886 | -void of_unregister_driver(struct of_platform_driver *drv) | |
887 | -{ | |
888 | - driver_unregister(&drv->driver); | |
889 | -} | |
890 | -EXPORT_SYMBOL(of_unregister_driver); | |
891 | - | |
892 | 872 | struct of_device* of_platform_device_create(struct device_node *np, |
893 | 873 | const char *bus_id, |
894 | 874 | struct device *parent, |
drivers/of/platform.c
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | * |
13 | 13 | */ |
14 | 14 | #include <linux/errno.h> |
15 | +#include <linux/module.h> | |
15 | 16 | #include <linux/device.h> |
16 | 17 | #include <linux/of_device.h> |
17 | 18 | #include <linux/of_platform.h> |
... | ... | @@ -94,4 +95,24 @@ |
94 | 95 | bus->resume = of_platform_device_resume; |
95 | 96 | return bus_register(bus); |
96 | 97 | } |
98 | + | |
99 | +int 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 | +} | |
111 | +EXPORT_SYMBOL(of_register_driver); | |
112 | + | |
113 | +void of_unregister_driver(struct of_platform_driver *drv) | |
114 | +{ | |
115 | + driver_unregister(&drv->driver); | |
116 | +} | |
117 | +EXPORT_SYMBOL(of_unregister_driver); |
include/asm-sparc/of_platform.h
... | ... | @@ -18,12 +18,9 @@ |
18 | 18 | |
19 | 19 | extern struct bus_type ebus_bus_type; |
20 | 20 | extern struct bus_type sbus_bus_type; |
21 | -extern struct bus_type of_platform_bus_type; | |
21 | + | |
22 | 22 | #define of_bus_type of_platform_bus_type /* for compatibility */ |
23 | 23 | |
24 | -extern int of_register_driver(struct of_platform_driver *drv, | |
25 | - struct bus_type *bus); | |
26 | -extern void of_unregister_driver(struct of_platform_driver *drv); | |
27 | 24 | extern struct of_device *of_platform_device_create(struct device_node *np, |
28 | 25 | const char *bus_id, |
29 | 26 | struct device *parent, |
include/asm-sparc64/of_platform.h
... | ... | @@ -19,12 +19,9 @@ |
19 | 19 | extern struct bus_type isa_bus_type; |
20 | 20 | extern struct bus_type ebus_bus_type; |
21 | 21 | extern struct bus_type sbus_bus_type; |
22 | -extern struct bus_type of_platform_bus_type; | |
22 | + | |
23 | 23 | #define of_bus_type of_platform_bus_type /* for compatibility */ |
24 | 24 | |
25 | -extern int of_register_driver(struct of_platform_driver *drv, | |
26 | - struct bus_type *bus); | |
27 | -extern void of_unregister_driver(struct of_platform_driver *drv); | |
28 | 25 | extern struct of_device *of_platform_device_create(struct device_node *np, |
29 | 26 | const char *bus_id, |
30 | 27 | struct device *parent, |
include/linux/of_platform.h
... | ... | @@ -48,6 +48,10 @@ |
48 | 48 | #define to_of_platform_driver(drv) \ |
49 | 49 | container_of(drv,struct of_platform_driver, driver) |
50 | 50 | |
51 | +extern int of_register_driver(struct of_platform_driver *drv, | |
52 | + struct bus_type *bus); | |
53 | +extern void of_unregister_driver(struct of_platform_driver *drv); | |
54 | + | |
51 | 55 | #include <asm/of_platform.h> |
52 | 56 | |
53 | 57 | extern struct of_device *of_find_device_by_node(struct device_node *np); |