Skip to content

Commit 89e362c

Browse files
Jinjie Ruanbroonie
authored andcommitted
spi: geni-qcom: Undo runtime PM changes at driver exit time
It's important to undo pm_runtime_use_autosuspend() with pm_runtime_dont_use_autosuspend() at driver exit time unless driver initially enabled pm_runtime with devm_pm_runtime_enable() (which handles it for you). Hence, switch to devm_pm_runtime_enable() to fix it, so the pm_runtime_disable() in probe error path and remove function can be removed. Fixes: cfdab2c ("spi: spi-geni-qcom: Set an autosuspend delay of 250 ms") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://patch.msgid.link/20240909073141.951494-2-ruanjinjie@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c9ca76e commit 89e362c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/spi/spi-geni-qcom.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,25 +1110,27 @@ static int spi_geni_probe(struct platform_device *pdev)
11101110
spin_lock_init(&mas->lock);
11111111
pm_runtime_use_autosuspend(&pdev->dev);
11121112
pm_runtime_set_autosuspend_delay(&pdev->dev, 250);
1113-
pm_runtime_enable(dev);
1113+
ret = devm_pm_runtime_enable(dev);
1114+
if (ret)
1115+
return ret;
11141116

11151117
if (device_property_read_bool(&pdev->dev, "spi-slave"))
11161118
spi->target = true;
11171119

11181120
ret = geni_icc_get(&mas->se, NULL);
11191121
if (ret)
1120-
goto spi_geni_probe_runtime_disable;
1122+
return ret;
11211123
/* Set the bus quota to a reasonable value for register access */
11221124
mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ);
11231125
mas->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
11241126

11251127
ret = geni_icc_set_bw(&mas->se);
11261128
if (ret)
1127-
goto spi_geni_probe_runtime_disable;
1129+
return ret;
11281130

11291131
ret = spi_geni_init(mas);
11301132
if (ret)
1131-
goto spi_geni_probe_runtime_disable;
1133+
return ret;
11321134

11331135
/*
11341136
* check the mode supported and set_cs for fifo mode only
@@ -1157,8 +1159,6 @@ static int spi_geni_probe(struct platform_device *pdev)
11571159
free_irq(mas->irq, spi);
11581160
spi_geni_release_dma:
11591161
spi_geni_release_dma_chan(mas);
1160-
spi_geni_probe_runtime_disable:
1161-
pm_runtime_disable(dev);
11621162
return ret;
11631163
}
11641164

@@ -1173,7 +1173,6 @@ static void spi_geni_remove(struct platform_device *pdev)
11731173
spi_geni_release_dma_chan(mas);
11741174

11751175
free_irq(mas->irq, spi);
1176-
pm_runtime_disable(&pdev->dev);
11771176
}
11781177

11791178
static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)