Skip to content

Commit

Permalink
staging: dgnc: Constify ktermios structure
Browse files Browse the repository at this point in the history
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: Gargi Sharma <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gs0510 authored and gregkh committed Mar 7, 2017
1 parent 5ad7288 commit 541e68e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/dgnc/dgnc_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static const struct digi_t dgnc_digi_init = {
* This defines a raw port at 9600 baud, 8 data bits, no parity,
* 1 stop bit.
*/
static struct ktermios default_termios = {
static const struct ktermios default_termios = {
.c_iflag = (DEFAULT_IFLAGS), /* iflags */
.c_oflag = (DEFAULT_OFLAGS), /* oflags */
.c_cflag = (DEFAULT_CFLAGS), /* cflags */
Expand Down

0 comments on commit 541e68e

Please sign in to comment.