i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]
Not tested, but it's rather obvious.
--
vda
drivers/i2c/chips/via686a.c renamed from drivers/i2c/chips/via686a.c.orig +1 -1
@@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, inbut the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const int16_t tempLUT[] = {-709 ,-688 ,-667 ,-646 ,-627 ,-607 ,-589 ,-570 ,-553 ,-536 ,-519 ,-503 ,-487 ,-471 ,-456 ,-442 ,-428 ,-414 ,-400 ,-387 ,-375 ,-362 ,-350 ,-339 ,-327 ,-316 ,-305 ,-295 ,-285 ,-275 ,-265 ,
Quoted 1 line · Denis Vlasenko
Not tested, but it's rather obvious.
Except you forgot a "Signed-off-by:" line...
drivers/i2c/chips/via686a.c static inline u8 FAN_TO_REG(long rpm, in · line 208
Quoted 8 lines
drivers/i2c/chips/via686a.c renamed from drivers/i2c/chips/via686a.c.orig +1
-1@@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, inbut the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const int16_t tempLUT[] =
int16_t is not a proper kernel type. Do you really mean s16 instead? Care to redo this?
thanks,
greg k-h
Quoted 5 lines · Greg KH
Quoted 1 line · Denis Vlasenko
Not tested, but it's rather obvious.
Except you forgot a "Signed-off-by:" line...
Quoted 10 lines
drivers/i2c/chips/via686a.c static inline u8 FAN_TO_REG(long rpm, in · line 208
Quoted 8 lines
drivers/i2c/chips/via686a.c renamed from drivers/i2c/chips/via686a.c.orig +1
-1@@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, inbut the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const int16_t tempLUT[] =
int16_tis not a proper kernel type. Do you really mean s16 instead?
Ok. Please be informed that there are lots of intNN_t's in i2c dir tho...
Quoted 1 line
Care to redo this?
--
vda
drivers/i2c/chips/via686a.c renamed from drivers/i2c/chips/via686a.c.orig +1 -1
@@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, inbut the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const s16 tempLUT[] = {-709 ,-688 ,-667 ,-646 ,-627 ,-607 ,-589 ,-570 ,-553 ,-536 ,-519 ,-503 ,-487 ,-471 ,-456 ,-442 ,-428 ,-414 ,-400 ,-387 ,-375 ,-362 ,-350 ,-339 ,-327 ,-316 ,-305 ,-295 ,-285 ,-275 ,-265 ,
Hi Denis,
drivers/i2c/chips/via686a.c static inline u8 FAN_TO_REG(long rpm, in · line 211
Quoted 11 lines
drivers/i2c/chips/via686a.c renamed from drivers/i2c/chips/via686a.c.orig +1
-1@@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, inbut the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const s16 tempLUT[] = {-709 ,-688 ,-667 ,-646 ,-627 ,-607 ,-589 ,-570 ,-553 ,-536 ,-519 ,-503 ,-487 ,-471 ,-456 ,-442 ,-428 ,-414 ,-400 ,-387 ,-375 ,-362 ,-350 ,-339 ,-327 ,-316 ,-305 ,-295 ,-285 ,-275 ,-265 ,
This patch doesn't apply on top of my stack, first because the hardware monitoring drivers have been moved to drivers/hwmon, second because the via686a driver had indentation cleanups since 2.6.12.
Could you please provide this patch against 2.6.13-mm1?
Thanks,
Signature · 1 line
Jean Delvare
PATCH 1/1 hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]
Hi Greg, all,
Quoted 5 lines
This patch doesn't apply on top of my stack, first because the hardware monitoring drivers have been moved to
drivers/hwmon, second because the via686a driver had indentation cleanups since 2.6.12.Could you please provide this patch against 2.6.13-mm1?
On Denis' request, I have done that myself.
------
We can save 0.5kB of data in the via686a driver.
From: Denis Vlasenko <[email protected]>
drivers/hwmon/via686a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/via686a.c +1 -1
@@ -198,7 +198,7 @@but the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const s16 tempLUT[] = {-709 ,-688 ,-667 ,-646 ,-627 ,-607 ,-589 ,-570 ,-553 ,-536 ,-519 ,-503 ,-487 ,-471 ,-456 ,-442 ,-428 ,-414 ,-400 ,-387 ,-375 ,-362 ,-350 ,-339 ,-327 ,-316 ,-305 ,-295 ,-285 ,-275 ,-265 ,
Signature · 1 line
Jean Delvare
Re: [PATCH 2.6] hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]
Quoted 9 lines · Jean Delvare
Hi Greg, all,
Quoted 5 lines
This patch doesn't apply on top of my stack, first because the hardware monitoring drivers have been moved to
drivers/hwmon, second because the via686a driver had indentation cleanups since 2.6.12.Could you please provide this patch against 2.6.13-mm1?
On Denis' request, I have done that myself.
Unfortunatly, no one noticed that this patch adds a build warning :(
So I'm not going to apply it, sorry.
thanks,
greg k-h
Re: [PATCH 2.6] hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]
Hi Greg,
Quoted 1 line
Unfortunatly, no one noticed that this patch adds a build warning :(
I'm sorry about that, I though I had checked but now it seems not. A new patch addressing the issue follows.
Thanks.
----------------------
We can save 0.5kB of data in the via686a driver.
From: Denis Vlasenko <[email protected]>
drivers/hwmon/via686a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/via686a.c +2 -2
@@ -198,7 +198,7 @@but the function is very linear in the useful range (0-80 deg C), so we'll just use linear interpolation for 10-bit readings.) So, tempLUT is the temp at via register values 0-255: */ -static const long tempLUT[] = +static const s16 tempLUT[] = {-709 ,-688 ,-667 ,-646 ,-627 ,-607 ,-589 ,-570 ,-553 ,-536 ,-519 ,-503 ,-487 ,-471 ,-456 ,-442 ,-428 ,-414 ,-400 ,-387 ,-375 ,-362 ,-350 ,-339 ,-327 ,-316 ,-305 ,-295 ,-285 ,-275 ,-265 ,
@@ -270,7 +270,7 @@ }/* for 8-bit temperature hyst and over registers */ -#define TEMP_FROM_REG (val) (tempLUT[(val)] * 100) +#define TEMP_FROM_REG (val) ((long)tempLUT[val] * 100)/* for 10-bit temperature readings */ static inline long TEMP_FROM_REG10 (u16 val)
Signature · 1 line
Jean Delvare
Hi Denis,
BTW...
Quoted 2 lines
Please be informed that there are lots of intNN_t's in i2c dir tho...
I couldn't find any. What were you refering to exactly?
Thanks,
Signature · 1 line
Jean Delvare
Quoted 8 lines · Jean Delvare
Hi Denis,
BTW...
Quoted 2 lines
Please be informed that there are lots of intNN_t's in i2c dir tho...
I couldn't find any. What were you refering to exactly?
Sorry I was wrong. While kernel has ~15000 [u]intNN_t's they are all _not_ in i2c.
--
vda