[PATCH] pcf50606: Fix wrong indexing in show_chgstate

Arnaud Patard (Rtp) arnaud.patard at rtp-net.org
Fri Jan 25 15:31:14 CET 2008

Andy Green <andy at openmoko.com> writes:

> Somebody in the thread at some point said:
>> [ This patch was sent some time ago to Harald but I forgot to CC: the
>> list. ]
>> The chgstate_names[] array is indexed by power of two and not
>> by bit number. Unfortunately, show_chgstate() is using bit numbers. This
>> results in wrong output when looking at the chgstate sysfs file.
> It's much less of a problem that what you're fixing here, but the "real"
> problem is that the shifted constants are used in that array.  It's
> wasting like 80+ bytes like that in the sparsely populated array of
> pointers to names.

Yeah, you're right but I choose to get things working first and then
fixing that memory waste in a later (not yet written) patch as there are
other places in that driver suffering from the same "bug". See
chgmode_names for instance.


More information about the openmoko-kernel mailing list