]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
gpio: mxc: add check to return defer probe if clock tree NOT ready
authorAnson Huang <anson.huang@nxp.com>
Sat, 23 Feb 2019 03:18:25 +0000 (03:18 +0000)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 25 Feb 2019 12:42:46 +0000 (13:42 +0100)
On i.MX8MQ platform, clock driver uses platform driver
model and it is probed after GPIO driver, so when GPIO
driver fails to get clock, it should check the error type
to decide whether to return defer probe or just ignore
the clock operation.

Fixes: 2808801aab8a ("gpio: mxc: add clock operation")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mxc.c

index 2d1dfa1e07456269f303d55793c56bfea3f0b530..e86e61dda4b757fa04c3616aab6c7ffb14554a53 100644 (file)
@@ -438,8 +438,11 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 
        /* the controller clock is optional */
        port->clk = devm_clk_get(&pdev->dev, NULL);
-       if (IS_ERR(port->clk))
+       if (IS_ERR(port->clk)) {
+               if (PTR_ERR(port->clk) == -EPROBE_DEFER)
+                       return -EPROBE_DEFER;
                port->clk = NULL;
+       }
 
        err = clk_prepare_enable(port->clk);
        if (err) {