Re: [lm-sensors] [PATCH 2.6.12-rc4 15/15] drivers/i2c/chips/adm1026.c: use dynamic sysfs callbacks

Jean Delvare
2005-05-19T20:57:55Z

Hi Greg,

> > If we are into code refactoring and driver size shrinking, you may
> > want to take a look at the following patch, which makes it87 even
> > smaller (from 18976 bytes down to 16992 bytes on my system) and IMHO
> > more cleaner.
>
> But this doesn't reduce the binary size of the module, right?

It does, as I just said. The benefit is probably mainly due to the
introduction of loops around device_create_file() calls. The patch
reduces the number of calls (in the binary) from 59 to 20.

> You know, we do have arrays of attributes that can be registered with
> a single call...
>
> I'd recommend using that over this mess anyday :)

Yeah, I'll take a look into this at some point. This should make the
code even more readable and efficient.

> No, I hate HEAD and TAIL macros. This really isn't buying you much
> code savings, you could do it yourself with the __ATTR() macro
> yourself with the same ammount of code I bet...
>
> Or use the new macro that Yani created, that will make it even smaller
> :)

Agreed. This was really a quick hack, not meant for inclusion. Maybe I
should have polished it a bit more before I dared sending it. I'll do so
next time, sorry for the noise.

--
Jean Delvare