drivers/of/platform.c | 23 +++++++++++------------ include/linux/of_platform.h | 2 -- 2 files changed, 11 insertions(+), 14 deletions(-)
This isn't used outside this file. Hide the array in the C file.
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
Changes from v1 https://lore.kernel.org/r/20241204000415.2404264-1-swboyd@chromium.org
* Move of_default_bus_match_table into function so it isn't unused in
different configs
drivers/of/platform.c | 23 +++++++++++------------
include/linux/of_platform.h | 2 --
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9bafcff3e628..c6d8afb284e8 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -24,16 +24,6 @@
#include "of_private.h"
-const struct of_device_id of_default_bus_match_table[] = {
- { .compatible = "simple-bus", },
- { .compatible = "simple-mfd", },
- { .compatible = "isa", },
-#ifdef CONFIG_ARM_AMBA
- { .compatible = "arm,amba-bus", },
-#endif /* CONFIG_ARM_AMBA */
- {} /* Empty terminated list */
-};
-
/**
* of_find_device_by_node - Find the platform_device associated with a node
* @np: Pointer to device tree node
@@ -484,8 +474,17 @@ int of_platform_default_populate(struct device_node *root,
const struct of_dev_auxdata *lookup,
struct device *parent)
{
- return of_platform_populate(root, of_default_bus_match_table, lookup,
- parent);
+ static const struct of_device_id match_table[] = {
+ { .compatible = "simple-bus", },
+ { .compatible = "simple-mfd", },
+ { .compatible = "isa", },
+#ifdef CONFIG_ARM_AMBA
+ { .compatible = "arm,amba-bus", },
+#endif /* CONFIG_ARM_AMBA */
+ {} /* Empty terminated list */
+ };
+
+ return of_platform_populate(root, match_table, lookup, parent);
}
EXPORT_SYMBOL_GPL(of_platform_default_populate);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a2ff1ad48f7f..17471ef8e092 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -47,8 +47,6 @@ struct of_dev_auxdata {
{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
.platform_data = _pdata }
-extern const struct of_device_id of_default_bus_match_table[];
-
/* Platform drivers register/unregister */
extern struct platform_device *of_device_alloc(struct device_node *np,
const char *bus_id,
base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
--
https://chromeos.dev
On Wed, Dec 04, 2024 at 11:48:05AM -0800, Stephen Boyd wrote: > This isn't used outside this file. Hide the array in the C file. > > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > --- > > Changes from v1 https://lore.kernel.org/r/20241204000415.2404264-1-swboyd@chromium.org > * Move of_default_bus_match_table into function so it isn't unused in > different configs > > drivers/of/platform.c | 23 +++++++++++------------ > include/linux/of_platform.h | 2 -- > 2 files changed, 11 insertions(+), 14 deletions(-) Applied, thanks. Rob
On Wed, Dec 4, 2024 at 11:48 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> This isn't used outside this file. Hide the array in the C file.
Acked-by: Saravana Kannan <saravanak@google.com>
>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>
> Changes from v1 https://lore.kernel.org/r/20241204000415.2404264-1-swboyd@chromium.org
> * Move of_default_bus_match_table into function so it isn't unused in
> different configs
>
> drivers/of/platform.c | 23 +++++++++++------------
> include/linux/of_platform.h | 2 --
> 2 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 9bafcff3e628..c6d8afb284e8 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -24,16 +24,6 @@
>
> #include "of_private.h"
>
> -const struct of_device_id of_default_bus_match_table[] = {
> - { .compatible = "simple-bus", },
> - { .compatible = "simple-mfd", },
> - { .compatible = "isa", },
> -#ifdef CONFIG_ARM_AMBA
> - { .compatible = "arm,amba-bus", },
> -#endif /* CONFIG_ARM_AMBA */
> - {} /* Empty terminated list */
> -};
> -
> /**
> * of_find_device_by_node - Find the platform_device associated with a node
> * @np: Pointer to device tree node
> @@ -484,8 +474,17 @@ int of_platform_default_populate(struct device_node *root,
> const struct of_dev_auxdata *lookup,
> struct device *parent)
> {
> - return of_platform_populate(root, of_default_bus_match_table, lookup,
> - parent);
> + static const struct of_device_id match_table[] = {
> + { .compatible = "simple-bus", },
> + { .compatible = "simple-mfd", },
> + { .compatible = "isa", },
> +#ifdef CONFIG_ARM_AMBA
> + { .compatible = "arm,amba-bus", },
> +#endif /* CONFIG_ARM_AMBA */
> + {} /* Empty terminated list */
> + };
> +
> + return of_platform_populate(root, match_table, lookup, parent);
> }
> EXPORT_SYMBOL_GPL(of_platform_default_populate);
>
> diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
> index a2ff1ad48f7f..17471ef8e092 100644
> --- a/include/linux/of_platform.h
> +++ b/include/linux/of_platform.h
> @@ -47,8 +47,6 @@ struct of_dev_auxdata {
> { .compatible = _compat, .phys_addr = _phys, .name = _name, \
> .platform_data = _pdata }
>
> -extern const struct of_device_id of_default_bus_match_table[];
> -
> /* Platform drivers register/unregister */
> extern struct platform_device *of_device_alloc(struct device_node *np,
> const char *bus_id,
>
> base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
> --
> https://chromeos.dev
>
© 2016 - 2025 Red Hat, Inc.