Skip to contentSkip to conversation

gpio: davinci: allow building the module with COMPILE_TEST=y

PATCH Applied Bartosz Golaszewski 2 participants 5 messages Oct 7, 2024 – Oct 14, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 gpio: davinci: allow building the module with COMPILE_TEST=y

From: Bartosz Golaszewski <[email protected]>

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.

---
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(-)
drivers/gpio/Kconfig +1 -1
index d93cd4f722b4..54770c917638 100644
@@ -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.
 
drivers/gpio/gpio-davinci.c +1 -1
index 76b58c70b257..1da1d7c7ac2d 100644
@@ -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,
 	},
 };
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 gpio: davinci: use generic device properties

From: Bartosz Golaszewski <[email protected]>

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

---
 drivers/gpio/gpio-davinci.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpio/gpio-davinci.c +3 -5
index 1da1d7c7ac2d..8c033e8cf3c9 100644
@@ -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");
 
Signature · 1 line
2.43.0
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] gpio: davinci: use generic device properties

In reply to Bartosz Golaszewski
Quoted 6 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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

Yours,
Linus Walleij

author Applied
#4 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 4 lines · Bartosz Golaszewski

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,

Signature · 1 line
Bartosz Golaszewski <[email protected]>