Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703386 > unrolled thread

[PATCH] tee: constify tee_driver_ops and tee_desc structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2017-08-03 21:40 +0200
Last post2017-08-04 10:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tee: constify tee_driver_ops and tee_desc structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-03 21:40 +0200
    Re: [PATCH] tee: constify tee_driver_ops and tee_desc structures Jens Wiklander <jens.wiklander@linaro.org> - 2017-08-04 10:50 +0200

#1703386 — [PATCH] tee: constify tee_driver_ops and tee_desc structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-08-03 21:40 +0200
Subject[PATCH] tee: constify tee_driver_ops and tee_desc structures
Message-ID<uau8q-4sq-19@gated-at.bofh.it>
tee_driver_ops structures are only stored in the ops field of tee_desc
structures, which is const, and in turn tee_desc structures are only passed
as the first argument of tee_device_alloc, and this argument is const as
well.  Thus the two kinds of structures can be const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/tee/optee/core.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 58169e5..7609ec6 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -258,7 +258,7 @@ static void optee_release(struct tee_context *ctx)
 	}
 }
 
-static struct tee_driver_ops optee_ops = {
+static const struct tee_driver_ops optee_ops = {
 	.get_version = optee_get_version,
 	.open = optee_open,
 	.release = optee_release,
@@ -268,13 +268,13 @@ static void optee_release(struct tee_context *ctx)
 	.cancel_req = optee_cancel_req,
 };
 
-static struct tee_desc optee_desc = {
+static const struct tee_desc optee_desc = {
 	.name = DRIVER_NAME "-clnt",
 	.ops = &optee_ops,
 	.owner = THIS_MODULE,
 };
 
-static struct tee_driver_ops optee_supp_ops = {
+static const struct tee_driver_ops optee_supp_ops = {
 	.get_version = optee_get_version,
 	.open = optee_open,
 	.release = optee_release,
@@ -282,7 +282,7 @@ static void optee_release(struct tee_context *ctx)
 	.supp_send = optee_supp_send,
 };
 
-static struct tee_desc optee_supp_desc = {
+static const struct tee_desc optee_supp_desc = {
 	.name = DRIVER_NAME "-supp",
 	.ops = &optee_supp_ops,
 	.owner = THIS_MODULE,

[toc] | [next] | [standalone]


#1703796

FromJens Wiklander <jens.wiklander@linaro.org>
Date2017-08-04 10:50 +0200
Message-ID<uaGsW-4Gz-13@gated-at.bofh.it>
In reply to#1703386
On Thu, Aug 3, 2017 at 9:09 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> tee_driver_ops structures are only stored in the ops field of tee_desc
> structures, which is const, and in turn tee_desc structures are only passed
> as the first argument of tee_device_alloc, and this argument is const as
> well.  Thus the two kinds of structures can be const.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

This has already been proposed by Bhumika Goyal in a more or less
identical patch. I've already picked up Bhumikas patch and will send
it upstream via arm-soc.

Thanks,
Jens

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web