Skip to contentSkip to conversation

pinctrl: samsung: fix build error without CONFIG_OF_GPIO

PATCH In review Chen Zhou 2 participants 3 messages Dec 12, 2019

Subsystems (3)
lore
Share & tools
lore

Chen Zhou

author
#0 lore raw

PATCH v2 1/1 pinctrl: samsung: fix build error without CONFIG_OF_GPIO

If CONFIG_OF_GPIO is n, build fails:

drivers/pinctrl/samsung/pinctrl-samsung.c: In function samsung_gpiolib_register:
drivers/pinctrl/samsung/pinctrl-samsung.c:969:5: error: struct gpio_chip has no member named of_node
gc->of_node = bank->of_node;

Use #ifdef to guard this.

---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pinctrl/samsung/pinctrl-samsung.c +2 -0
index f26574e..5c29ad8 100644
@@ -966,7 +966,9 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
 		gc->base = bank->grange.base;
 		gc->ngpio = bank->nr_pins;
 		gc->parent = &pdev->dev;
+#ifdef CONFIG_OF_GPIO
 		gc->of_node = bank->of_node;
+#endif
 		gc->label = bank->name;
 
 		ret = devm_gpiochip_add_data(&pdev->dev, gc, bank);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Chen Zhou

If CONFIG_OF_GPIO is n, build fails:

drivers/pinctrl/samsung/pinctrl-samsung.c: In function samsung_gpiolib_register:
drivers/pinctrl/samsung/pinctrl-samsung.c:969:5: error: struct gpio_chip has no member named of_node
gc->of_node = bank->of_node;

Quoted 7 lines

Use #ifdef to guard this.

---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 ++
 1 file changed, 2 insertions(+)

I was thinking about adding OF_GPIO but I could not trigger such case as you mention. How can I reproduce this?

Anyway, the select/dependencies in Kconfig should be fixed up - PINCTRL_SAMSUNG should depend on OF and GPIOLIB.

Best regards,
Krzysztof

#2 lore raw
Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Chen Zhou

If CONFIG_OF_GPIO is n, build fails:

drivers/pinctrl/samsung/pinctrl-samsung.c: In function samsung_gpiolib_register:
drivers/pinctrl/samsung/pinctrl-samsung.c:969:5: error: struct gpio_chip has no member named of_node
gc->of_node = bank->of_node;

Use #ifdef to guard this.

Quoted 8 lines
Quoted 5 lines
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 ++
 1 file changed, 2 insertions(+)

I was thinking about adding OF_GPIO but I could not trigger such case as you mention. How can I reproduce this?

OK, I reproduced it with x86_64 + COMPILE_TEST + PINCTRL_S3C64XX. I'll fix it up with proper dependencies on OF and GPIOLIB. The driver should not have unnecessary ifdefs.

Thanks for the report!

Best regards,
Krzysztof