public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
@ 2024-10-07 10:34 Bartosz Golaszewski
  2024-10-07 10:34 ` [PATCH v2 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-10-07 10:34 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. Stop using of_match_ptr() to avoid build warnings.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Changes in v2:
- stop using of_match_ptr()

 drivers/gpio/Kconfig        | 2 +-
 drivers/gpio/gpio-davinci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d93cd4f722b4..54770c917638 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.
 
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 76b58c70b257..1da1d7c7ac2d 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -662,7 +662,7 @@ static struct platform_driver davinci_gpio_driver = {
 	.driver		= {
 		.name		= "davinci_gpio",
 		.pm = pm_sleep_ptr(&davinci_gpio_dev_pm_ops),
-		.of_match_table	= of_match_ptr(davinci_gpio_ids),
+		.of_match_table	= davinci_gpio_ids,
 	},
 };
 
-- 
2.43.0


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

* [PATCH v2 2/2] gpio: davinci: use generic device properties
  2024-10-07 10:34 [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
@ 2024-10-07 10:34 ` Bartosz Golaszewski
  2024-10-11 19:43   ` Linus Walleij
  2024-10-11 19:43 ` [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Linus Walleij
  2024-10-14  8:31 ` Bartosz Golaszewski
  2 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-10-07 10:34 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 1da1d7c7ac2d..8c033e8cf3c9 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 v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
  2024-10-07 10:34 [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
  2024-10-07 10:34 ` [PATCH v2 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
@ 2024-10-11 19:43 ` Linus Walleij
  2024-10-14  8:31 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2024-10-11 19:43 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Keerthy, linux-kernel, linux-gpio, Bartosz Golaszewski

On Mon, Oct 7, 2024 at 12:34 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Make it possible to build the module when COMPILE_TEST is enabled for
> better build coverage. Stop using of_match_ptr() to avoid build warnings.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v2 2/2] gpio: davinci: use generic device properties
  2024-10-07 10:34 ` [PATCH v2 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
@ 2024-10-11 19:43   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2024-10-11 19:43 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Keerthy, linux-kernel, linux-gpio, Bartosz Golaszewski

On Mon, Oct 7, 2024 at 12:34 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> 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>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
  2024-10-07 10:34 [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
  2024-10-07 10:34 ` [PATCH v2 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
  2024-10-11 19:43 ` [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Linus Walleij
@ 2024-10-14  8:31 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-10-14  8:31 UTC (permalink / raw)
  To: Keerthy, Linus Walleij, Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-kernel, linux-gpio

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


On Mon, 07 Oct 2024 12:34:39 +0200, Bartosz Golaszewski wrote:
> Make it possible to build the module when COMPILE_TEST is enabled for
> better build coverage. Stop using of_match_ptr() to avoid build warnings.
> 
> 

Applied, thanks!

[1/2] gpio: davinci: allow building the module with COMPILE_TEST=y
      commit: 56d6ff4b8faf1c2d5c850ed8b4e5dfa6cd81413b
[2/2] gpio: davinci: use generic device properties
      commit: 5dfdcd9e73119dcb60b0299e96d2d84d23c354fd

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

end of thread, other threads:[~2024-10-14  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 10:34 [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
2024-10-07 10:34 ` [PATCH v2 2/2] gpio: davinci: use generic device properties Bartosz Golaszewski
2024-10-11 19:43   ` Linus Walleij
2024-10-11 19:43 ` [PATCH v2 1/2] gpio: davinci: allow building the module with COMPILE_TEST=y Linus Walleij
2024-10-14  8:31 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox