Skip to content

Commit 2153244

Browse files
Andi Shytiwsakernel
authored andcommitted
i2c: hix5hd2: Use devm_clk_get_enabled()
Replace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled(). Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 75ff8a3 commit 2153244

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/i2c/busses/i2c-hix5hd2.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,11 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
420420
if (irq < 0)
421421
return irq;
422422

423-
priv->clk = devm_clk_get(&pdev->dev, NULL);
423+
priv->clk = devm_clk_get_enabled(&pdev->dev, NULL);
424424
if (IS_ERR(priv->clk)) {
425-
dev_err(&pdev->dev, "cannot get clock\n");
425+
dev_err(&pdev->dev, "cannot enable clock\n");
426426
return PTR_ERR(priv->clk);
427427
}
428-
clk_prepare_enable(priv->clk);
429428

430429
strscpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name));
431430
priv->dev = &pdev->dev;
@@ -446,7 +445,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
446445
IRQF_NO_SUSPEND, dev_name(&pdev->dev), priv);
447446
if (ret != 0) {
448447
dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", irq);
449-
goto err_clk;
448+
return ret;
450449
}
451450

452451
pm_runtime_set_autosuspend_delay(priv->dev, MSEC_PER_SEC);
@@ -463,8 +462,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
463462
err_runtime:
464463
pm_runtime_disable(priv->dev);
465464
pm_runtime_set_suspended(priv->dev);
466-
err_clk:
467-
clk_disable_unprepare(priv->clk);
465+
468466
return ret;
469467
}
470468

@@ -475,7 +473,6 @@ static void hix5hd2_i2c_remove(struct platform_device *pdev)
475473
i2c_del_adapter(&priv->adap);
476474
pm_runtime_disable(priv->dev);
477475
pm_runtime_set_suspended(priv->dev);
478-
clk_disable_unprepare(priv->clk);
479476
}
480477

481478
#ifdef CONFIG_PM

0 commit comments

Comments
 (0)