Skip to content

Commit

Permalink
mtd: mtdswap: make array 'name' static const, shrinks object size
Browse files Browse the repository at this point in the history
Don't populate the read-only array 'name' on the stack but instead
make it static and constify it. Makes the object code smaller by 35
bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  26304	   4444	    352	  31100	   797c	drivers/mtd/mtdswap.o

After:
   text	   data	    bss	    dec	    hex	filename
  26205	   4508	    352	  31065	   7959	drivers/mtd/mtdswap.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  • Loading branch information
Colin Ian King authored and Boris Brezillon committed Dec 16, 2017
1 parent 4fbd8d1 commit bf65710
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/mtd/mtdswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,9 @@ static int mtdswap_show(struct seq_file *s, void *data)
unsigned int max[MTDSWAP_TREE_CNT];
unsigned int i, cw = 0, cwp = 0, cwecount = 0, bb_cnt, mapped, pages;
uint64_t use_size;
char *name[] = {"clean", "used", "low", "high", "dirty", "bitflip",
"failing"};
static const char * const name[] = {
"clean", "used", "low", "high", "dirty", "bitflip", "failing"
};

mutex_lock(&d->mbd_dev->lock);

Expand Down

0 comments on commit bf65710

Please sign in to comment.