All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Colin King <colin.king@canonical.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: mtdswap: make array 'name' static const, shrinks object size
Date: Mon, 18 Dec 2017 16:21:34 +0000	[thread overview]
Message-ID: <20171218172134.7fa7df8c@bbrezillon> (raw)
In-Reply-To: <20171128185946.25026-1-colin.king@canonical.com>

On Tue, 28 Nov 2017 18:59:46 +0000
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> 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>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/mtdswap.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
> index f07492c6f4b2..7eb0e1f4f980 100644
> --- a/drivers/mtd/mtdswap.c
> +++ b/drivers/mtd/mtdswap.c
> @@ -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);
>  


WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Colin King <colin.king@canonical.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: mtdswap: make array 'name' static const, shrinks object size
Date: Mon, 18 Dec 2017 17:21:34 +0100	[thread overview]
Message-ID: <20171218172134.7fa7df8c@bbrezillon> (raw)
In-Reply-To: <20171128185946.25026-1-colin.king@canonical.com>

On Tue, 28 Nov 2017 18:59:46 +0000
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> 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>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/mtdswap.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
> index f07492c6f4b2..7eb0e1f4f980 100644
> --- a/drivers/mtd/mtdswap.c
> +++ b/drivers/mtd/mtdswap.c
> @@ -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);
>  

  reply	other threads:[~2017-12-18 16:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 18:59 [PATCH] mtd: mtdswap: make array 'name' static const, shrinks object size Colin King
2017-12-18 16:21 ` Boris Brezillon [this message]
2017-12-18 16:21   ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218172134.7fa7df8c@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=colin.king@canonical.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.