linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (asc7621): make several arrays static const
@ 2017-08-30  8:32 Colin King
  2017-08-30 13:32 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-08-30  8:32 UTC (permalink / raw)
  To: George Joseph, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: kernel-janitors, linux-kernel

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

Don't populate the arrays on the stack, instead make them static.
Makes the object code smaller by over 950 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  26144	  18768	    352	  45264	   b0d0	drivers/hwmon/asc7621.o

After:
   text	   data	    bss	    dec	    hex	filename
  25029	  18928	    352	  44309	   ad15	drivers/hwmon/asc7621.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/hwmon/asc7621.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index c77644d45a02..4875e99b59c9 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -512,7 +512,7 @@ static ssize_t show_pwm_ac(struct device *dev,
 {
 	SETUP_SHOW_DATA_PARAM(dev, attr);
 	u8 config, altbit, regval;
-	const u8 map[] = {
+	static const u8 map[] = {
 		0x01, 0x02, 0x04, 0x1f, 0x00, 0x06, 0x07, 0x10,
 		0x08, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f
 	};
@@ -533,7 +533,7 @@ static ssize_t store_pwm_ac(struct device *dev,
 	SETUP_STORE_DATA_PARAM(dev, attr);
 	unsigned long reqval;
 	u8 currval, config, altbit, newval;
-	const u16 map[] = {
+	static const u16 map[] = {
 		0x04, 0x00, 0x01, 0xff, 0x02, 0xff, 0x05, 0x06,
 		0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
 		0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-- 
2.14.1

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

* Re: [PATCH] hwmon: (asc7621): make several arrays static const
  2017-08-30  8:32 [PATCH] hwmon: (asc7621): make several arrays static const Colin King
@ 2017-08-30 13:32 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2017-08-30 13:32 UTC (permalink / raw)
  To: Colin King, George Joseph, Jean Delvare, linux-hwmon
  Cc: kernel-janitors, linux-kernel

On 08/30/2017 01:32 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the arrays on the stack, instead make them static.
> Makes the object code smaller by over 950 bytes:
> 
> Before:
>     text	   data	    bss	    dec	    hex	filename
>    26144	  18768	    352	  45264	   b0d0	drivers/hwmon/asc7621.o
> 
> After:
>     text	   data	    bss	    dec	    hex	filename
>    25029	  18928	    352	  44309	   ad15	drivers/hwmon/asc7621.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>   drivers/hwmon/asc7621.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
> index c77644d45a02..4875e99b59c9 100644
> --- a/drivers/hwmon/asc7621.c
> +++ b/drivers/hwmon/asc7621.c
> @@ -512,7 +512,7 @@ static ssize_t show_pwm_ac(struct device *dev,
>   {
>   	SETUP_SHOW_DATA_PARAM(dev, attr);
>   	u8 config, altbit, regval;
> -	const u8 map[] = {
> +	static const u8 map[] = {
>   		0x01, 0x02, 0x04, 0x1f, 0x00, 0x06, 0x07, 0x10,
>   		0x08, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f
>   	};
> @@ -533,7 +533,7 @@ static ssize_t store_pwm_ac(struct device *dev,
>   	SETUP_STORE_DATA_PARAM(dev, attr);
>   	unsigned long reqval;
>   	u8 currval, config, altbit, newval;
> -	const u16 map[] = {
> +	static const u16 map[] = {
>   		0x04, 0x00, 0x01, 0xff, 0x02, 0xff, 0x05, 0x06,
>   		0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
>   		0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> 


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

end of thread, other threads:[~2017-08-30 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30  8:32 [PATCH] hwmon: (asc7621): make several arrays static const Colin King
2017-08-30 13:32 ` Guenter Roeck

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