Thread (11 messages) 11 messages, 4 authors, 2019-05-24

Re: [PATCH] pinctrl: stmfx: Fix compile issue when CONFIG_OF_GPIO is not defined

From: Amelie DELAUNAY <hidden>
Date: 2019-05-22 08:08:31
Also in: linux-gpio, lkml


On 5/22/19 7:48 AM, Lee Jones wrote:
On Mon, 20 May 2019, Amelie Delaunay wrote:
quoted
When CONFIG_GPIO_OF is not defined, struct gpio_chip 'of_node' member does
not exist:
drivers/pinctrl/pinctrl-stmfx.c: In function 'stmfx_pinctrl_probe':
drivers/pinctrl/pinctrl-stmfx.c:652:17: error: 'struct gpio_chip' has no member named 'of_node'
      pctl->gpio_chip.of_node = np;

Fixes: 1490d9f841b1 ("pinctrl: Add STMFX GPIO expander Pinctrl/GPIO driver")
Reported-by: kbuild test robot <redacted>
Signed-off-by: Amelie Delaunay <redacted>
---
  drivers/pinctrl/pinctrl-stmfx.c | 2 ++
  1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index eba872c..bb64aa0 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -648,7 +648,9 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
  	pctl->gpio_chip.base = -1;
  	pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
  	pctl->gpio_chip.can_sleep = true;
+#ifdef CONFIG_OF_GPIO
  	pctl->gpio_chip.of_node = np;
+#endif
This is pretty ugly.  Will STMFX ever be used without OF support?  If
not, it might be better to place this restriction on the driver as a
whole.

Incidentally, why is this blanked out in the structure definition?
Even 'struct device' doesn't do this.
config PINCTRL_STMFX
	tristate "STMicroelectronics STMFX GPIO expander pinctrl driver"
	depends on I2C
	depends on OF || COMPILE_TEST
	select GENERIC_PINCONF
	select GPIOLIB_IRQCHIP
	select MFD_STMFX

The issue is due to COMPILE_TEST: would "depends on OF || (OF && 
COMPILE_TEST)" be better ?
quoted
  	pctl->gpio_chip.need_valid_mask = true;
  
  	ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help