Skip to content

Commit 9c7174d

Browse files
Andi Shytiwsakernel
authored andcommitted
i2c: nomadik: 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]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 1c5d33f commit 9c7174d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/i2c/busses/i2c-nomadik.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,18 +1005,12 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
10051005
return ret;
10061006
}
10071007

1008-
dev->clk = devm_clk_get(&adev->dev, NULL);
1008+
dev->clk = devm_clk_get_enabled(&adev->dev, NULL);
10091009
if (IS_ERR(dev->clk)) {
1010-
dev_err(&adev->dev, "could not get i2c clock\n");
1010+
dev_err(&adev->dev, "could enable i2c clock\n");
10111011
return PTR_ERR(dev->clk);
10121012
}
10131013

1014-
ret = clk_prepare_enable(dev->clk);
1015-
if (ret) {
1016-
dev_err(&adev->dev, "can't prepare_enable clock\n");
1017-
return ret;
1018-
}
1019-
10201014
init_hw(dev);
10211015

10221016
adap = &dev->adap;
@@ -1037,16 +1031,11 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
10371031

10381032
ret = i2c_add_adapter(adap);
10391033
if (ret)
1040-
goto err_no_adap;
1034+
return ret;
10411035

10421036
pm_runtime_put(&adev->dev);
10431037

10441038
return 0;
1045-
1046-
err_no_adap:
1047-
clk_disable_unprepare(dev->clk);
1048-
1049-
return ret;
10501039
}
10511040

10521041
static void nmk_i2c_remove(struct amba_device *adev)
@@ -1060,7 +1049,6 @@ static void nmk_i2c_remove(struct amba_device *adev)
10601049
clear_all_interrupts(dev);
10611050
/* disable the controller */
10621051
i2c_clr_bit(dev->virtbase + I2C_CR, I2C_CR_PE);
1063-
clk_disable_unprepare(dev->clk);
10641052
release_mem_region(res->start, resource_size(res));
10651053
}
10661054

0 commit comments

Comments
 (0)