From 8a46f4f7f95f2bece108998a2e1b87b58f99d590 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sat, 1 Jun 2013 00:22:52 +0200 Subject: of: remove #ifdef from linux/of_platform.h A lot of code uses the functions from of_platform.h when built for devicetree-enabled platforms but can also be built without them. In order to avoid using #ifdef everywhere in drivers, this makes all the function declarations visible, which means we can use "if (IS_ENABLED(CONFIG_OF))" in driver code and get build coverage over the code but let the compiler drop the reference in the object code. Signed-off-by: Arnd Bergmann Cc: Grant Likely Cc: Rob Herring Signed-off-by: Grant Likely --- include/linux/of_platform.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'include/linux') diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 2a93b64a3869..7747ad0027ae 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -13,8 +13,6 @@ #include #include - -#ifdef CONFIG_OF_DEVICE #include #include #include @@ -82,7 +80,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); -#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */ /* Platform devices and busses creation */ extern struct platform_device *of_platform_device_create(struct device_node *np, const char *bus_id, @@ -91,17 +88,12 @@ extern struct platform_device *of_platform_device_create(struct device_node *np, extern int of_platform_bus_probe(struct device_node *root, const struct of_device_id *matches, struct device *parent); +#ifdef CONFIG_OF_ADDRESS extern int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, struct device *parent); -#endif /* CONFIG_OF_ADDRESS */ - -#endif /* CONFIG_OF_DEVICE */ - -#if !defined(CONFIG_OF_ADDRESS) -struct of_dev_auxdata; -struct device_node; +#else static inline int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, @@ -109,6 +101,6 @@ static inline int of_platform_populate(struct device_node *root, { return -ENODEV; } -#endif /* !CONFIG_OF_ADDRESS */ +#endif #endif /* _LINUX_OF_PLATFORM_H */ -- cgit From 10dbc5e39a60944536f3ca59bc9a8a8896355714 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Sun, 21 Apr 2013 16:38:31 -0500 Subject: driver core: move to_platform_driver to platform_device.h In converting the last remaining of_platform_driver (ibmebus) to a regular platform driver, to_platform_driver is needed to replace to_of_platform_driver. Signed-off-by: Rob Herring Acked-by: Arnd Bergmann Tested-by: Benjamin Herrenschmidt Signed-off-by: Grant Likely --- include/linux/platform_device.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 9abf1db6aea6..3413897474e1 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -180,6 +180,9 @@ struct platform_driver { const struct platform_device_id *id_table; }; +#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ + driver)) + extern int platform_driver_register(struct platform_driver *); extern void platform_driver_unregister(struct platform_driver *); -- cgit From f70c64f8b095c0c386840f2036a79523bfd66725 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Sun, 21 Apr 2013 16:40:13 -0500 Subject: of: remove of_platform_driver The last user of of_platform_driver is converted to a regular platform_driver, so of_platform_driver can be removed now. Signed-off-by: Rob Herring Acked-by: Arnd Bergmann Tested-by: Benjamin Herrenschmidt Signed-off-by: Grant Likely --- include/linux/of_platform.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'include/linux') diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 7747ad0027ae..05cb4a928252 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -51,27 +51,6 @@ struct of_dev_auxdata { { .compatible = _compat, .phys_addr = _phys, .name = _name, \ .platform_data = _pdata } -/** - * of_platform_driver - Legacy of-aware driver for platform devices. - * - * An of_platform_driver driver is attached to a basic platform_device on - * the ibm ebus (ibmebus_bus_type). - */ -struct of_platform_driver -{ - int (*probe)(struct platform_device* dev, - const struct of_device_id *match); - int (*remove)(struct platform_device* dev); - - int (*suspend)(struct platform_device* dev, pm_message_t state); - int (*resume)(struct platform_device* dev); - int (*shutdown)(struct platform_device* dev); - - struct device_driver driver; -}; -#define to_of_platform_driver(drv) \ - container_of(drv,struct of_platform_driver, driver) - extern const struct of_device_id of_default_bus_match_table[]; /* Platform drivers register/unregister */ -- cgit From ba166e900b502b74b9425881caa94f94891b0a1f Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 19 Apr 2013 17:32:52 -0500 Subject: of: remove CONFIG_OF_DEVICE CONFIG_OF_DEVICE is always selected when CONFIG_OF is enabled, so remove it and simplify of_platform.h and of_device.h headers. This also fixes !OF compiles using of_platform_populate. Signed-off-by: Rob Herring Acked-by: Arnd Bergmann Tested-by: Benjamin Herrenschmidt Signed-off-by: Grant Likely --- include/linux/of_device.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/linux') diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 901b7435e890..9d27475feec1 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -4,12 +4,12 @@ #include #include /* temporary until merge */ -#ifdef CONFIG_OF_DEVICE #include #include struct device; +#ifdef CONFIG_OF extern const struct of_device_id *of_match_device( const struct of_device_id *matches, const struct device *dev); extern void of_device_make_bus_id(struct device *dev); @@ -43,7 +43,7 @@ static inline void of_device_node_put(struct device *dev) of_node_put(dev->of_node); } -#else /* CONFIG_OF_DEVICE */ +#else /* CONFIG_OF */ static inline int of_driver_match_device(struct device *dev, struct device_driver *drv) @@ -67,6 +67,6 @@ static inline const struct of_device_id *of_match_device( { return NULL; } -#endif /* CONFIG_OF_DEVICE */ +#endif /* CONFIG_OF */ #endif /* _LINUX_OF_DEVICE_H */ -- cgit