Skip to content

Commit 9eca012

Browse files
krzkjic23
authored andcommitted
iio: dac: vf610: Simplify with devm_clk_get_enabled()
Driver is getting clock and almost immediately enabling it, with no relevant code executed between, thus the probe path and cleanups can be simplified with devm_clk_get_enabled(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250713-iio-clk-get-enabled-v1-4-70abc1f9ce6c@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 89ef9c6 commit 9eca012

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

drivers/iio/dac/vf610_dac.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static int vf610_dac_probe(struct platform_device *pdev)
188188
if (IS_ERR(info->regs))
189189
return PTR_ERR(info->regs);
190190

191-
info->clk = devm_clk_get(&pdev->dev, "dac");
191+
info->clk = devm_clk_get_enabled(&pdev->dev, "dac");
192192
if (IS_ERR(info->clk))
193193
return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
194194
"Failed getting clock\n");
@@ -203,13 +203,6 @@ static int vf610_dac_probe(struct platform_device *pdev)
203203

204204
mutex_init(&info->lock);
205205

206-
ret = clk_prepare_enable(info->clk);
207-
if (ret) {
208-
dev_err(&pdev->dev,
209-
"Could not prepare or enable the clock\n");
210-
return ret;
211-
}
212-
213206
vf610_dac_init(info);
214207

215208
ret = iio_device_register(indio_dev);
@@ -222,7 +215,6 @@ static int vf610_dac_probe(struct platform_device *pdev)
222215

223216
error_iio_device_register:
224217
vf610_dac_exit(info);
225-
clk_disable_unprepare(info->clk);
226218

227219
return ret;
228220
}
@@ -234,7 +226,6 @@ static void vf610_dac_remove(struct platform_device *pdev)
234226

235227
iio_device_unregister(indio_dev);
236228
vf610_dac_exit(info);
237-
clk_disable_unprepare(info->clk);
238229
}
239230

240231
static int vf610_dac_suspend(struct device *dev)

0 commit comments

Comments
 (0)