Skip to contentSkip to conversation

gpio: mxc: add check to return defer probe if clock tree NOT ready

PATCH In review Anson Huang 2 participants 2 messages Feb 23, 2019 – Feb 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: mxc: add check to return defer probe if clock tree NOT ready

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")
---
 drivers/gpio/gpio-mxc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mxc.c +4 -1
index 2d1dfa1..e86e61d 100644
@@ -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) {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Anson Huang

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")

Patch applied.

Yours,
Linus Walleij