tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size
@ 2017-08-25 16:45 Colin King
  2017-08-25 16:52 ` Jason Gunthorpe
  2017-09-06 11:31 ` Jarkko Sakkinen
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2017-08-25 16:45 UTC (permalink / raw)
  To: Peter Huewe, Marcel Selhorst, Jarkko Sakkinen, Jason Gunthorpe,
	tpmdd-devel
  Cc: linux-kernel

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

Don't populate array cmd_getticks on the stack, instead make it static
const.  Makes the object code smaller by over 160 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  18813	   3152	    128	  22093	   564d	drivers/char/tpm/tpm_tis_core.o

After:
   text	   data	    bss	    dec	    hex	filename
  18554	   3248	    128	  21930	   55aa	drivers/char/tpm/tpm_tis_core.o

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

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 63bc6c3b949e..1e957e923d21 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -445,7 +445,7 @@ static int probe_itpm(struct tpm_chip *chip)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
 	int rc = 0;
-	u8 cmd_getticks[] = {
+	static const u8 cmd_getticks[] = {
 		0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a,
 		0x00, 0x00, 0x00, 0xf1
 	};
-- 
2.14.1

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

* Re: [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size
  2017-08-25 16:45 [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size Colin King
@ 2017-08-25 16:52 ` Jason Gunthorpe
  2017-08-25 17:31   ` Jarkko Sakkinen
  2017-09-06 11:31 ` Jarkko Sakkinen
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2017-08-25 16:52 UTC (permalink / raw)
  To: Colin King
  Cc: Peter Huewe, Marcel Selhorst, Jarkko Sakkinen, tpmdd-devel, linux-kernel

On Fri, Aug 25, 2017 at 05:45:05PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate array cmd_getticks on the stack, instead make it static
> const.  Makes the object code smaller by over 160 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   18813	   3152	    128	  22093	   564d	drivers/char/tpm/tpm_tis_core.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   18554	   3248	    128	  21930	   55aa	drivers/char/tpm/tpm_tis_core.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Jason

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

* Re: [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size
  2017-08-25 16:52 ` Jason Gunthorpe
@ 2017-08-25 17:31   ` Jarkko Sakkinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2017-08-25 17:31 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Colin King, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel

On Fri, Aug 25, 2017 at 10:52:42AM -0600, Jason Gunthorpe wrote:
> On Fri, Aug 25, 2017 at 05:45:05PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > Don't populate array cmd_getticks on the stack, instead make it static
> > const.  Makes the object code smaller by over 160 bytes:
> > 
> > Before:
> >    text	   data	    bss	    dec	    hex	filename
> >   18813	   3152	    128	  22093	   564d	drivers/char/tpm/tpm_tis_core.o
> > 
> > After:
> >    text	   data	    bss	    dec	    hex	filename
> >   18554	   3248	    128	  21930	   55aa	drivers/char/tpm/tpm_tis_core.o
> > 
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Jason

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

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

* Re: [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size
  2017-08-25 16:45 [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size Colin King
  2017-08-25 16:52 ` Jason Gunthorpe
@ 2017-09-06 11:31 ` Jarkko Sakkinen
  1 sibling, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2017-09-06 11:31 UTC (permalink / raw)
  To: Colin King
  Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel

On Fri, Aug 25, 2017 at 05:45:05PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate array cmd_getticks on the stack, instead make it static
> const.  Makes the object code smaller by over 160 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   18813	   3152	    128	  22093	   564d	drivers/char/tpm/tpm_tis_core.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   18554	   3248	    128	  21930	   55aa	drivers/char/tpm/tpm_tis_core.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 63bc6c3b949e..1e957e923d21 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -445,7 +445,7 @@ static int probe_itpm(struct tpm_chip *chip)
>  {
>  	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
>  	int rc = 0;
> -	u8 cmd_getticks[] = {
> +	static const u8 cmd_getticks[] = {
>  		0x00, 0xc1, 0x00, 0x00, 0x00, 0x0a,
>  		0x00, 0x00, 0x00, 0xf1
>  	};
> -- 
> 2.14.1
> 

Applied.

/Jarkko

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

end of thread, other threads:[~2017-09-06 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 16:45 [PATCH] tpm_tis: make array cmd_getticks static const to shink object code size Colin King
2017-08-25 16:52 ` Jason Gunthorpe
2017-08-25 17:31   ` Jarkko Sakkinen
2017-09-06 11:31 ` Jarkko Sakkinen

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).