linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
@ 2024-09-30 11:51 Bartosz Golaszewski
  2024-09-30 11:51 ` [PATCH 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
  2024-10-01  2:24 ` [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 11:51 UTC (permalink / raw)
  To: Keerthy, Linus Walleij; +Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Make it possible to build the module when COMPILE_TEST is enabled for
better build coverage.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 643747da4475..746f2a8f3106 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -243,7 +243,7 @@ config GPIO_CLPS711X
 config GPIO_DAVINCI
 	tristate "TI Davinci/Keystone GPIO support"
 	default y if ARCH_DAVINCI
-	depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)
+	depends on ((ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)) || COMPILE_TEST
 	help
 	  Say yes here to enable GPIO support for TI Davinci/Keystone SoCs.
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gpio: davinci: use generic device properties
  2024-09-30 11:51 [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
@ 2024-09-30 11:51 ` Bartosz Golaszewski
  2024-10-01  2:24 ` [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 11:51 UTC (permalink / raw)
  To: Keerthy, Linus Walleij; +Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

OF-specific routines should not be used unless necessary. Generic device
properties are preferred so switch to using them in the driver code.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-davinci.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index b54fef6b1e12..603893816b32 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -15,7 +15,6 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
@@ -159,14 +158,13 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 	unsigned int ngpio, nbank, nirq, gpio_unbanked;
 	struct davinci_gpio_controller *chips;
 	struct device *dev = &pdev->dev;
-	struct device_node *dn = dev_of_node(dev);
 
 	/*
 	 * The gpio banks conceptually expose a segmented bitmap,
 	 * and "ngpio" is one more than the largest zero-based
 	 * bit index that's valid.
 	 */
-	ret = of_property_read_u32(dn, "ti,ngpio", &ngpio);
+	ret = device_property_read_u32(dev, "ti,ngpio", &ngpio);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get the number of GPIOs\n");
 	if (ngpio == 0)
@@ -177,8 +175,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 	 * interrupts is equal to number of gpios else all are banked so
 	 * number of interrupts is equal to number of banks(each with 16 gpios)
 	 */
-	ret = of_property_read_u32(dn, "ti,davinci-gpio-unbanked",
-				   &gpio_unbanked);
+	ret = device_property_read_u32(dev, "ti,davinci-gpio-unbanked",
+				       &gpio_unbanked);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to get the unbanked GPIOs property\n");
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
  2024-09-30 11:51 [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
  2024-09-30 11:51 ` [PATCH 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
@ 2024-10-01  2:24 ` kernel test robot
  2024-10-01  9:17   ` Bartosz Golaszewski
  1 sibling, 1 reply; 5+ messages in thread
From: kernel test robot @ 2024-10-01  2:24 UTC (permalink / raw)
  To: Bartosz Golaszewski, Keerthy, Linus Walleij
  Cc: oe-kbuild-all, linux-kernel, linux-gpio, Bartosz Golaszewski

Hi Bartosz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brgl/gpio/for-next]
[also build test WARNING on linus/master v6.12-rc1 next-20240930]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-davinci-use-generic-device-properties/20240930-195251
base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link:    https://lore.kernel.org/r/20240930115116.54626-1-brgl%40bgdev.pl
patch subject: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
config: sh-randconfig-002-20241001 (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-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/202410011000.hRJ0JPdV-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-davinci.c:652:34: warning: 'davinci_gpio_ids' defined but not used [-Wunused-const-variable=]
     652 | static const struct of_device_id davinci_gpio_ids[] = {
         |                                  ^~~~~~~~~~~~~~~~


vim +/davinci_gpio_ids +652 drivers/gpio/gpio-davinci.c

0651a730924b17 Devarsh Thakkar   2022-06-13  648  
8507f35447e6e5 Min-Hua Chen      2023-06-09  649  static DEFINE_SIMPLE_DEV_PM_OPS(davinci_gpio_dev_pm_ops, davinci_gpio_suspend,
0651a730924b17 Devarsh Thakkar   2022-06-13  650  			 davinci_gpio_resume);
0651a730924b17 Devarsh Thakkar   2022-06-13  651  
c770844c3e30be KV Sujith         2013-11-21 @652  static const struct of_device_id davinci_gpio_ids[] = {
0c6feb0796ea64 Grygorii Strashko 2014-02-13  653  	{ .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip},
6a4d8b6bd27932 Keerthy           2019-06-05  654  	{ .compatible = "ti,am654-gpio", keystone_gpio_get_irq_chip},
0c6feb0796ea64 Grygorii Strashko 2014-02-13  655  	{ .compatible = "ti,dm6441-gpio", davinci_gpio_get_irq_chip},
c770844c3e30be KV Sujith         2013-11-21  656  	{ /* sentinel */ },
c770844c3e30be KV Sujith         2013-11-21  657  };
c770844c3e30be KV Sujith         2013-11-21  658  MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
c770844c3e30be KV Sujith         2013-11-21  659  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
  2024-10-01  2:24 ` [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y kernel test robot
@ 2024-10-01  9:17   ` Bartosz Golaszewski
  2024-10-01 13:56     ` Andrew Davis
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-10-01  9:17 UTC (permalink / raw)
  To: kernel test robot
  Cc: Keerthy, Linus Walleij, oe-kbuild-all, linux-kernel, linux-gpio,
	Bartosz Golaszewski

On Tue, Oct 1, 2024 at 4:35 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Bartosz,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on brgl/gpio/for-next]
> [also build test WARNING on linus/master v6.12-rc1 next-20240930]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-davinci-use-generic-device-properties/20240930-195251
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
> patch link:    https://lore.kernel.org/r/20240930115116.54626-1-brgl%40bgdev.pl
> patch subject: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
> config: sh-randconfig-002-20241001 (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-lkp@intel.com/config)
> compiler: sh4-linux-gcc (GCC) 14.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-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/202410011000.hRJ0JPdV-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/gpio/gpio-davinci.c:652:34: warning: 'davinci_gpio_ids' defined but not used [-Wunused-const-variable=]
>      652 | static const struct of_device_id davinci_gpio_ids[] = {
>          |                                  ^~~~~~~~~~~~~~~~
>

Weird, this doesn't happen on x86 defconfig with OF disabled and W=1...

Bart

>
> vim +/davinci_gpio_ids +652 drivers/gpio/gpio-davinci.c
>
> 0651a730924b17 Devarsh Thakkar   2022-06-13  648
> 8507f35447e6e5 Min-Hua Chen      2023-06-09  649  static DEFINE_SIMPLE_DEV_PM_OPS(davinci_gpio_dev_pm_ops, davinci_gpio_suspend,
> 0651a730924b17 Devarsh Thakkar   2022-06-13  650                         davinci_gpio_resume);
> 0651a730924b17 Devarsh Thakkar   2022-06-13  651
> c770844c3e30be KV Sujith         2013-11-21 @652  static const struct of_device_id davinci_gpio_ids[] = {
> 0c6feb0796ea64 Grygorii Strashko 2014-02-13  653        { .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip},
> 6a4d8b6bd27932 Keerthy           2019-06-05  654        { .compatible = "ti,am654-gpio", keystone_gpio_get_irq_chip},
> 0c6feb0796ea64 Grygorii Strashko 2014-02-13  655        { .compatible = "ti,dm6441-gpio", davinci_gpio_get_irq_chip},
> c770844c3e30be KV Sujith         2013-11-21  656        { /* sentinel */ },
> c770844c3e30be KV Sujith         2013-11-21  657  };
> c770844c3e30be KV Sujith         2013-11-21  658  MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
> c770844c3e30be KV Sujith         2013-11-21  659
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
  2024-10-01  9:17   ` Bartosz Golaszewski
@ 2024-10-01 13:56     ` Andrew Davis
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Davis @ 2024-10-01 13:56 UTC (permalink / raw)
  To: Bartosz Golaszewski, kernel test robot
  Cc: Keerthy, Linus Walleij, oe-kbuild-all, linux-kernel, linux-gpio,
	Bartosz Golaszewski

On 10/1/24 4:17 AM, Bartosz Golaszewski wrote:
> On Tue, Oct 1, 2024 at 4:35 AM kernel test robot <lkp@intel.com> wrote:
>>
>> Hi Bartosz,
>>
>> kernel test robot noticed the following build warnings:
>>
>> [auto build test WARNING on brgl/gpio/for-next]
>> [also build test WARNING on linus/master v6.12-rc1 next-20240930]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>
>> url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-davinci-use-generic-device-properties/20240930-195251
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
>> patch link:    https://lore.kernel.org/r/20240930115116.54626-1-brgl%40bgdev.pl
>> patch subject: [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
>> config: sh-randconfig-002-20241001 (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-lkp@intel.com/config)
>> compiler: sh4-linux-gcc (GCC) 14.1.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241001/202410011000.hRJ0JPdV-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/202410011000.hRJ0JPdV-lkp@intel.com/
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> drivers/gpio/gpio-davinci.c:652:34: warning: 'davinci_gpio_ids' defined but not used [-Wunused-const-variable=]
>>       652 | static const struct of_device_id davinci_gpio_ids[] = {
>>           |                                  ^~~~~~~~~~~~~~~~
>>
> 
> Weird, this doesn't happen on x86 defconfig with OF disabled and W=1...
> 

Use of `of_match_ptr` needs removed here. All drivers where their
of_device_id table is not conditionally defined based on CONFIG_OF
need that helper function removed. There are a lot of instances
of this issue..

Andrew

> Bart
> 
>>
>> vim +/davinci_gpio_ids +652 drivers/gpio/gpio-davinci.c
>>
>> 0651a730924b17 Devarsh Thakkar   2022-06-13  648
>> 8507f35447e6e5 Min-Hua Chen      2023-06-09  649  static DEFINE_SIMPLE_DEV_PM_OPS(davinci_gpio_dev_pm_ops, davinci_gpio_suspend,
>> 0651a730924b17 Devarsh Thakkar   2022-06-13  650                         davinci_gpio_resume);
>> 0651a730924b17 Devarsh Thakkar   2022-06-13  651
>> c770844c3e30be KV Sujith         2013-11-21 @652  static const struct of_device_id davinci_gpio_ids[] = {
>> 0c6feb0796ea64 Grygorii Strashko 2014-02-13  653        { .compatible = "ti,keystone-gpio", keystone_gpio_get_irq_chip},
>> 6a4d8b6bd27932 Keerthy           2019-06-05  654        { .compatible = "ti,am654-gpio", keystone_gpio_get_irq_chip},
>> 0c6feb0796ea64 Grygorii Strashko 2014-02-13  655        { .compatible = "ti,dm6441-gpio", davinci_gpio_get_irq_chip},
>> c770844c3e30be KV Sujith         2013-11-21  656        { /* sentinel */ },
>> c770844c3e30be KV Sujith         2013-11-21  657  };
>> c770844c3e30be KV Sujith         2013-11-21  658  MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
>> c770844c3e30be KV Sujith         2013-11-21  659
>>
>> --
>> 0-DAY CI Kernel Test Service
>> https://github.com/intel/lkp-tests/wiki
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-01 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 11:51 [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
2024-09-30 11:51 ` [PATCH 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
2024-10-01  2:24 ` [PATCH 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y kernel test robot
2024-10-01  9:17   ` Bartosz Golaszewski
2024-10-01 13:56     ` Andrew Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).