Skip to content

Commit 9e0fa5d

Browse files
Li ZetaoBartosz Golaszewski
authored andcommitted
gpio: mxc: Use helper function devm_clk_get_optional_enabled()
Since commit 7ef9651 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get_optional() and clk_prepare_enable() can now be replaced by devm_clk_get_optional_enabled() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 82dbbfd commit 9e0fa5d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

drivers/gpio/gpio-mxc.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,16 +452,10 @@ static int mxc_gpio_probe(struct platform_device *pdev)
452452
return port->irq;
453453

454454
/* the controller clock is optional */
455-
port->clk = devm_clk_get_optional(&pdev->dev, NULL);
455+
port->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
456456
if (IS_ERR(port->clk))
457457
return PTR_ERR(port->clk);
458458

459-
err = clk_prepare_enable(port->clk);
460-
if (err) {
461-
dev_err(&pdev->dev, "Unable to enable clock.\n");
462-
return err;
463-
}
464-
465459
if (of_device_is_compatible(np, "fsl,imx7d-gpio"))
466460
port->power_off = true;
467461

@@ -535,7 +529,6 @@ static int mxc_gpio_probe(struct platform_device *pdev)
535529
out_bgio:
536530
pm_runtime_disable(&pdev->dev);
537531
pm_runtime_put_noidle(&pdev->dev);
538-
clk_disable_unprepare(port->clk);
539532
dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err);
540533
return err;
541534
}

0 commit comments

Comments
 (0)