aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/remoteproc.txt6
-rw-r--r--drivers/remoteproc/da8xx_remoteproc.c4
-rw-r--r--drivers/remoteproc/omap_remoteproc.c4
-rw-r--r--drivers/remoteproc/qcom_q6v5_pil.c4
-rw-r--r--drivers/remoteproc/qcom_wcnss.c4
-rw-r--r--drivers/remoteproc/remoteproc_core.c21
-rw-r--r--drivers/remoteproc/st_remoteproc.c4
-rw-r--r--drivers/remoteproc/ste_modem_rproc.c4
-rw-r--r--drivers/remoteproc/wkup_m3_rproc.c4
-rw-r--r--include/linux/remoteproc.h1
10 files changed, 36 insertions, 20 deletions
diff --git a/Documentation/remoteproc.txt b/Documentation/remoteproc.txt
index ef0219fa4bb4..f07597482351 100644
--- a/Documentation/remoteproc.txt
+++ b/Documentation/remoteproc.txt
@@ -101,9 +101,9 @@ int dummy_rproc_example(struct rproc *my_rproc)
101 On success, the new rproc is returned, and on failure, NULL. 101 On success, the new rproc is returned, and on failure, NULL.
102 102
103 Note: _never_ directly deallocate @rproc, even if it was not registered 103 Note: _never_ directly deallocate @rproc, even if it was not registered
104 yet. Instead, when you need to unroll rproc_alloc(), use rproc_put(). 104 yet. Instead, when you need to unroll rproc_alloc(), use rproc_free().
105 105
106 void rproc_put(struct rproc *rproc) 106 void rproc_free(struct rproc *rproc)
107 - Free an rproc handle that was allocated by rproc_alloc. 107 - Free an rproc handle that was allocated by rproc_alloc.
108 This function essentially unrolls rproc_alloc(), by decrementing the 108 This function essentially unrolls rproc_alloc(), by decrementing the
109 rproc's refcount. It doesn't directly free rproc; that would happen 109 rproc's refcount. It doesn't directly free rproc; that would happen
@@ -131,7 +131,7 @@ int dummy_rproc_example(struct rproc *my_rproc)
131 has completed successfully. 131 has completed successfully.
132 132
133 After rproc_del() returns, @rproc is still valid, and its 133 After rproc_del() returns, @rproc is still valid, and its
134 last refcount should be decremented by calling rproc_put(). 134 last refcount should be decremented by calling rproc_free().
135 135
136 Returns 0 on success and -EINVAL if @rproc isn't valid. 136 Returns 0 on success and -EINVAL if @rproc isn't valid.
137 137
diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 12823d078e1e..1afac8f31be0 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -261,7 +261,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
261 return 0; 261 return 0;
262 262
263free_rproc: 263free_rproc:
264 rproc_put(rproc); 264 rproc_free(rproc);
265 265
266 return ret; 266 return ret;
267} 267}
@@ -290,7 +290,7 @@ static int da8xx_rproc_remove(struct platform_device *pdev)
290 disable_irq(drproc->irq); 290 disable_irq(drproc->irq);
291 291
292 rproc_del(rproc); 292 rproc_del(rproc);
293 rproc_put(rproc); 293 rproc_free(rproc);
294 294
295 return 0; 295 return 0;
296} 296}
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 01e234cb9157..fa63bf2eb885 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -215,7 +215,7 @@ static int omap_rproc_probe(struct platform_device *pdev)
215 return 0; 215 return 0;
216 216
217free_rproc: 217free_rproc:
218 rproc_put(rproc); 218 rproc_free(rproc);
219 return ret; 219 return ret;
220} 220}
221 221
@@ -224,7 +224,7 @@ static int omap_rproc_remove(struct platform_device *pdev)
224 struct rproc *rproc = platform_get_drvdata(pdev); 224 struct rproc *rproc = platform_get_drvdata(pdev);
225 225
226 rproc_del(rproc); 226 rproc_del(rproc);
227 rproc_put(rproc); 227 rproc_free(rproc);
228 228
229 return 0; 229 return 0;
230} 230}
diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
index 05b04573e87d..2e0caaaa766a 100644
--- a/drivers/remoteproc/qcom_q6v5_pil.c
+++ b/drivers/remoteproc/qcom_q6v5_pil.c
@@ -875,7 +875,7 @@ static int q6v5_probe(struct platform_device *pdev)
875 return 0; 875 return 0;
876 876
877free_rproc: 877free_rproc:
878 rproc_put(rproc); 878 rproc_free(rproc);
879 879
880 return ret; 880 return ret;
881} 881}
@@ -885,7 +885,7 @@ static int q6v5_remove(struct platform_device *pdev)
885 struct q6v5 *qproc = platform_get_drvdata(pdev); 885 struct q6v5 *qproc = platform_get_drvdata(pdev);
886 886
887 rproc_del(qproc->rproc); 887 rproc_del(qproc->rproc);
888 rproc_put(qproc->rproc); 888 rproc_free(qproc->rproc);
889 889
890 return 0; 890 return 0;
891} 891}
diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
index 1917de7db91c..f5cedeaafba1 100644
--- a/drivers/remoteproc/qcom_wcnss.c
+++ b/drivers/remoteproc/qcom_wcnss.c
@@ -585,7 +585,7 @@ static int wcnss_probe(struct platform_device *pdev)
585 return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); 585 return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
586 586
587free_rproc: 587free_rproc:
588 rproc_put(rproc); 588 rproc_free(rproc);
589 589
590 return ret; 590 return ret;
591} 591}
@@ -598,7 +598,7 @@ static int wcnss_remove(struct platform_device *pdev)
598 598
599 qcom_smem_state_put(wcnss->state); 599 qcom_smem_state_put(wcnss->state);
600 rproc_del(wcnss->rproc); 600 rproc_del(wcnss->rproc);
601 rproc_put(wcnss->rproc); 601 rproc_free(wcnss->rproc);
602 602
603 return 0; 603 return 0;
604} 604}
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 3da566b0d437..ede3af14b9d0 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1307,7 +1307,7 @@ static struct device_type rproc_type = {
1307 * On success the new rproc is returned, and on failure, NULL. 1307 * On success the new rproc is returned, and on failure, NULL.
1308 * 1308 *
1309 * Note: _never_ directly deallocate @rproc, even if it was not registered 1309 * Note: _never_ directly deallocate @rproc, even if it was not registered
1310 * yet. Instead, when you need to unroll rproc_alloc(), use rproc_put(). 1310 * yet. Instead, when you need to unroll rproc_alloc(), use rproc_free().
1311 */ 1311 */
1312struct rproc *rproc_alloc(struct device *dev, const char *name, 1312struct rproc *rproc_alloc(struct device *dev, const char *name,
1313 const struct rproc_ops *ops, 1313 const struct rproc_ops *ops,
@@ -1386,7 +1386,22 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
1386EXPORT_SYMBOL(rproc_alloc); 1386EXPORT_SYMBOL(rproc_alloc);
1387 1387
1388/** 1388/**
1389 * rproc_put() - unroll rproc_alloc() 1389 * rproc_free() - unroll rproc_alloc()
1390 * @rproc: the remote processor handle
1391 *
1392 * This function decrements the rproc dev refcount.
1393 *
1394 * If no one holds any reference to rproc anymore, then its refcount would
1395 * now drop to zero, and it would be freed.
1396 */
1397void rproc_free(struct rproc *rproc)
1398{
1399 put_device(&rproc->dev);
1400}
1401EXPORT_SYMBOL(rproc_free);
1402
1403/**
1404 * rproc_put() - release rproc reference
1390 * @rproc: the remote processor handle 1405 * @rproc: the remote processor handle
1391 * 1406 *
1392 * This function decrements the rproc dev refcount. 1407 * This function decrements the rproc dev refcount.
@@ -1411,7 +1426,7 @@ EXPORT_SYMBOL(rproc_put);
1411 * 1426 *
1412 * After rproc_del() returns, @rproc isn't freed yet, because 1427 * After rproc_del() returns, @rproc isn't freed yet, because
1413 * of the outstanding reference created by rproc_alloc. To decrement that 1428 * of the outstanding reference created by rproc_alloc. To decrement that
1414 * one last refcount, one still needs to call rproc_put(). 1429 * one last refcount, one still needs to call rproc_free().
1415 * 1430 *
1416 * Returns 0 on success and -EINVAL if @rproc isn't valid. 1431 * Returns 0 on success and -EINVAL if @rproc isn't valid.
1417 */ 1432 */
diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c
index 6f056caa8a56..ae8963fcc8c8 100644
--- a/drivers/remoteproc/st_remoteproc.c
+++ b/drivers/remoteproc/st_remoteproc.c
@@ -262,7 +262,7 @@ static int st_rproc_probe(struct platform_device *pdev)
262 return 0; 262 return 0;
263 263
264free_rproc: 264free_rproc:
265 rproc_put(rproc); 265 rproc_free(rproc);
266 return ret; 266 return ret;
267} 267}
268 268
@@ -277,7 +277,7 @@ static int st_rproc_remove(struct platform_device *pdev)
277 277
278 of_reserved_mem_device_release(&pdev->dev); 278 of_reserved_mem_device_release(&pdev->dev);
279 279
280 rproc_put(rproc); 280 rproc_free(rproc);
281 281
282 return 0; 282 return 0;
283} 283}
diff --git a/drivers/remoteproc/ste_modem_rproc.c b/drivers/remoteproc/ste_modem_rproc.c
index 53dc17bdd54e..03d69a9a3c5b 100644
--- a/drivers/remoteproc/ste_modem_rproc.c
+++ b/drivers/remoteproc/ste_modem_rproc.c
@@ -257,7 +257,7 @@ static int sproc_drv_remove(struct platform_device *pdev)
257 rproc_del(sproc->rproc); 257 rproc_del(sproc->rproc);
258 dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE, 258 dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE,
259 sproc->fw_addr, sproc->fw_dma_addr); 259 sproc->fw_addr, sproc->fw_dma_addr);
260 rproc_put(sproc->rproc); 260 rproc_free(sproc->rproc);
261 261
262 mdev->drv_data = NULL; 262 mdev->drv_data = NULL;
263 263
@@ -325,7 +325,7 @@ free_mem:
325free_rproc: 325free_rproc:
326 /* Reset device data upon error */ 326 /* Reset device data upon error */
327 mdev->drv_data = NULL; 327 mdev->drv_data = NULL;
328 rproc_put(rproc); 328 rproc_free(rproc);
329 return err; 329 return err;
330} 330}
331 331
diff --git a/drivers/remoteproc/wkup_m3_rproc.c b/drivers/remoteproc/wkup_m3_rproc.c
index 3811cb522af3..18175d0331fd 100644
--- a/drivers/remoteproc/wkup_m3_rproc.c
+++ b/drivers/remoteproc/wkup_m3_rproc.c
@@ -208,7 +208,7 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
208 return 0; 208 return 0;
209 209
210err_put_rproc: 210err_put_rproc:
211 rproc_put(rproc); 211 rproc_free(rproc);
212err: 212err:
213 pm_runtime_put_noidle(dev); 213 pm_runtime_put_noidle(dev);
214 pm_runtime_disable(dev); 214 pm_runtime_disable(dev);
@@ -220,7 +220,7 @@ static int wkup_m3_rproc_remove(struct platform_device *pdev)
220 struct rproc *rproc = platform_get_drvdata(pdev); 220 struct rproc *rproc = platform_get_drvdata(pdev);
221 221
222 rproc_del(rproc); 222 rproc_del(rproc);
223 rproc_put(rproc); 223 rproc_free(rproc);
224 pm_runtime_put_sync(&pdev->dev); 224 pm_runtime_put_sync(&pdev->dev);
225 pm_runtime_disable(&pdev->dev); 225 pm_runtime_disable(&pdev->dev);
226 226
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index c321eab5054e..930023b7c825 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -493,6 +493,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
493void rproc_put(struct rproc *rproc); 493void rproc_put(struct rproc *rproc);
494int rproc_add(struct rproc *rproc); 494int rproc_add(struct rproc *rproc);
495int rproc_del(struct rproc *rproc); 495int rproc_del(struct rproc *rproc);
496void rproc_free(struct rproc *rproc);
496 497
497int rproc_boot(struct rproc *rproc); 498int rproc_boot(struct rproc *rproc);
498void rproc_shutdown(struct rproc *rproc); 499void rproc_shutdown(struct rproc *rproc);