linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: cxd2820r: make array tab static const, makes object smaller
@ 2019-09-05 17:45 Colin King
  2019-09-05 17:50 ` NAK: " Colin Ian King
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-09-05 17:45 UTC (permalink / raw)
  To: Antti Palosaari, Mauro Carvalho Chehab, linux-media
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the array tab on the stack but instead make it
static const. Makes the object code smaller by 53 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
   7045	   1736	      0	   8781	   224d	media/dvb-frontends/cxd2820r_c.o

After:
   text	   data	    bss	    dec	    hex	filename
   6896	   1832	      0	   8728	   2218	media/dvb-frontends/cxd2820r_c.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/dvb-frontends/cxd2820r_c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c
index 6f7eedb4c00e..0ba382948c51 100644
--- a/drivers/media/dvb-frontends/cxd2820r_c.c
+++ b/drivers/media/dvb-frontends/cxd2820r_c.c
@@ -298,7 +298,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe)
 	struct cxd2820r_priv *priv = fe->demodulator_priv;
 	struct i2c_client *client = priv->client[0];
 	int ret;
-	struct reg_val_mask tab[] = {
+	static const struct reg_val_mask tab[] = {
 		{ 0x000ff, 0x1f, 0xff },
 		{ 0x00085, 0x00, 0xff },
 		{ 0x00088, 0x01, 0xff },
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* NAK: [PATCH] media: cxd2820r: make array tab static const, makes object smaller
  2019-09-05 17:45 [PATCH] media: cxd2820r: make array tab static const, makes object smaller Colin King
@ 2019-09-05 17:50 ` Colin Ian King
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Ian King @ 2019-09-05 17:50 UTC (permalink / raw)
  To: Antti Palosaari, Mauro Carvalho Chehab, linux-media
  Cc: kernel-janitors, linux-kernel

There are a few more arrays in these drivers than can be fixed up, I'll
send a V2.


On 05/09/2019 18:45, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array tab on the stack but instead make it
> static const. Makes the object code smaller by 53 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    7045	   1736	      0	   8781	   224d	media/dvb-frontends/cxd2820r_c.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    6896	   1832	      0	   8728	   2218	media/dvb-frontends/cxd2820r_c.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/media/dvb-frontends/cxd2820r_c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c
> index 6f7eedb4c00e..0ba382948c51 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_c.c
> +++ b/drivers/media/dvb-frontends/cxd2820r_c.c
> @@ -298,7 +298,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe)
>  	struct cxd2820r_priv *priv = fe->demodulator_priv;
>  	struct i2c_client *client = priv->client[0];
>  	int ret;
> -	struct reg_val_mask tab[] = {
> +	static const struct reg_val_mask tab[] = {
>  		{ 0x000ff, 0x1f, 0xff },
>  		{ 0x00085, 0x00, 0xff },
>  		{ 0x00088, 0x01, 0xff },
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-05 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 17:45 [PATCH] media: cxd2820r: make array tab static const, makes object smaller Colin King
2019-09-05 17:50 ` NAK: " Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).