From: Johan Hovold <johan@kernel.org>
To: Bhumika Goyal <bhumirks@gmail.com>
Cc: outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org,
dtwlin@gmail.com, johan@kernel.org, elder@kernel.org,
devel@driverdev.osuosl.org
Subject: Re: [PATCH] Staging: greybus: uart: constify tty_port_operations structure
Date: Sat, 15 Oct 2016 11:23:43 +0200 [thread overview]
Message-ID: <20161015092343.GC13900@localhost> (raw)
In-Reply-To: <1476514681-10619-1-git-send-email-bhumirks@gmail.com>
[ +CC: staging list (for real this time) ]
On Sat, Oct 15, 2016 at 12:28:01PM +0530, Bhumika Goyal wrote:
> Declare tty_port_operations structure as const as it is only stored in
> the ops field of a tty_port structure which is a field of a gb_tty
> structure. The ops field is of type const struct tty_port_operations *,
> so tty_port_operations structures having this property can be
> declared as const.
> Done using Coccinelle:
>
> @r1 disable optional_qualifier @
> identifier i;
> position p;
> @@
> static struct tty_port_operations i@p = {...};
>
> @ok1@
> identifier r1.i;
> position p;
> struct gb_tty q;
> @@
> q.port.ops=&i@p
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> static
> +const
> struct tty_port_operations i={...};
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct tty_port_operations i;
>
> File size before:
> text data bss dec hex filename
> 7646 512 56 8214 2016 drivers/staging/greybus/uart.o
>
> File size after:
> text data bss dec hex filename
> 7710 448 56 8214 2016 drivers/staging/greybus/uart.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/staging/greybus/uart.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
> index 5ee7954..8162886 100644
> --- a/drivers/staging/greybus/uart.c
> +++ b/drivers/staging/greybus/uart.c
> @@ -832,7 +832,7 @@ static void gb_tty_port_shutdown(struct tty_port *port)
> .tiocmset = gb_tty_tiocmset,
> };
>
> -static struct tty_port_operations gb_port_ops = {
> +static const struct tty_port_operations gb_port_ops = {
> .dtr_rts = gb_tty_dtr_rts,
> .activate = gb_tty_port_activate,
> .shutdown = gb_tty_port_shutdown,
prev parent reply other threads:[~2016-10-15 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-15 6:58 [PATCH] Staging: greybus: uart: constify tty_port_operations structure Bhumika Goyal
2016-10-15 7:01 ` [Outreachy kernel] " Julia Lawall
2016-10-15 9:21 ` Johan Hovold
2016-10-15 9:23 ` Johan Hovold [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161015092343.GC13900@localhost \
--to=johan@kernel.org \
--cc=bhumirks@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=dtwlin@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.