Commit 9e0fa5d8 authored by Li Zetao's avatar Li Zetao Committed by Bartosz Golaszewski
Browse files

gpio: mxc: Use helper function devm_clk_get_optional_enabled()



Since commit 7ef9651e ("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: default avatarLi Zetao <lizetao1@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 82dbbfdf
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -452,16 +452,10 @@ static int mxc_gpio_probe(struct platform_device *pdev)
		return port->irq;

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

	err = clk_prepare_enable(port->clk);
	if (err) {
		dev_err(&pdev->dev, "Unable to enable clock.\n");
		return err;
	}

	if (of_device_is_compatible(np, "fsl,imx7d-gpio"))
		port->power_off = true;

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