[PATCH] Input: twl4030 - fix warnings without CONFIG_OF

Andreas Kemnade posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
drivers/input/misc/twl4030-pwrbutton.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] Input: twl4030 - fix warnings without CONFIG_OF
Posted by Andreas Kemnade 1 month, 2 weeks ago
There are unused variables without CONFIG_OF:
drivers/input/misc/twl4030-pwrbutton.c:41:44: error: unused variable 'twl4030_chipdata' [-Werror,-Wunused-const-variable]
   41 | static const struct twl_pwrbutton_chipdata twl4030_chipdata = {
      |                                            ^~~~~~~~~~~~~~~~
drivers/input/misc/twl4030-pwrbutton.c:46:44: error: unused variable 'twl6030_chipdata' [-Werror,-Wunused-const-variable]
   46 | static const struct twl_pwrbutton_chipdata twl6030_chipdata = {

Fix that by avoiding some #ifdef CONFIG_OF

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512220251.jDE8tKup-lkp@intel.com/
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/input/misc/twl4030-pwrbutton.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index d82a3fb28d95..7468d0d3e97a 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -132,7 +132,6 @@ static void twl4030_pwrbutton_remove(struct platform_device *pdev)
 	}
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
 	{
 		.compatible = "ti,twl4030-pwrbutton",
@@ -145,7 +144,6 @@ static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
-#endif
 
 static struct platform_driver twl4030_pwrbutton_driver = {
 	.probe		= twl4030_pwrbutton_probe,
-- 
2.47.3
Re: [PATCH] Input: twl4030 - fix warnings without CONFIG_OF
Posted by Dmitry Torokhov 1 month, 1 week ago
Hi Andreas,

On Mon, Dec 22, 2025 at 03:42:49PM +0100, Andreas Kemnade wrote:
> There are unused variables without CONFIG_OF:
> drivers/input/misc/twl4030-pwrbutton.c:41:44: error: unused variable 'twl4030_chipdata' [-Werror,-Wunused-const-variable]
>    41 | static const struct twl_pwrbutton_chipdata twl4030_chipdata = {
>       |                                            ^~~~~~~~~~~~~~~~
> drivers/input/misc/twl4030-pwrbutton.c:46:44: error: unused variable 'twl6030_chipdata' [-Werror,-Wunused-const-variable]
>    46 | static const struct twl_pwrbutton_chipdata twl6030_chipdata = {
> 
> Fix that by avoiding some #ifdef CONFIG_OF
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512220251.jDE8tKup-lkp@intel.com/
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  drivers/input/misc/twl4030-pwrbutton.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> index d82a3fb28d95..7468d0d3e97a 100644
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ b/drivers/input/misc/twl4030-pwrbutton.c
> @@ -132,7 +132,6 @@ static void twl4030_pwrbutton_remove(struct platform_device *pdev)
>  	}
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
>  	{
>  		.compatible = "ti,twl4030-pwrbutton",
> @@ -145,7 +144,6 @@ static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> -#endif

I think you should also remove use of of_match_ptr() and replace include
of.h with mod_devicetable.h.

Thanks.

-- 
Dmitry