Re: [Uclinux-dist-devel] [PATCH] ad525x_dpot: new driver for AD525x digital potentiometers

From: Mike Frysinger
Date: Tue Sep 29 2009 - 21:44:48 EST


On Tue, Sep 29, 2009 at 21:27, Andrew Morton wrote:
> On Tue, 29 Sep 2009 21:14:37 -0400 Mike Frysinger wrote:
>> > + __ __ __ if (reg & AD525X_REG_TOL)
>> > + __ __ __ __ __ __ __ return sprintf(buf, "0x%04x\n", value & 0xFFFF);
>> > + __ __ __ else
>> > + __ __ __ __ __ __ __ return sprintf(buf, "%u\n", value & data->rdac_mask);
>> >
>> > which makes me suspect that the proposed userspace interface is quite
>> > poor.
>>
>> not really.
>
> Think so. ÂWe have a sysfs file which under some circumstances will
> return a decimal number and which under others will return a hex
> number. ÂSo userspace is supposed to look for the leading 0x to work
> out how to interpret that number?
>
> Or something. ÂWhatever. ÂPerhaps it all makes sense when one has seen
> the overall description.

no, you're looking at one common function which is called by different
sysfs files. no point in copying & pasting the same code over and
over. all of the rdac files display as a hex file while all the
non-rdac files display as a decimal.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/