Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <grant.likely@secretlab.ca>

+1 -79
-68
drivers/of/platform.c
··· 42 42 } 43 43 EXPORT_SYMBOL(of_find_device_by_node); 44 44 45 - static int platform_driver_probe_shim(struct platform_device *pdev) 46 - { 47 - struct platform_driver *pdrv; 48 - struct of_platform_driver *ofpdrv; 49 - const struct of_device_id *match; 50 - 51 - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); 52 - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); 53 - 54 - /* There is an unlikely chance that an of_platform driver might match 55 - * on a non-OF platform device. If so, then of_match_device() will 56 - * come up empty. Return -EINVAL in this case so other drivers get 57 - * the chance to bind. */ 58 - match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); 59 - return match ? ofpdrv->probe(pdev, match) : -EINVAL; 60 - } 61 - 62 - static void platform_driver_shutdown_shim(struct platform_device *pdev) 63 - { 64 - struct platform_driver *pdrv; 65 - struct of_platform_driver *ofpdrv; 66 - 67 - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); 68 - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); 69 - ofpdrv->shutdown(pdev); 70 - } 71 - 72 - /** 73 - * of_register_platform_driver 74 - */ 75 - int of_register_platform_driver(struct of_platform_driver *drv) 76 - { 77 - char *of_name; 78 - 79 - /* setup of_platform_driver to platform_driver adaptors */ 80 - drv->platform_driver.driver = drv->driver; 81 - 82 - /* Prefix the driver name with 'of:' to avoid namespace collisions 83 - * and bogus matches. There are some drivers in the tree that 84 - * register both an of_platform_driver and a platform_driver with 85 - * the same name. This is a temporary measure until they are all 86 - * cleaned up --gcl July 29, 2010 */ 87 - of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL); 88 - if (!of_name) 89 - return -ENOMEM; 90 - sprintf(of_name, "of:%s", drv->driver.name); 91 - drv->platform_driver.driver.name = of_name; 92 - 93 - if (drv->probe) 94 - drv->platform_driver.probe = platform_driver_probe_shim; 95 - drv->platform_driver.remove = drv->remove; 96 - if (drv->shutdown) 97 - drv->platform_driver.shutdown = platform_driver_shutdown_shim; 98 - drv->platform_driver.suspend = drv->suspend; 99 - drv->platform_driver.resume = drv->resume; 100 - 101 - return platform_driver_register(&drv->platform_driver); 102 - } 103 - EXPORT_SYMBOL(of_register_platform_driver); 104 - 105 - void of_unregister_platform_driver(struct of_platform_driver *drv) 106 - { 107 - platform_driver_unregister(&drv->platform_driver); 108 - kfree(drv->platform_driver.driver.name); 109 - drv->platform_driver.driver.name = NULL; 110 - } 111 - EXPORT_SYMBOL(of_unregister_platform_driver); 112 - 113 45 #if defined(CONFIG_PPC_DCR) 114 46 #include <asm/dcr.h> 115 47 #endif
+1 -11
include/linux/of_platform.h
··· 23 23 * of_platform_driver - Legacy of-aware driver for platform devices. 24 24 * 25 25 * An of_platform_driver driver is attached to a basic platform_device on 26 - * ether the "platform bus" (platform_bus_type), or the ibm ebus 27 - * (ibmebus_bus_type). 28 - * 29 - * of_platform_driver is being phased out when used with the platform_bus_type, 30 - * and regular platform_drivers should be used instead. When the transition 31 - * is complete, only ibmebus will be using this structure, and the 32 - * platform_driver member of this structure will be removed. 26 + * the ibm ebus (ibmebus_bus_type). 33 27 */ 34 28 struct of_platform_driver 35 29 { ··· 36 42 int (*shutdown)(struct platform_device* dev); 37 43 38 44 struct device_driver driver; 39 - struct platform_driver platform_driver; 40 45 }; 41 46 #define to_of_platform_driver(drv) \ 42 47 container_of(drv,struct of_platform_driver, driver) 43 48 44 49 /* Platform drivers register/unregister */ 45 - extern int of_register_platform_driver(struct of_platform_driver *drv); 46 - extern void of_unregister_platform_driver(struct of_platform_driver *drv); 47 - 48 50 extern struct platform_device *of_device_alloc(struct device_node *np, 49 51 const char *bus_id, 50 52 struct device *parent);