linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mgag200: make array m_div_val static, shrinks object size
@ 2018-11-29 23:40 Colin King
  0 siblings, 0 replies; 2+ messages in thread
From: Colin King @ 2018-11-29 23:40 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, dri-devel; +Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  32339	   1728	      0	  34067	   8513	mgag200/mgag200_mode.o

After:
   text	   data	    bss	    dec	    hex	filename
  32215	   1792	      0	  34007	   84d7	mgag200/mgag200_mode.o

(gcc version 8.2.0 x86_64)

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

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index acf7bfe68454..9939f0174bf7 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -629,7 +629,7 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock)
 	unsigned int p, m, n;
 	unsigned int computed, vco;
 	int tmp;
-	const unsigned int m_div_val[] = { 1, 2, 4, 8 };
+	static const unsigned int m_div_val[] = { 1, 2, 4, 8 };
 
 	m = n = p = 0;
 	vcomax = 1488000;
-- 
2.19.1


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

* Re: [PATCH] drm/mgag200: make array m_div_val static, shrinks object size
@ 2018-11-30  8:18 Walter Harms
  0 siblings, 0 replies; 2+ messages in thread
From: Walter Harms @ 2018-11-30  8:18 UTC (permalink / raw)
  To: Colin King
  Cc: David Airlie, Daniel Vetter, dri-devel, kernel-janitors, linux-kernel


Am 30.11.2018 00:40, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array m_div_val on the stack but instead
> make it static. Makes the object code smaller by 60 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   32339	   1728	      0	  34067	   8513	mgag200/mgag200_mode.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   32215	   1792	      0	  34007	   84d7	mgag200/mgag200_mode.o
> 
> (gcc version 8.2.0 x86_64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c
> b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index acf7bfe68454..9939f0174bf7 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -629,7 +629,7 @@ static int mga_g200er_set_plls(struct mga_device *mdev,
> long clock)
>  	unsigned int p, m, n;
>  	unsigned int computed, vco;
>  	int tmp;
> -	const unsigned int m_div_val[] = { 1, 2, 4, 8 };
> +	static const unsigned int m_div_val[] = { 1, 2, 4, 8 };

hi,
is that array needed at all ? obvious it is 2^n
i found only one use:
 computed = vco / (m_div_val[testm] * (testo + 1));

just my 2 cents,

re,
 wh


>  
>  	m = n = p = 0;
>  	vcomax = 1488000;

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

end of thread, other threads:[~2018-11-30  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 23:40 [PATCH] drm/mgag200: make array m_div_val static, shrinks object size Colin King
2018-11-30  8:18 Walter Harms

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