Message ID | 20200306132516.D45DC8030700@mail.baikalelectronics.ru |
---|---|
State | New |
Headers | show |
Series | [1/4] dt-bindings: gpio: Replace DW APB GPIO legacy bindings with YAML-based one | expand |
Hi Sergey, thanks for your patch! On Fri, Mar 6, 2020 at 2:25 PM <Sergey.Semin@baikalelectronics.ru> wrote: > /* Optional bus clock */ > - gpio->clk = devm_clk_get(&pdev->dev, "bus"); > - if (!IS_ERR(gpio->clk)) { > - err = clk_prepare_enable(gpio->clk); > - if (err) { > - dev_info(&pdev->dev, "Cannot enable clock\n"); > - return err; > - } > + gpio->clk = devm_clk_get_optional(&pdev->dev, "bus"); > + if (IS_ERR(gpio->clk)) { > + dev_info(&pdev->dev, "Cannot get APB clock\n"); Turn this into dev_err() while you're at it. > + err = clk_prepare_enable(gpio->clk); > + if (err) { > + dev_info(&pdev->dev, "Cannot enable APB clock\n"); Also this. With those changes: Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 92e127e74813..bfa16172f973 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -690,13 +690,16 @@ static int dwapb_gpio_probe(struct platform_device *pdev) return PTR_ERR(gpio->regs); /* Optional bus clock */ - gpio->clk = devm_clk_get(&pdev->dev, "bus"); - if (!IS_ERR(gpio->clk)) { - err = clk_prepare_enable(gpio->clk); - if (err) { - dev_info(&pdev->dev, "Cannot enable clock\n"); - return err; - } + gpio->clk = devm_clk_get_optional(&pdev->dev, "bus"); + if (IS_ERR(gpio->clk)) { + dev_info(&pdev->dev, "Cannot get APB clock\n"); + return PTR_ERR(gpio->clk); + } + + err = clk_prepare_enable(gpio->clk); + if (err) { + dev_info(&pdev->dev, "Cannot enable APB clock\n"); + return err; } gpio->flags = 0; @@ -793,8 +796,7 @@ static int dwapb_gpio_resume(struct device *dev) unsigned long flags; int i; - if (!IS_ERR(gpio->clk)) - clk_prepare_enable(gpio->clk); + clk_prepare_enable(gpio->clk); spin_lock_irqsave(&gc->bgpio_lock, flags); for (i = 0; i < gpio->nr_ports; i++) {