• Gargi Sharma's avatar
    staging: dgnc: Constify ktermios structure · 541e68e0
    Gargi Sharma authored
    The ktermios structure is a local default termios struct. All ports
    are initially created with this termios. Since, the structure is
    never modified, it can be declared as const.
    
    Coccinelle Script:
    @r disable optional_qualifier@
    identifier s,i;
    position p;
    @@
    static struct ktermios i@p = { ... };
    
    @ok1@
    identifier r.i;
    expression e;
    position p;
    @@
    e = i@p
    
    @bad@
    position p != {r.p,ok1.p};
    identifier r.i;
    @@
    e@i@p
    
    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct ktermios i = { ... };
    
    File Size before:
    
    text	data   bss   dec    hex	  filename
    25469	2048   256   27773  6c7d  drivers/staging/dgnc/dgnc_tty.o
    
    File Size after:
    
    text	data	bss	dec	hex	filename
    25636	2016	256	27908	6d04	drivers/staging/dgnc/dgnc_tty.o
    Signed-off-by: default avatarGargi Sharma <gs051095@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    541e68e0
dgnc_tty.c 63.8 KB