All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Rudolf Marek <r.marek@assembler.cz>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size
Date: Fri, 22 Sep 2017 15:36:20 +0100	[thread overview]
Message-ID: <20170922143620.13780-1-colin.king@canonical.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Colin King <colin.king@canonical.com>
To: Rudolf Marek <r.marek@assembler.cz>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size
Date: Fri, 22 Sep 2017 14:36:20 +0000	[thread overview]
Message-ID: <20170922143620.13780-1-colin.king@canonical.com> (raw)

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


             reply	other threads:[~2017-09-22 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 14:36 Colin King [this message]
2017-09-22 14:36 ` [PATCH] hwmon: (w83793): make const array watchdog_minors static, reduces object code size Colin King
2017-10-01 14:16 ` Guenter Roeck
2017-10-01 14:16   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170922143620.13780-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=jdelvare@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=r.marek@assembler.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.