Skip to contentSkip to conversation

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

PATCH Applied Bartosz Golaszewski 2 participants 5 messages Sep 30, 2024 – Oct 8, 2024

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

PATCH 1/2 gpio: mvebu: 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.

---
 drivers/gpio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
index d93cd4f722b4..98722e814e81 100644
@@ -487,7 +487,7 @@ config GPIO_MT7621
 
 config GPIO_MVEBU
 	def_bool y
-	depends on PLAT_ORION || ARCH_MVEBU
+	depends on PLAT_ORION || ARCH_MVEBU || COMPILE_TEST
 	depends on OF_GPIO
 	select GENERIC_IRQ_CHIP
 	select REGMAP_MMIO
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 gpio: mvebu: 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-mvebu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mvebu.c +4 -4
index 8cfd3a89c018..5ffb332e9849 100644
@@ -794,8 +794,8 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 	u32 set;
 
 	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
-		int ret = of_property_read_u32(dev->of_node,
-					       "marvell,pwm-offset", &offset);
+		int ret = device_property_read_u32(dev, "marvell,pwm-offset",
+						   &offset);
 		if (ret < 0)
 			return 0;
 	} else {
@@ -1106,7 +1106,7 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
 	if (IS_ERR(mvchip->regs))
 		return PTR_ERR(mvchip->regs);
 
-	if (of_property_read_u32(pdev->dev.of_node, "offset", &mvchip->offset))
+	if (device_property_read_u32(&pdev->dev, "offset", &mvchip->offset))
 		return -EINVAL;
 
 	return 0;
@@ -1147,7 +1147,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mvchip);
 
-	if (of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios)) {
+	if (device_property_read_u32(&pdev->dev, "ngpios", &ngpios)) {
 		dev_err(&pdev->dev, "Missing ngpios OF property\n");
 		return -ENODEV;
 	}
Signature · 1 line
2.43.0
#2 lore raw

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

Hello Bart,

Quoted 25 lines · Bartosz Golaszewski
drivers/gpio/gpio-mvebu.c +3 -3
index 8cfd3a89c018..5ffb332e9849 100644
@@ -794,8 +794,8 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 	u32 set;
 
 	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
-		int ret = of_property_read_u32(dev->of_node,
-					       "marvell,pwm-offset", &offset);
+		int ret = device_property_read_u32(dev, "marvell,pwm-offset",
+						   &offset);
 		if (ret < 0)
 			return 0;
 	} else {
@@ -1106,7 +1106,7 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
 	if (IS_ERR(mvchip->regs))
 		return PTR_ERR(mvchip->regs);
 
-	if (of_property_read_u32(pdev->dev.of_node, "offset", &mvchip->offset))
+	if (device_property_read_u32(&pdev->dev, "offset", &mvchip->offset))
 		return -EINVAL;
 
 	return 0;

drivers/gpio/gpio-mvebu.c static int mvebu_gpio_probe(struct platform_device *pdev) · line 1153

Quoted 8 lines
drivers/gpio/gpio-mvebu.c +1 -1
@@ -1147,7 +1147,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mvchip);
 
-	if (of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios)) {
+	if (device_property_read_u32(&pdev->dev, "ngpios", &ngpios)) {
 		dev_err(&pdev->dev, "Missing ngpios OF property\n");
 		return -ENODEV;
 	}

I didn't look closely, but I wonder if GPIO_MVEBU depending on OF_GPIO can be softened with this change?!

Best regards
Uwe

#3 lore raw

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

Quoted 4 lines · Uwe Kleine-König

I didn't look closely, but I wonder if GPIO_MVEBU depending on OF_GPIO can be softened with this change?!

Yes, this can be done in a follow-up patch.

Bart

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.

Applied, thanks!

[1/2] gpio: mvebu: allow building the module with COMPILE_TEST=y

      commit: 956ee0c5c969c9caf6744e166f5a80526be10c5b
[2/2] gpio: mvebu: use generic device properties
      commit: ddfdfe76ca54e5615a8e3eefd7dbe44c624ee9fa

Best regards,

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