remoteproc: Constify static struct rproc_ops
Subsystems (3)
cover remoteproc: Constify static struct rproc_ops
Constify two static struct rproc_ops which are never modified. These two changes makes all static instances of rproc_ops in the kernel const.
Rikard Falkeborn (2):
remoteproc: ingenic: Constify ingenic_rproc_ops
remoteproc: stm32: Constify st_rproc_ops
drivers/remoteproc/ingenic_rproc.c | 2 +- drivers/remoteproc/stm32_rproc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.29.2
PATCH 1/2 remoteproc: ingenic: Constify ingenic_rproc_ops
The only usage of ingenic_rproc_ops is to pass its address to devm_rproc_alloc(), which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory.
--- drivers/remoteproc/ingenic_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/ingenic_rproc.c +1 -1
@@ -135,7 +135,7 @@ static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)return (__force void *)va; } -static struct rproc_ops ingenic_rproc_ops = { +static const struct rproc_ops ingenic_rproc_ops = { .prepare = ingenic_rproc_prepare, .unprepare = ingenic_rproc_unprepare, .start = ingenic_rproc_start,
Signature · 1 line
2.29.2
Re: [PATCH 1/2] remoteproc: ingenic: Constify ingenic_rproc_ops
Hi,
Quoted 5 lines · Rikard Falkeborn
The only usage of
ingenic_rproc_opsis to pass its address todevm_rproc_alloc(), which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Cheers,
-Paul
Quoted 21 lines
--- drivers/remoteproc/ingenic_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/remoteproc/ingenic_rproc.c +1
-1@@ -135,7 +135,7 @@ static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)return (__force void *)va; } -static struct rproc_ops ingenic_rproc_ops = { +static const struct rproc_ops ingenic_rproc_ops = { .prepare = ingenic_rproc_prepare, .unprepare = ingenic_rproc_unprepare,.start =
ingenic_rproc_start,
--
2.29.2
PATCH 2/2 remoteproc: stm32: Constify st_rproc_ops
In reply to Rikard FalkebornThe only usage of st_rproc_ops is to pass its address to rproc_alloc() which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory.
--- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +1 -1
@@ -541,7 +541,7 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid) } } -static struct rproc_ops st_rproc_ops = { +static const struct rproc_ops st_rproc_ops = { .start = stm32_rproc_start, .stop = stm32_rproc_stop, .attach = stm32_rproc_attach,
Signature · 1 line
2.29.2
Re: [Linux-stm32] [PATCH 2/2] remoteproc: stm32: Constify st_rproc_ops
Hi Rikard,
Quoted 15 lines · Rikard Falkeborn
The only usage of
st_rproc_opsis to pass its address torproc_alloc()which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/remoteproc/stm32_rproc.c +0
-0
drivers/remoteproc/stm32_rproc.c static void stm32_rproc_kick(struct rproc *rproc, int vqid) · line 547
Quoted 8 lines
drivers/remoteproc/stm32_rproc.c +1
-1@@ -541,7 +541,7 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid) } } -static struct rproc_ops st_rproc_ops = { +static const struct rproc_ops st_rproc_ops = { .start = stm32_rproc_start, .stop = stm32_rproc_stop, .attach = stm32_rproc_attach,
Thanks,
Arnaud
This series was applied to andersson/remoteproc.git (refs/heads/for-next):
Hello:
This series was applied to andersson/remoteproc.git (refs/heads/for-next):
Quoted 8 lines · On Sun, 8 Nov 2020 00:36:28 +0100 you wrote:
Constify two static struct
rproc_opswhich are never modified. These two changes makes all static instances ofrproc_opsin the kernel const.Rikard Falkeborn (2):
remoteproc: ingenic: Constifyingenic_rproc_ops
remoteproc: stm32: Constifyst_rproc_ops[...]
Here is the summary with links:
- [1/2] remoteproc: ingenic: Constify ingenic_rproc_ops
https://git.kernel.org/andersson/remoteproc/c/bb7eda7eddf1
- [2/2] remoteproc: stm32: Constify st_rproc_ops
https://git.kernel.org/andersson/remoteproc/c/0eee3d28ff65
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html