Re: [RESEND PATCH v17 00/17] Multi Color LED Framework

From: Pavel Machek
Date: Wed Feb 26 2020 - 08:01:15 EST


Hi!

> > The fact that it changes API makes it important to get it right, and
> > hard/impossible to fix it once it is merged... and I don't think this
> > is the right interface (sorry).
> >
> > In particular, I don't think having directory per channel is a good
> > idea. It makes atomic updates impossible (minor),
>
> It is possible via brightness file, although it will need first writing
> intensity files, which only will cache colors, and actual write to hw
> occurs on write to brightness file. This has been discussed dozen of
> times throughout last year, and you even proposed the formula for
> calculating per-color-subled brightness basing on global brightness and
> intensity set for each color.

You are right, it is possible to make updates atomic with right kind
of latching (which is quite confusing).

> > but will also
> > increase memory consuption (to a point where led-per-channel might
> > be cheaper), and will make userspace do 3x ammount of syscalls in the
> > common case.
> >
> > And we can do better; sysfs files with arrays are okay. So I'd like to
> > see
>
> Let's first achieve broader consensus on this statement before we
> move forward with such design. Sysfs maintainer seems to be the best
> person to consult at first.

This is actually documented:

Documentation/filesystems/sysfs.txt

<quote>
Attributes should be ASCII text files, preferably with only one value
per file. It is noted that it may not be efficient to contain only one
value per file, so it is socially acceptable to express an array of
values of the same type.

Mixing types, expressing multiple lines of data, and doing fancy
formatting of data is heavily frowned upon. Doing these things may get
you publicly humiliated and your code rewritten without notice.
</quote>

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: PGP signature