[PATCH] of: Hide of_default_bus_match_table[]

Stephen Boyd posted 1 patch 1 year ago
There is a newer version of this series
drivers/of/platform.c       | 2 +-
include/linux/of_platform.h | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
[PATCH] of: Hide of_default_bus_match_table[]
Posted by Stephen Boyd 1 year ago
This isn't used outside this file. Hide the array in the C file.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/of/platform.c       | 2 +-
 include/linux/of_platform.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9bafcff3e628..f09dc183975b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -24,7 +24,7 @@
 
 #include "of_private.h"
 
-const struct of_device_id of_default_bus_match_table[] = {
+static const struct of_device_id of_default_bus_match_table[] = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "simple-mfd", },
 	{ .compatible = "isa", },
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
Re: [PATCH] of: Hide of_default_bus_match_table[]
Posted by kernel test robot 1 year ago
Hi Stephen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 40384c840ea1944d7c5a392e8975ed088ecf0b37]

url:    https://github.com/intel-lab-lkp/linux/commits/Stephen-Boyd/of-Hide-of_default_bus_match_table/20241204-123701
base:   40384c840ea1944d7c5a392e8975ed088ecf0b37
patch link:    https://lore.kernel.org/r/20241204000415.2404264-1-swboyd%40chromium.org
patch subject: [PATCH] of: Hide of_default_bus_match_table[]
config: sparc-allnoconfig (https://download.01.org/0day-ci/archive/20241204/202412041839.pjv6awcS-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241204/202412041839.pjv6awcS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412041839.pjv6awcS-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/of/platform.c:27:34: warning: 'of_default_bus_match_table' defined but not used [-Wunused-const-variable=]
      27 | static const struct of_device_id of_default_bus_match_table[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/of_default_bus_match_table +27 drivers/of/platform.c

    26	
  > 27	static const struct of_device_id of_default_bus_match_table[] = {
    28		{ .compatible = "simple-bus", },
    29		{ .compatible = "simple-mfd", },
    30		{ .compatible = "isa", },
    31	#ifdef CONFIG_ARM_AMBA
    32		{ .compatible = "arm,amba-bus", },
    33	#endif /* CONFIG_ARM_AMBA */
    34		{} /* Empty terminated list */
    35	};
    36	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] of: Hide of_default_bus_match_table[]
Posted by Stephen Boyd 1 year ago
Quoting kernel test robot (2024-12-04 03:00:44)
> Hi Stephen,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 40384c840ea1944d7c5a392e8975ed088ecf0b37]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Stephen-Boyd/of-Hide-of_default_bus_match_table/20241204-123701
> base:   40384c840ea1944d7c5a392e8975ed088ecf0b37
> patch link:    https://lore.kernel.org/r/20241204000415.2404264-1-swboyd%40chromium.org
> patch subject: [PATCH] of: Hide of_default_bus_match_table[]
> config: sparc-allnoconfig (https://download.01.org/0day-ci/archive/20241204/202412041839.pjv6awcS-lkp@intel.com/config)
> compiler: sparc-linux-gcc (GCC) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241204/202412041839.pjv6awcS-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202412041839.pjv6awcS-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/of/platform.c:27:34: warning: 'of_default_bus_match_table' defined but not used [-Wunused-const-variable=]
>       27 | static const struct of_device_id of_default_bus_match_table[] = {
>          |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~

I will move the array into the function that uses it then.
Re: [PATCH] of: Hide of_default_bus_match_table[]
Posted by Saravana Kannan 1 year ago
On Tue, Dec 3, 2024 at 4:04 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> This isn't used outside this file. Hide the array in the C file.
>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Acked-by: Saravana Kannan <saravanak@google.com>

> ---
>  drivers/of/platform.c       | 2 +-
>  include/linux/of_platform.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 9bafcff3e628..f09dc183975b 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -24,7 +24,7 @@
>
>  #include "of_private.h"
>
> -const struct of_device_id of_default_bus_match_table[] = {
> +static const struct of_device_id of_default_bus_match_table[] = {
>         { .compatible = "simple-bus", },
>         { .compatible = "simple-mfd", },
>         { .compatible = "isa", },
> 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
>