Skip to content

Commit 20c475d

Browse files
Andi Shytibroonie
authored andcommitted
spi: s3c64xx: Use devm_clk_get_enabled()
Replace the tuple devm_clk_get()/clk_prepare_enable() with the single function devm_clk_get_enabled(). Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 34fcc0f commit 20c475d

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

drivers/spi/spi-s3c64xx.c

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,46 +1244,28 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
12441244
}
12451245

12461246
/* Setup clocks */
1247-
sdd->clk = devm_clk_get(&pdev->dev, "spi");
1247+
sdd->clk = devm_clk_get_enabled(&pdev->dev, "spi");
12481248
if (IS_ERR(sdd->clk)) {
12491249
dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
12501250
ret = PTR_ERR(sdd->clk);
12511251
goto err_deref_master;
12521252
}
12531253

1254-
ret = clk_prepare_enable(sdd->clk);
1255-
if (ret) {
1256-
dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
1257-
goto err_deref_master;
1258-
}
1259-
12601254
sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr);
1261-
sdd->src_clk = devm_clk_get(&pdev->dev, clk_name);
1255+
sdd->src_clk = devm_clk_get_enabled(&pdev->dev, clk_name);
12621256
if (IS_ERR(sdd->src_clk)) {
12631257
dev_err(&pdev->dev,
12641258
"Unable to acquire clock '%s'\n", clk_name);
12651259
ret = PTR_ERR(sdd->src_clk);
1266-
goto err_disable_clk;
1267-
}
1268-
1269-
ret = clk_prepare_enable(sdd->src_clk);
1270-
if (ret) {
1271-
dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
1272-
goto err_disable_clk;
1260+
goto err_deref_master;
12731261
}
12741262

12751263
if (sdd->port_conf->clk_ioclk) {
1276-
sdd->ioclk = devm_clk_get(&pdev->dev, "spi_ioclk");
1264+
sdd->ioclk = devm_clk_get_enabled(&pdev->dev, "spi_ioclk");
12771265
if (IS_ERR(sdd->ioclk)) {
12781266
dev_err(&pdev->dev, "Unable to acquire 'ioclk'\n");
12791267
ret = PTR_ERR(sdd->ioclk);
1280-
goto err_disable_src_clk;
1281-
}
1282-
1283-
ret = clk_prepare_enable(sdd->ioclk);
1284-
if (ret) {
1285-
dev_err(&pdev->dev, "Couldn't enable clock 'ioclk'\n");
1286-
goto err_disable_src_clk;
1268+
goto err_deref_master;
12871269
}
12881270
}
12891271

@@ -1332,11 +1314,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
13321314
pm_runtime_disable(&pdev->dev);
13331315
pm_runtime_set_suspended(&pdev->dev);
13341316

1335-
clk_disable_unprepare(sdd->ioclk);
1336-
err_disable_src_clk:
1337-
clk_disable_unprepare(sdd->src_clk);
1338-
err_disable_clk:
1339-
clk_disable_unprepare(sdd->clk);
13401317
err_deref_master:
13411318
spi_master_put(master);
13421319

@@ -1357,12 +1334,6 @@ static void s3c64xx_spi_remove(struct platform_device *pdev)
13571334
dma_release_channel(sdd->tx_dma.ch);
13581335
}
13591336

1360-
clk_disable_unprepare(sdd->ioclk);
1361-
1362-
clk_disable_unprepare(sdd->src_clk);
1363-
1364-
clk_disable_unprepare(sdd->clk);
1365-
13661337
pm_runtime_put_noidle(&pdev->dev);
13671338
pm_runtime_disable(&pdev->dev);
13681339
pm_runtime_set_suspended(&pdev->dev);

0 commit comments

Comments
 (0)