[SPARC/64]: Prepare to remove of_platform_driver name.
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Sep 2007 20:21:43 +0000 (13:21 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 14 Oct 2007 04:53:11 +0000 (21:53 -0700)
The name field of of_platform_driver is just copied into the
included device_driver.  By not overriding an already initialised
device_driver name, we can convert the drivers over time to stop using
the of_platform_driver name.

Also we were not copying the owner field from of_platform_driver, so do
the same with it.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/sparc/sbus_drivers.txt
arch/sparc/kernel/of_device.c
arch/sparc64/kernel/of_device.c

index 8418d35484fc850b28ec0744a1b8aa4751d8d2b2..eb1e28ad8822f32421db93dd211f1e2be0084488 100644 (file)
@@ -67,10 +67,12 @@ probe in an SBUS driver under Linux:
        MODULE_DEVICE_TABLE(of, mydevice_match);
 
        static struct of_platform_driver mydevice_driver = {
-               .name           = "mydevice",
                .match_table    = mydevice_match,
                .probe          = mydevice_probe,
                .remove         = __devexit_p(mydevice_remove),
+               .driver         = {
+                       .name           = "mydevice",
+               },
        };
 
        static int __init mydevice_init(void)
index 36383f73d6855a425a92e60884c20f10e4c9f6be..fb2caef79cec407f0e36497567902c88c88b2418 100644 (file)
@@ -588,7 +588,10 @@ __setup("of_debug=", of_debug);
 int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
 {
        /* initialize common driver fields */
-       drv->driver.name = drv->name;
+       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 */
index 4cc77485f53602ba54714e88b42d61e1bb062047..42d779866fba394135bf7063d5b6a04e29fe1c7b 100644 (file)
@@ -872,7 +872,10 @@ __setup("of_debug=", of_debug);
 int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
 {
        /* initialize common driver fields */
-       drv->driver.name = drv->name;
+       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 */