]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Staging: greybus: uart: constify tty_port_operations structure
authorBhumika Goyal <bhumirks@gmail.com>
Sat, 15 Oct 2016 06:58:01 +0000 (12:28 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Oct 2016 07:38:37 +0000 (09:38 +0200)
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>
Reviewed-by: David Lin <dtwlin@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/uart.c

index 5ee7954bd9f91af58091454a478b64e1a0dd7741..8162886bcaed1be59206c8ad8b9cb2d4ab17b57a 100644 (file)
@@ -832,7 +832,7 @@ static const struct tty_operations gb_ops = {
        .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,