Skip to content

Commit 24c9406

Browse files
masneybBartosz Golaszewski
authored andcommitted
gpiolib: ensure that fwnode is properly set
Note that this is a RFC patch and not meant to be merged. I looked into a problem with linux-next-20221110 on the Qualcomm SA8540P automotive board (sc8280xp) where the UFS host controller would fail to probe due to repeated probe deferrals when trying to get reset-gpios via devm_gpiod_get_optional(). of_get_named_gpiod_flags() returns -EPROBE_DEFER, which is caused by of_gpiochip_match_node_and_xlate() returning 0 since the of_xlate function pointer is not set for the qcom,sc8280xp-tlmm pinctrl driver. The pinctrl driver doesn't define one, so of_gpiochip_add() should automatically setup of_gpio_simple_xlate() on it's behalf. This doesn't happen since the fwnode member on the struct gpiochip is set to null when of_gpiochip_add() is called. Let's work around this by ensuring that it's set if available. Note that this broke sometime within the last few weeks within linux-next and I haven't bisected this. I'm posting this in the hopes that someone may know offhand which patch(es) may have broken this. Signed-off-by: Brian Masney <[email protected]> Tested-by: Marijn Suijten <[email protected]> Tested-by: Konrad Dybcio <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> #Lenovo Thinkpad X13s Tested-by: Neil Armstrong <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 739be9b commit 24c9406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpiolib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
679679
* Assign fwnode depending on the result of the previous calls,
680680
* if none of them succeed, assign it to the parent's one.
681681
*/
682-
gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
682+
gc->fwnode = gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
683683

684684
gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL);
685685
if (gdev->id < 0) {

0 commit comments

Comments
 (0)