Re: [PATCH] Staging: greybus: uart: constify tty_port_operations structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 15, 2016 at 2:23 AM, Johan Hovold <johan@xxxxxxxxxx> wrote:
>
> [ +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@xxxxxxxxx>

Reviewed-by: David Lin <dtwlin@xxxxxxxxx>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux