Skip to contentSkip to conversation

hwmon: abituguru: make array probe_order static, makes object smaller

PATCH Applied Colin King 3 participants 3 messages Oct 6, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 hwmon: abituguru: make array probe_order static, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array probe_order on the stack but instead make it static. Makes the object code smaller by 94 bytes.

Before:
text data bss dec hex filename
41473 13448 320 55241 d7c9 drivers/hwmon/abituguru.o

After:
text data bss dec hex filename
41315 13512 320 55147 d76b drivers/hwmon/abituguru.o

(gcc version 9.2.1, amd64)

---
 drivers/hwmon/abituguru.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/abituguru.c +1 -1
index a5cf6b2a6e49..681f0623868f 100644
@@ -1264,7 +1264,7 @@ static int abituguru_probe(struct platform_device *pdev)
 	 * El weirdo probe order, to keep the sysfs order identical to the
 	 * BIOS and window-appliction listing order.
 	 */
-	const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
+	static const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
 		0x00, 0x01, 0x03, 0x04, 0x0A, 0x08, 0x0E, 0x02,
 		0x09, 0x06, 0x05, 0x0B, 0x0F, 0x0D, 0x07, 0x0C };
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array probe_order on the stack but instead make it static. Makes the object code smaller by 94 bytes.

Before:
text data bss dec hex filename
41473 13448 320 55241 d7c9 drivers/hwmon/abituguru.o

Quoted 7 lines

After:
text data bss dec hex filename
41315 13512 320 55147 d76b drivers/hwmon/abituguru.o

(gcc version 9.2.1, amd64)

Looks good to me:

Regards,

Hans

Quoted 18 lines
---
  drivers/hwmon/abituguru.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/abituguru.c +1 -1
index a5cf6b2a6e49..681f0623868f 100644
@@ -1264,7 +1264,7 @@ static int abituguru_probe(struct platform_device *pdev)
  	 * El weirdo probe order, to keep the sysfs order identical to the
  	 * BIOS and window-appliction listing order.
  	 */
-	const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
+	static const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
  		0x00, 0x01, 0x03, 0x04, 0x0A, 0x08, 0x0E, 0x02,
  		0x09, 0x06, 0x05, 0x0B, 0x0F, 0x0D, 0x07, 0x0C };
 
maintainer Applied
#2 lore raw
In reply to Colin King
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array probe_order on the stack but instead make it static. Makes the object code smaller by 94 bytes.

Before:
text data bss dec hex filename
41473 13448 320 55241 d7c9 drivers/hwmon/abituguru.o

Quoted 8 lines

After:
text data bss dec hex filename
41315 13512 320 55147 d76b drivers/hwmon/abituguru.o

(gcc version 9.2.1, amd64)

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/abituguru.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/abituguru.c +1 -1
index a5cf6b2a6e49..681f0623868f 100644
@@ -1264,7 +1264,7 @@ static int abituguru_probe(struct platform_device *pdev)
 	 * El weirdo probe order, to keep the sysfs order identical to the
 	 * BIOS and window-appliction listing order.
 	 */
-	const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
+	static const u8 probe_order[ABIT_UGURU_MAX_BANK1_SENSORS] = {
 		0x00, 0x01, 0x03, 0x04, 0x0A, 0x08, 0x0E, 0x02,
 		0x09, 0x06, 0x05, 0x0B, 0x0F, 0x0D, 0x07, 0x0C };