From 710ac54be44e0cc53f5bf29b03d12c8706e7077a Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Thu, 17 Feb 2011 00:26:57 -0700 Subject: dt/powerpc: move of_bus_type infrastructure to ibmebus arch/powerpc/kernel/ibmebus.c is the only remaining user of the of_bus_type support code for initializing the bus and registering drivers. All others have either been switched to the vanilla platform bus or already have their own infrastructure. This patch moves the functionality that ibmebus is using out of drivers/of/{platform,device}.c and into ibmebus.c where it is actually used. Also renames the moved symbols from of_platform_* to ibmebus_bus_* to reflect the actual usage. This patch is part of moving all of the of_platform_bus_type users over to the platform_bus_type. Signed-off-by: Grant Likely --- include/linux/of_platform.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include/linux/of_platform.h') diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index a68716ad38c..048949fa1d1 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -47,10 +47,6 @@ struct of_platform_driver #define to_of_platform_driver(drv) \ 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); - /* Platform drivers register/unregister */ extern int of_register_platform_driver(struct of_platform_driver *drv); extern void of_unregister_platform_driver(struct of_platform_driver *drv); @@ -60,8 +56,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np, struct device *parent); extern struct platform_device *of_find_device_by_node(struct device_node *np); -extern int of_bus_type_init(struct bus_type *bus, const char *name); - #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ /* Platform devices and busses creation */ extern struct platform_device *of_platform_device_create(struct device_node *np, -- cgit v1.2.3-70-g09d2 From d714d1979d7b4df7e2c127407f4014ce71f73cd0 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 22 Feb 2011 20:22:44 -0700 Subject: dt: eliminate of_platform_driver shim code Commit eca393016, "of: Merge of_platform_bus_type with platform_bus_type" added a shim to allow of_platform_drivers to get registers onto the platform bus so that there was time to migrate the existing drivers to the platform_bus_type. This patch removes the shim since there are no more users of the old interface. Signed-off-by: Grant Likely --- drivers/of/platform.c | 68 --------------------------------------------- include/linux/of_platform.h | 12 +------- 2 files changed, 1 insertion(+), 79 deletions(-) (limited to 'include/linux/of_platform.h') diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b71d0cdc420..1ce4c45c4ab 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -42,74 +42,6 @@ struct platform_device *of_find_device_by_node(struct device_node *np) } EXPORT_SYMBOL(of_find_device_by_node); -static int platform_driver_probe_shim(struct platform_device *pdev) -{ - struct platform_driver *pdrv; - struct of_platform_driver *ofpdrv; - const struct of_device_id *match; - - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); - - /* There is an unlikely chance that an of_platform driver might match - * on a non-OF platform device. If so, then of_match_device() will - * come up empty. Return -EINVAL in this case so other drivers get - * the chance to bind. */ - match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); - return match ? ofpdrv->probe(pdev, match) : -EINVAL; -} - -static void platform_driver_shutdown_shim(struct platform_device *pdev) -{ - struct platform_driver *pdrv; - struct of_platform_driver *ofpdrv; - - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); - ofpdrv->shutdown(pdev); -} - -/** - * of_register_platform_driver - */ -int of_register_platform_driver(struct of_platform_driver *drv) -{ - char *of_name; - - /* setup of_platform_driver to platform_driver adaptors */ - drv->platform_driver.driver = drv->driver; - - /* Prefix the driver name with 'of:' to avoid namespace collisions - * and bogus matches. There are some drivers in the tree that - * register both an of_platform_driver and a platform_driver with - * the same name. This is a temporary measure until they are all - * cleaned up --gcl July 29, 2010 */ - of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL); - if (!of_name) - return -ENOMEM; - sprintf(of_name, "of:%s", drv->driver.name); - drv->platform_driver.driver.name = of_name; - - if (drv->probe) - drv->platform_driver.probe = platform_driver_probe_shim; - drv->platform_driver.remove = drv->remove; - if (drv->shutdown) - drv->platform_driver.shutdown = platform_driver_shutdown_shim; - drv->platform_driver.suspend = drv->suspend; - drv->platform_driver.resume = drv->resume; - - return platform_driver_register(&drv->platform_driver); -} -EXPORT_SYMBOL(of_register_platform_driver); - -void of_unregister_platform_driver(struct of_platform_driver *drv) -{ - platform_driver_unregister(&drv->platform_driver); - kfree(drv->platform_driver.driver.name); - drv->platform_driver.driver.name = NULL; -} -EXPORT_SYMBOL(of_unregister_platform_driver); - #if defined(CONFIG_PPC_DCR) #include #endif diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 048949fa1d1..17c7e21c0bd 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -23,13 +23,7 @@ * of_platform_driver - Legacy of-aware driver for platform devices. * * An of_platform_driver driver is attached to a basic platform_device on - * ether the "platform bus" (platform_bus_type), or the ibm ebus - * (ibmebus_bus_type). - * - * of_platform_driver is being phased out when used with the platform_bus_type, - * and regular platform_drivers should be used instead. When the transition - * is complete, only ibmebus will be using this structure, and the - * platform_driver member of this structure will be removed. + * the ibm ebus (ibmebus_bus_type). */ struct of_platform_driver { @@ -42,15 +36,11 @@ struct of_platform_driver int (*shutdown)(struct platform_device* dev); struct device_driver driver; - struct platform_driver platform_driver; }; #define to_of_platform_driver(drv) \ container_of(drv,struct of_platform_driver, driver) /* Platform drivers register/unregister */ -extern int of_register_platform_driver(struct of_platform_driver *drv); -extern void of_unregister_platform_driver(struct of_platform_driver *drv); - extern struct platform_device *of_device_alloc(struct device_node *np, const char *bus_id, struct device *parent); -- cgit v1.2.3-70-g09d2