pinctrl: core: Do not add device links for hogs
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 23 May 2019 22:11:43 +0000 (00:11 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 24 May 2019 08:08:04 +0000 (10:08 +0200)
Hogs would create circular device links, so do not link
the device to itself.

Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/core.c

index d757c51..41adb4e 100644 (file)
@@ -1271,7 +1271,9 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
                        goto unapply_new_state;
                }
 
-               pinctrl_link_add(setting->pctldev, p->dev);
+               /* Do not link hogs (circular dependency) */
+               if (p != setting->pctldev->p)
+                       pinctrl_link_add(setting->pctldev, p->dev);
        }
 
        p->state = state;