2005-09-01 06:12:02

by Denis Vlasenko

[permalink] [raw]
Subject: 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


Attachments:
(No filename) (44.00 B)
via686a.patch (677.00 B)
Download all attachments

2005-09-01 16:02:30

by Greg KH

[permalink] [raw]
Subject: Re: i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]

On Thu, Sep 01, 2005 at 09:10:14AM +0300, Denis Vlasenko wrote:
> Not tested, but it's rather obvious.

Except you forgot a "Signed-off-by:" line...

> --- linux-2.6.12.src/drivers/i2c/chips/via686a.c.orig Sun Jun 19 16:10:10 2005
> +++ linux-2.6.12.src/drivers/i2c/chips/via686a.c Tue Aug 30 00:21:39 2005
> @@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, in
> 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 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

2005-09-02 05:55:57

by Denis Vlasenko

[permalink] [raw]
Subject: Re: i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]

On Thursday 01 September 2005 18:59, Greg KH wrote:
> On Thu, Sep 01, 2005 at 09:10:14AM +0300, Denis Vlasenko wrote:
> > Not tested, but it's rather obvious.
>
> Except you forgot a "Signed-off-by:" line...
>
> > --- linux-2.6.12.src/drivers/i2c/chips/via686a.c.orig Sun Jun 19 16:10:10 2005
> > +++ linux-2.6.12.src/drivers/i2c/chips/via686a.c Tue Aug 30 00:21:39 2005
> > @@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, in
> > 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 int16_t tempLUT[] =
>
> int16_t is 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...

> Care to redo this?

Signed-off-by: Denis Vlasenko <[email protected]>
--
vda


Attachments:
(No filename) (946.00 B)
via686a.patch (673.00 B)
Download all attachments

2005-09-03 08:22:15

by Jean Delvare

[permalink] [raw]
Subject: Re: i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]

Hi Denis,

> --- linux-2.6.12.src/drivers/i2c/chips/via686a.c.orig Sun Jun 19 16:10:10 2005
> +++ linux-2.6.12.src/drivers/i2c/chips/via686a.c Tue Aug 30 00:21:39 2005
> @@ -205,7 +205,7 @@ static inline u8 FAN_TO_REG(long rpm, in
> 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,

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,
--
Jean Delvare

2005-09-03 08:26:47

by Jean Delvare

[permalink] [raw]
Subject: Re: i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]

Hi Denis,

BTW...

> 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,
--
Jean Delvare

2005-09-03 12:52:48

by Denis Vlasenko

[permalink] [raw]
Subject: Re: i2c via686a.c: save at least 0.5k of space by long v[256] -> u16 v[256]

On Saturday 03 September 2005 11:26, Jean Delvare wrote:
> Hi Denis,
>
> BTW...
>
> > 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

2005-09-03 14:13:09

by Jean Delvare

[permalink] [raw]
Subject: [PATCH 2.6] hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]

Hi Greg, all,

> 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]>
Signed-off-by: Denis Vlasenko <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>

drivers/hwmon/via686a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.13.orig/drivers/hwmon/via686a.c 2005-08-29 20:54:28.000000000 +0200
+++ linux-2.6.13/drivers/hwmon/via686a.c 2005-09-03 16:05:14.000000000 +0200
@@ -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,

--
Jean Delvare

2005-09-09 21:33:28

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 2.6] hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]

On Sat, Sep 03, 2005 at 04:13:31PM +0200, Jean Delvare wrote:
> Hi Greg, all,
>
> > 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

2005-09-10 21:00:14

by Jean Delvare

[permalink] [raw]
Subject: Re: [PATCH 2.6] hwmon: via686a: save 0.5k by long v[256] -> s16 v[256]

Hi Greg,

> 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]>
Signed-off-by: Jean Delvare <[email protected]>

drivers/hwmon/via686a.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.13-git7.orig/drivers/hwmon/via686a.c 2005-09-08 22:40:16.000000000 +0200
+++ linux-2.6.13-git7/drivers/hwmon/via686a.c 2005-09-10 10:56:12.000000000 +0200
@@ -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)


--
Jean Delvare