You need to sign in or sign up before continuing.
提交 672de527 编写于 作者: A Andy Shevchenko 提交者: Linus Walleij

gpio: mb86s7x: Use devm_clk_get_optional() to get the input clock

Simplify the code which fetches the input clock by using
devm_clk_get_optional(). If no input clock is present
devm_clk_get_optional() will return NULL instead of an error
which matches the behavior of the old code.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200512182623.54990-1-andriy.shevchenko@linux.intel.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 582838ea
...@@ -168,15 +168,13 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) ...@@ -168,15 +168,13 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
if (IS_ERR(gchip->base)) if (IS_ERR(gchip->base))
return PTR_ERR(gchip->base); return PTR_ERR(gchip->base);
if (!has_acpi_companion(&pdev->dev)) { gchip->clk = devm_clk_get_optional(&pdev->dev, NULL);
gchip->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(gchip->clk))
if (IS_ERR(gchip->clk)) return PTR_ERR(gchip->clk);
return PTR_ERR(gchip->clk);
ret = clk_prepare_enable(gchip->clk);
ret = clk_prepare_enable(gchip->clk); if (ret)
if (ret) return ret;
return ret;
}
spin_lock_init(&gchip->lock); spin_lock_init(&gchip->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册