All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size
@ 2017-09-22 14:36 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-09-22 14:36 UTC (permalink / raw)
  To: Rudolf Marek, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  48019	  38144	    256	  86419	  15193	drivers/hwmon/w83793.o

After:
   text	   data	    bss	    dec	    hex	filename
  47574	  38232	    256	  86062	  1502e	drivers/hwmon/w83793.o

(gcc 6.3.0, x86-64)

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

diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index dab5c515d5a3..5ba9d9f1daa1 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1676,7 +1676,9 @@ static int w83793_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
 	struct device *dev = &client->dev;
-	const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
+	static const int watchdog_minors[] = {
+		WATCHDOG_MINOR, 212, 213, 214, 215
+	};
 	struct w83793_data *data;
 	int i, tmp, val, err;
 	int files_fan = ARRAY_SIZE(w83793_left_fan) / 7;
-- 
2.14.1


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

* [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size
@ 2017-09-22 14:36 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-09-22 14:36 UTC (permalink / raw)
  To: Rudolf Marek, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  48019	  38144	    256	  86419	  15193	drivers/hwmon/w83793.o

After:
   text	   data	    bss	    dec	    hex	filename
  47574	  38232	    256	  86062	  1502e	drivers/hwmon/w83793.o

(gcc 6.3.0, x86-64)

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

diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index dab5c515d5a3..5ba9d9f1daa1 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1676,7 +1676,9 @@ static int w83793_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
 	struct device *dev = &client->dev;
-	const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
+	static const int watchdog_minors[] = {
+		WATCHDOG_MINOR, 212, 213, 214, 215
+	};
 	struct w83793_data *data;
 	int i, tmp, val, err;
 	int files_fan = ARRAY_SIZE(w83793_left_fan) / 7;
-- 
2.14.1


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

* Re: hwmon: (w83793): make const array watchdog_minors static, reduces object code size
  2017-09-22 14:36 ` Colin King
@ 2017-10-01 14:16   ` Guenter Roeck
  -1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2017-10-01 14:16 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Rudolf Marek, Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel

On Fri, Sep 22, 2017 at 03:36:20PM +0100, Colin Ian King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array watchdog_minors on the stack, instead make it
> static. Makes the object code smaller by over 350 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   48019	  38144	    256	  86419	  15193	drivers/hwmon/w83793.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   47574	  38232	    256	  86062	  1502e	drivers/hwmon/w83793.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/w83793.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
> index dab5c515d5a3..5ba9d9f1daa1 100644
> --- a/drivers/hwmon/w83793.c
> +++ b/drivers/hwmon/w83793.c
> @@ -1676,7 +1676,9 @@ static int w83793_probe(struct i2c_client *client,
>  			const struct i2c_device_id *id)
>  {
>  	struct device *dev = &client->dev;
> -	const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
> +	static const int watchdog_minors[] = {
> +		WATCHDOG_MINOR, 212, 213, 214, 215
> +	};
>  	struct w83793_data *data;
>  	int i, tmp, val, err;
>  	int files_fan = ARRAY_SIZE(w83793_left_fan) / 7;

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

* Re: hwmon: (w83793): make const array watchdog_minors static, reduces object code size
@ 2017-10-01 14:16   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2017-10-01 14:16 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Rudolf Marek, Jean Delvare, linux-hwmon, kernel-janitors, linux-kernel

On Fri, Sep 22, 2017 at 03:36:20PM +0100, Colin Ian King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const array watchdog_minors on the stack, instead make it
> static. Makes the object code smaller by over 350 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   48019	  38144	    256	  86419	  15193	drivers/hwmon/w83793.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   47574	  38232	    256	  86062	  1502e	drivers/hwmon/w83793.o
> 
> (gcc 6.3.0, x86-64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/w83793.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
> index dab5c515d5a3..5ba9d9f1daa1 100644
> --- a/drivers/hwmon/w83793.c
> +++ b/drivers/hwmon/w83793.c
> @@ -1676,7 +1676,9 @@ static int w83793_probe(struct i2c_client *client,
>  			const struct i2c_device_id *id)
>  {
>  	struct device *dev = &client->dev;
> -	const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
> +	static const int watchdog_minors[] = {
> +		WATCHDOG_MINOR, 212, 213, 214, 215
> +	};
>  	struct w83793_data *data;
>  	int i, tmp, val, err;
>  	int files_fan = ARRAY_SIZE(w83793_left_fan) / 7;

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

end of thread, other threads:[~2017-10-01 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 14:36 [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size Colin King
2017-09-22 14:36 ` Colin King
2017-10-01 14:16 ` Guenter Roeck
2017-10-01 14:16   ` Guenter Roeck

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.