diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2012-07-04 09:25:06 -0400 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2012-07-05 17:53:27 -0400 |
commit | 160e7c840fe85836040c43e0058d5afced470c85 (patch) | |
tree | 65e91c7aae75ce16fa10dcdd015e664503dec1d5 /drivers/remoteproc | |
parent | 40e575b1d0b34b38519d361c10bdf8e0c688957b (diff) |
remoteproc: adopt the driver core's alloc/add/del/put naming
To make remoteproc's API more intuitive for developers, we adopt
the driver core's naming, i.e. alloc -> add -> del -> put. We'll also
add register/unregister when their first user shows up.
Otherwise - there's no functional change here.
Suggested by Russell King <linux@arm.linux.org.uk>.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Sjur Brændeland <sjur.brandeland@stericsson.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/omap_remoteproc.c | 8 | ||||
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 32 |
2 files changed, 20 insertions, 20 deletions
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index 4f2fe8fd7fe6..02bae3a5264f 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c | |||
@@ -199,14 +199,14 @@ static int __devinit omap_rproc_probe(struct platform_device *pdev) | |||
199 | 199 | ||
200 | platform_set_drvdata(pdev, rproc); | 200 | platform_set_drvdata(pdev, rproc); |
201 | 201 | ||
202 | ret = rproc_register(rproc); | 202 | ret = rproc_add(rproc); |
203 | if (ret) | 203 | if (ret) |
204 | goto free_rproc; | 204 | goto free_rproc; |
205 | 205 | ||
206 | return 0; | 206 | return 0; |
207 | 207 | ||
208 | free_rproc: | 208 | free_rproc: |
209 | rproc_free(rproc); | 209 | rproc_put(rproc); |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | 212 | ||
@@ -214,8 +214,8 @@ static int __devexit omap_rproc_remove(struct platform_device *pdev) | |||
214 | { | 214 | { |
215 | struct rproc *rproc = platform_get_drvdata(pdev); | 215 | struct rproc *rproc = platform_get_drvdata(pdev); |
216 | 216 | ||
217 | rproc_unregister(rproc); | 217 | rproc_del(rproc); |
218 | rproc_free(rproc); | 218 | rproc_put(rproc); |
219 | 219 | ||
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 0c77c4fcf436..25fd9733d5df 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
@@ -1101,7 +1101,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) | |||
1101 | 1101 | ||
1102 | out: | 1102 | out: |
1103 | release_firmware(fw); | 1103 | release_firmware(fw); |
1104 | /* allow rproc_unregister() contexts, if any, to proceed */ | 1104 | /* allow rproc_del() contexts, if any, to proceed */ |
1105 | complete_all(&rproc->firmware_loading_complete); | 1105 | complete_all(&rproc->firmware_loading_complete); |
1106 | } | 1106 | } |
1107 | 1107 | ||
@@ -1238,7 +1238,7 @@ out: | |||
1238 | EXPORT_SYMBOL(rproc_shutdown); | 1238 | EXPORT_SYMBOL(rproc_shutdown); |
1239 | 1239 | ||
1240 | /** | 1240 | /** |
1241 | * rproc_register() - register a remote processor | 1241 | * rproc_add() - register a remote processor |
1242 | * @rproc: the remote processor handle to register | 1242 | * @rproc: the remote processor handle to register |
1243 | * | 1243 | * |
1244 | * Registers @rproc with the remoteproc framework, after it has been | 1244 | * Registers @rproc with the remoteproc framework, after it has been |
@@ -1257,7 +1257,7 @@ EXPORT_SYMBOL(rproc_shutdown); | |||
1257 | * of registering this remote processor, additional virtio drivers might be | 1257 | * of registering this remote processor, additional virtio drivers might be |
1258 | * probed. | 1258 | * probed. |
1259 | */ | 1259 | */ |
1260 | int rproc_register(struct rproc *rproc) | 1260 | int rproc_add(struct rproc *rproc) |
1261 | { | 1261 | { |
1262 | struct device *dev = &rproc->dev; | 1262 | struct device *dev = &rproc->dev; |
1263 | int ret = 0; | 1263 | int ret = 0; |
@@ -1274,7 +1274,7 @@ int rproc_register(struct rproc *rproc) | |||
1274 | /* create debugfs entries */ | 1274 | /* create debugfs entries */ |
1275 | rproc_create_debug_dir(rproc); | 1275 | rproc_create_debug_dir(rproc); |
1276 | 1276 | ||
1277 | /* rproc_unregister() calls must wait until async loader completes */ | 1277 | /* rproc_del() calls must wait until async loader completes */ |
1278 | init_completion(&rproc->firmware_loading_complete); | 1278 | init_completion(&rproc->firmware_loading_complete); |
1279 | 1279 | ||
1280 | /* | 1280 | /* |
@@ -1295,7 +1295,7 @@ int rproc_register(struct rproc *rproc) | |||
1295 | 1295 | ||
1296 | return ret; | 1296 | return ret; |
1297 | } | 1297 | } |
1298 | EXPORT_SYMBOL(rproc_register); | 1298 | EXPORT_SYMBOL(rproc_add); |
1299 | 1299 | ||
1300 | /** | 1300 | /** |
1301 | * rproc_type_release() - release a remote processor instance | 1301 | * rproc_type_release() - release a remote processor instance |
@@ -1343,13 +1343,13 @@ static struct device_type rproc_type = { | |||
1343 | * of the remote processor. | 1343 | * of the remote processor. |
1344 | * | 1344 | * |
1345 | * After creating an rproc handle using this function, and when ready, | 1345 | * After creating an rproc handle using this function, and when ready, |
1346 | * implementations should then call rproc_register() to complete | 1346 | * implementations should then call rproc_add() to complete |
1347 | * the registration of the remote processor. | 1347 | * the registration of the remote processor. |
1348 | * | 1348 | * |
1349 | * On success the new rproc is returned, and on failure, NULL. | 1349 | * On success the new rproc is returned, and on failure, NULL. |
1350 | * | 1350 | * |
1351 | * Note: _never_ directly deallocate @rproc, even if it was not registered | 1351 | * Note: _never_ directly deallocate @rproc, even if it was not registered |
1352 | * yet. Instead, when you need to unroll rproc_alloc(), use rproc_free(). | 1352 | * yet. Instead, when you need to unroll rproc_alloc(), use rproc_put(). |
1353 | */ | 1353 | */ |
1354 | struct rproc *rproc_alloc(struct device *dev, const char *name, | 1354 | struct rproc *rproc_alloc(struct device *dev, const char *name, |
1355 | const struct rproc_ops *ops, | 1355 | const struct rproc_ops *ops, |
@@ -1403,7 +1403,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, | |||
1403 | EXPORT_SYMBOL(rproc_alloc); | 1403 | EXPORT_SYMBOL(rproc_alloc); |
1404 | 1404 | ||
1405 | /** | 1405 | /** |
1406 | * rproc_free() - unroll rproc_alloc() | 1406 | * rproc_put() - unroll rproc_alloc() |
1407 | * @rproc: the remote processor handle | 1407 | * @rproc: the remote processor handle |
1408 | * | 1408 | * |
1409 | * This function decrements the rproc dev refcount. | 1409 | * This function decrements the rproc dev refcount. |
@@ -1411,28 +1411,28 @@ EXPORT_SYMBOL(rproc_alloc); | |||
1411 | * If no one holds any reference to rproc anymore, then its refcount would | 1411 | * If no one holds any reference to rproc anymore, then its refcount would |
1412 | * now drop to zero, and it would be freed. | 1412 | * now drop to zero, and it would be freed. |
1413 | */ | 1413 | */ |
1414 | void rproc_free(struct rproc *rproc) | 1414 | void rproc_put(struct rproc *rproc) |
1415 | { | 1415 | { |
1416 | put_device(&rproc->dev); | 1416 | put_device(&rproc->dev); |
1417 | } | 1417 | } |
1418 | EXPORT_SYMBOL(rproc_free); | 1418 | EXPORT_SYMBOL(rproc_put); |
1419 | 1419 | ||
1420 | /** | 1420 | /** |
1421 | * rproc_unregister() - unregister a remote processor | 1421 | * rproc_del() - unregister a remote processor |
1422 | * @rproc: rproc handle to unregister | 1422 | * @rproc: rproc handle to unregister |
1423 | * | 1423 | * |
1424 | * This function should be called when the platform specific rproc | 1424 | * This function should be called when the platform specific rproc |
1425 | * implementation decides to remove the rproc device. it should | 1425 | * implementation decides to remove the rproc device. it should |
1426 | * _only_ be called if a previous invocation of rproc_register() | 1426 | * _only_ be called if a previous invocation of rproc_add() |
1427 | * has completed successfully. | 1427 | * has completed successfully. |
1428 | * | 1428 | * |
1429 | * After rproc_unregister() returns, @rproc isn't freed yet, because | 1429 | * After rproc_del() returns, @rproc isn't freed yet, because |
1430 | * of the outstanding reference created by rproc_alloc. To decrement that | 1430 | * of the outstanding reference created by rproc_alloc. To decrement that |
1431 | * one last refcount, one still needs to call rproc_free(). | 1431 | * one last refcount, one still needs to call rproc_put(). |
1432 | * | 1432 | * |
1433 | * Returns 0 on success and -EINVAL if @rproc isn't valid. | 1433 | * Returns 0 on success and -EINVAL if @rproc isn't valid. |
1434 | */ | 1434 | */ |
1435 | int rproc_unregister(struct rproc *rproc) | 1435 | int rproc_del(struct rproc *rproc) |
1436 | { | 1436 | { |
1437 | struct rproc_vdev *rvdev, *tmp; | 1437 | struct rproc_vdev *rvdev, *tmp; |
1438 | 1438 | ||
@@ -1450,7 +1450,7 @@ int rproc_unregister(struct rproc *rproc) | |||
1450 | 1450 | ||
1451 | return 0; | 1451 | return 0; |
1452 | } | 1452 | } |
1453 | EXPORT_SYMBOL(rproc_unregister); | 1453 | EXPORT_SYMBOL(rproc_del); |
1454 | 1454 | ||
1455 | static int __init remoteproc_init(void) | 1455 | static int __init remoteproc_init(void) |
1456 | { | 1456 | { |