On Fri, Feb 27, 2015 at 10:19 PM, folkert <[email protected]> wrote:
>> > Mmm, I was thinking it would be nice to have a (new, redesigned) sysfs
>> > interface for this. :P
>> >
>> > Aren't we going to make things less accessible if we use a char device?
>>
>> Since sysfs has a "one value per file" paradigm, it also has a
>> "one context switch per operation" paradigm, meaning any
>> efficiency-oriented use cases where a lot of stuff needs to be
>> changed in one context switch are by the very construction
>> not suitable for sysfs IMO. That is the use case for ioctl()
>> operations that can pass an entire struct of stuff over.
>>
>> And things like bit-banging a clock+data line which would in
>> a sysfs case involve two context switches (one per value, since
>> that is one file per GPIO line) in an ioctl() case it would be
>> just one, already 50% less context switches for a very basic
>> use case.
>>
>> But I may be just so wrong ... input welcome.
>
> Another bad thing of the current sysfs versions: it is ascii.
> So I need to convert a=1 to a='1' first before write()ing it to the
> file. Very inconvenient because it adds boilerplate code.
> On the other hand, the sysfs is very much extensible.

write(fd, a == 0 ? '0' : '1', 1);

That doesn't look like too much boilerplate to me. And it can easily
be hidden under a dedicated macro/function.
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to