Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl/rockchip: fix gpio device creation

GPIO nodes are not themselves busses, so passing rockchip_bank_match
here is wrong. Passing NULL instead uses the standard bus match table
which is more appropriate.

devm_of_platform_populate() shows that this is the normal way to call
of_platform_populate() from a device driver, so in order to match that
more closely also add the pinctrl device as the parent for the newly
created GPIO controllers.

Specifically, using the wrong match here can break dynamic GPIO hogs as
marking the GPIO bank as a bus means that of_platform_notify() will set
OF_POPULATED on new child nodes and if this happens before
of_gpio_notify() is called then the new hog will be skipped as
OF_POPULATED is already set.

Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes")
Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20211126151352.1509583-1-john@metanate.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

John Keeping and committed by
Linus Walleij
bceb6732 72f902d8

+1 -1
+1 -1
drivers/pinctrl/pinctrl-rockchip.c
··· 2735 2735 2736 2736 platform_set_drvdata(pdev, info); 2737 2737 2738 - ret = of_platform_populate(np, rockchip_bank_match, NULL, NULL); 2738 + ret = of_platform_populate(np, NULL, NULL, &pdev->dev); 2739 2739 if (ret) 2740 2740 return dev_err_probe(dev, ret, "failed to register gpio device\n"); 2741 2741