2015-12-14 23:50:24

by Aya Mahfouz

[permalink] [raw]
Subject: [PATCH] char: constify tty_port_operations structs

Constifies tty_port_operations structure in
the char driver since it is not modified
after its initialization.

Detected and found using Coccinelle.

Suggested-by: Julia Lawall <[email protected]>
Signed-off-by: Aya Mahfouz <[email protected]>
---
drivers/char/ttyprintk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index a15ce4e..b098d2d 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -171,7 +171,7 @@ static const struct tty_operations ttyprintk_ops = {
.ioctl = tpk_ioctl,
};

-static struct tty_port_operations null_ops = { };
+static const struct tty_port_operations null_ops = { };

static struct tty_driver *ttyprintk_driver;

--
2.4.3


--
Kind Regards,
Aya Saif El-yazal Mahfouz


2015-12-15 11:17:39

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] char: constify tty_port_operations structs

On Tuesday 15 December 2015 01:50:19 Aya Mahfouz wrote:
> Constifies tty_port_operations structure in
> the char driver since it is not modified
> after its initialization.
>
> Detected and found using Coccinelle.
>
> Suggested-by: Julia Lawall <[email protected]>
> Signed-off-by: Aya Mahfouz <[email protected]>
>

Acked-by: Arnd Bergmann <[email protected]>