diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-05-12 21:26:22 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-05-18 10:15:16 +0300 |
commit | 672de5274446fd41167953528da3426805652c1a (patch) | |
tree | 2130ec6e3346d3ed97a39c3a32852ce253dc914c /drivers/gpio/gpio-mb86s7x.c | |
parent | 582838ea5bea41258d136c82a6c493a95cda652c (diff) | |
download | linux-672de5274446fd41167953528da3426805652c1a.tar.xz |
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200512182623.54990-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mb86s7x.c')
-rw-r--r-- | drivers/gpio/gpio-mb86s7x.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 501e89548f53..3be2e56f7c43 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -168,15 +168,13 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) if (IS_ERR(gchip->base)) return PTR_ERR(gchip->base); - if (!has_acpi_companion(&pdev->dev)) { - gchip->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(gchip->clk)) - return PTR_ERR(gchip->clk); - - ret = clk_prepare_enable(gchip->clk); - if (ret) - return ret; - } + gchip->clk = devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(gchip->clk)) + return PTR_ERR(gchip->clk); + + ret = clk_prepare_enable(gchip->clk); + if (ret) + return ret; spin_lock_init(&gchip->lock); |