Skip to contentSkip to conversation

gpio: altera: Add missed base and label initialisations

PATCH Applied Andy Shevchenko 2 participants 2 messages Nov 18, 2024 – Nov 21, 2024

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

PATCH v2 1/1 gpio: altera: Add missed base and label initialisations

During conversion driver to modern APIs the base field initial value of the GPIO chip was moved from -1 to 0, which triggers a warning. Add missed base initialisation as it was in the original code.

Initialise the GPIO chip label correctly as it was done by of_mm_gpiochip_add_data() before the below mentioned change.

Fixes 50dded8d9d62 ("gpio: altera: Drop legacy-of-mm-gpiochip.h header")

---
v2: explained why label should be initialised (Bart)

 drivers/gpio/gpio-altera.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpio/gpio-altera.c +5 -0
index 039fef26546e..73e660c5e38a 100644
@@ -261,6 +261,11 @@ static int altera_gpio_probe(struct platform_device *pdev)
 	altera_gc->gc.set		= altera_gpio_set;
 	altera_gc->gc.owner		= THIS_MODULE;
 	altera_gc->gc.parent		= &pdev->dev;
+	altera_gc->gc.base		= -1;
+
+	altera_gc->gc.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
+	if (!altera_gc->gc.label)
+		return -ENOMEM;
 
 	altera_gc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(altera_gc->regs))
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw

From: Bartosz Golaszewski <[email protected]>

Quoted 8 lines · Andy Shevchenko

During conversion driver to modern APIs the base field initial value of the GPIO chip was moved from -1 to 0, which triggers a warning. Add missed base initialisation as it was in the original code.

Initialise the GPIO chip label correctly as it was done by of_mm_gpiochip_add_data() before the below mentioned change.

[...]

Applied, thanks!

[1/1] gpio: altera: Add missed base and label initialisations

      commit: c7899503ad9c06a0c6ee2796301139731cf1f5ab

Best regards,

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