From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
kernel list
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org,
sakari.ailus-X3B1VOXEql0@public.gmane.org,
s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
Subject: Re: Reading /sys with side effects (was Re: [PATCH 1/2] Documentation: leds: Add description of LED Flash class extension)
Date: Thu, 29 Jan 2015 22:14:20 +0100 [thread overview]
Message-ID: <20150129211420.GA21140@amd> (raw)
In-Reply-To: <54C8A130.8000807-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Hi!
> >>+ - flash_fault - list of flash faults that may have occurred:
> >>+ * led-over-voltage - flash controller voltage to the flash LED
> >>+ has exceededthe limit specific to the flash controller
> >>+ * flash-timeout-exceeded - the flash strobe was still on when
> >>+ the timeout set by the user has expired; not all flash
> >>+ controllers may set this in all such conditions
> >>+ * controller-over-temperature - the flash controller has
> >>+ overheated
> >>+ * controller-short-circuit - the short circuit protection
> >>+ of the flash controller has been triggered
> >>+ * led-power-supply-over-current - current in the LED power
> >>+ supply has exceeded the limit specific to the flash
> >>+ controller
> >>+ * indicator-led-fault - the flash controller has detected
> >>+ a short or open circuit condition on the indicator LED
> >>+ * led-under-voltage - flash controller voltage to the flash
> >>+ LED has been below the minimum limit specific to
> >>+ the flash
> >>+ * controller-under-voltage - the input voltage of the flash
> >>+ controller is below the limit under which strobing the
> >>+ flash at full current will not be possible. The condition
> >>+ persists until this flag is no longer set
> >>+ * led-over-temperature - the temperature of the LED has exceeded
> >>+ its allowed upper limit
> >>+
> >>+ Flash faults are cleared, if possible, by reading the attribute.
> >
> >That's bad. Now you can no longer present flash_fault file as readable
> >to non-root users, and grep -ri foo /sys will interfere with your
> >camera application.
> >
> >Bad interface, just fix it.
>
> In my opinion it isn't crucial for the user to be aware of the
> fact that some non-persistent fault happened right after strobing the
> flash (e.g. over temperature).
>
> I cannot see anything harmful in the situation when someone does grep
> on /sys and clears non-persistent fault on a flash LED device.
So why export the faults at all?
I mean... another user can just read the file in loop, and the camera
application will not get any useful information.
> Also, not all devices may be able to report the faults that happened
> earlier but are not valid at the time of I2C readout. In that case the
> user will never now that the fault has ever occurred, unless they read
> the flash_fault attribute at the proper moment.
>
> In this case we cannot enforce consistent policy for all devices.
Too bad. But lets do a good job at least for devices where we can do a
good job, ok?
> Please describe the use case when clearing the fault on read can be
> harmful, if you have any.
while true; grep -ri foo /sys; done
And no, your application trying to read the faults will very probably
read nothing.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-01-29 21:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 8:07 [PATCH 1/2] Documentation: leds: Add description of LED Flash class extension Jacek Anaszewski
2015-01-27 8:07 ` [PATCH 2/2] DT: leds: Add led-sources property Jacek Anaszewski
2015-01-29 14:55 ` Jacek Anaszewski
2015-01-29 20:28 ` Pavel Machek
2015-01-29 21:03 ` Rob Herring
2015-01-29 22:14 ` Bryan Wu
[not found] ` <CAK5ve-LKBfjRzxK_b0ByEF5uWHfAaBGS2OPznOiYNg9+FJP5Gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-29 22:30 ` Pavel Machek
2015-01-29 22:59 ` Bryan Wu
2015-01-27 22:37 ` Reading /sys with side effects (was Re: [PATCH 1/2] Documentation: leds: Add description of LED Flash class extension) Pavel Machek
2015-01-28 8:43 ` Jacek Anaszewski
[not found] ` <54C8A130.8000807-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-01-29 21:14 ` Pavel Machek [this message]
2015-01-30 8:55 ` Jacek Anaszewski
2015-01-30 16:40 ` Greg KH
2015-02-02 9:07 ` Jacek Anaszewski
2015-02-02 9:44 ` Pavel Machek
2015-02-02 11:55 ` Jacek Anaszewski
2015-02-02 13:51 ` Pavel Machek
2015-02-02 14:51 ` Jacek Anaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150129211420.GA21140@amd \
--to=pavel-+zi9xunit7i@public.gmane.org \
--cc=b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org \
--cc=s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=sakari.ailus-X3B1VOXEql0@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).