Commit fa7744dbb69c06b69c7449063c440d8a53df9e6c

Authored by Stephen Rothwell
Committed by David S. Miller
1 parent e8dd16129f

[SPARC/64]: Prepare to remove of_platform_driver name.

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>

Showing 3 changed files with 11 additions and 3 deletions Side-by-side Diff

Documentation/sparc/sbus_drivers.txt
... ... @@ -67,10 +67,12 @@
67 67 MODULE_DEVICE_TABLE(of, mydevice_match);
68 68  
69 69 static struct of_platform_driver mydevice_driver = {
70   - .name = "mydevice",
71 70 .match_table = mydevice_match,
72 71 .probe = mydevice_probe,
73 72 .remove = __devexit_p(mydevice_remove),
  73 + .driver = {
  74 + .name = "mydevice",
  75 + },
74 76 };
75 77  
76 78 static int __init mydevice_init(void)
arch/sparc/kernel/of_device.c
... ... @@ -588,7 +588,10 @@
588 588 int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
589 589 {
590 590 /* initialize common driver fields */
591   - drv->driver.name = drv->name;
  591 + if (!drv->driver.name)
  592 + drv->driver.name = drv->name;
  593 + if (!drv->driver.owner)
  594 + drv->driver.owner = drv->owner;
592 595 drv->driver.bus = bus;
593 596  
594 597 /* register with core */
arch/sparc64/kernel/of_device.c
... ... @@ -872,7 +872,10 @@
872 872 int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
873 873 {
874 874 /* initialize common driver fields */
875   - drv->driver.name = drv->name;
  875 + if (!drv->driver.name)
  876 + drv->driver.name = drv->name;
  877 + if (!drv->driver.owner)
  878 + drv->driver.owner = drv->owner;
876 879 drv->driver.bus = bus;
877 880  
878 881 /* register with core */