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 | |
| 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>
| -rw-r--r-- | Documentation/remoteproc.txt | 18 | ||||
| -rw-r--r-- | drivers/remoteproc/omap_remoteproc.c | 8 | ||||
| -rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 32 | ||||
| -rw-r--r-- | include/linux/remoteproc.h | 6 |
4 files changed, 32 insertions, 32 deletions
diff --git a/Documentation/remoteproc.txt b/Documentation/remoteproc.txt index f33c3bbbc867..23a09b884bc7 100644 --- a/Documentation/remoteproc.txt +++ b/Documentation/remoteproc.txt | |||
| @@ -90,21 +90,21 @@ int dummy_rproc_example(struct rproc *my_rproc) | |||
| 90 | This function should be used by rproc implementations during | 90 | This function should be used by rproc implementations during |
| 91 | initialization of the remote processor. | 91 | initialization of the remote processor. |
| 92 | After creating an rproc handle using this function, and when ready, | 92 | After creating an rproc handle using this function, and when ready, |
| 93 | implementations should then call rproc_register() to complete | 93 | implementations should then call rproc_add() to complete |
| 94 | the registration of the remote processor. | 94 | the registration of the remote processor. |
| 95 | On success, the new rproc is returned, and on failure, NULL. | 95 | On success, the new rproc is returned, and on failure, NULL. |
| 96 | 96 | ||
| 97 | Note: _never_ directly deallocate @rproc, even if it was not registered | 97 | Note: _never_ directly deallocate @rproc, even if it was not registered |
| 98 | yet. Instead, when you need to unroll rproc_alloc(), use rproc_free(). | 98 | yet. Instead, when you need to unroll rproc_alloc(), use rproc_put(). |
| 99 | 99 | ||
| 100 | void rproc_free(struct rproc *rproc) | 100 | void rproc_put(struct rproc *rproc) |
| 101 | - Free an rproc handle that was allocated by rproc_alloc. | 101 | - Free an rproc handle that was allocated by rproc_alloc. |
| 102 | This function essentially unrolls rproc_alloc(), by decrementing the | 102 | This function essentially unrolls rproc_alloc(), by decrementing the |
| 103 | rproc's refcount. It doesn't directly free rproc; that would happen | 103 | rproc's refcount. It doesn't directly free rproc; that would happen |
| 104 | only if there are no other references to rproc and its refcount now | 104 | only if there are no other references to rproc and its refcount now |
| 105 | dropped to zero. | 105 | dropped to zero. |
| 106 | 106 | ||
| 107 | int rproc_register(struct rproc *rproc) | 107 | int rproc_add(struct rproc *rproc) |
| 108 | - Register @rproc with the remoteproc framework, after it has been | 108 | - Register @rproc with the remoteproc framework, after it has been |
| 109 | allocated with rproc_alloc(). | 109 | allocated with rproc_alloc(). |
| 110 | This is called by the platform-specific rproc implementation, whenever | 110 | This is called by the platform-specific rproc implementation, whenever |
| @@ -117,15 +117,15 @@ int dummy_rproc_example(struct rproc *my_rproc) | |||
| 117 | of registering this remote processor, additional virtio drivers might get | 117 | of registering this remote processor, additional virtio drivers might get |
| 118 | probed. | 118 | probed. |
| 119 | 119 | ||
| 120 | int rproc_unregister(struct rproc *rproc) | 120 | int rproc_del(struct rproc *rproc) |
| 121 | - Unroll rproc_register(). | 121 | - Unroll rproc_add(). |
| 122 | This function should be called when the platform specific rproc | 122 | This function should be called when the platform specific rproc |
| 123 | implementation decides to remove the rproc device. it should | 123 | implementation decides to remove the rproc device. it should |
| 124 | _only_ be called if a previous invocation of rproc_register() | 124 | _only_ be called if a previous invocation of rproc_add() |
| 125 | has completed successfully. | 125 | has completed successfully. |
| 126 | 126 | ||
| 127 | After rproc_unregister() returns, @rproc is still valid, and its | 127 | After rproc_del() returns, @rproc is still valid, and its |
| 128 | last refcount should be decremented by calling rproc_free(). | 128 | last refcount should be decremented by calling rproc_put(). |
| 129 | 129 | ||
| 130 | Returns 0 on success and -EINVAL if @rproc isn't valid. | 130 | Returns 0 on success and -EINVAL if @rproc isn't valid. |
| 131 | 131 | ||
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 | |||
