From: Maciek Borzecki <maciek.borzecki@gmail.com>
To: Josh Cartwright <joshc@ni.com>
Cc: linux-kernel@vger.kernel.org, Richard Purdie <rpurdie@rpsys.net>,
Jacek Anaszewski <j.anaszewski@samsung.com>,
linux-leds@vger.kernel.org, linux-doc@vger.kernel.org,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH v2 1/3] leds: add device activity LED triggers
Date: Fri, 2 Oct 2015 09:45:37 +0200 [thread overview]
Message-ID: <20151002074537.GC31149@corsair.lan> (raw)
In-Reply-To: <20151001144718.GQ26335@jcartwri.amer.corp.natinst.com>
On 10/01 09:47, Josh Cartwright wrote:
> Hello Maciek-
>
> Some architectural questions below:
>
> On Thu, Oct 01, 2015 at 04:04:31PM +0200, Maciek Borzecki wrote:
> > The patch adds LED triggers for indicating an activity on a selected
> > device. The drivers that intend to use triggers need to register
> > respective devices using ledtrig_dev_add(). Triggers are generated by
> > explicitly calling ledtrig_dev_activity().
> >
> > Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> > ---
> [..]
> > +struct ledtrig_dev_data {
> > + char name[MAX_NAME_LEN];
> > + dev_t dev;
> > + struct led_trigger *trig;
> > + struct list_head node;
> > +};
> > +
> > +/**
> > + * ledtrig_dev_activity - signal activity on device
> > + * @dev: device
> > + *
> > + * Fires a trigger assigned to @dev device.
> > + */
> > +void ledtrig_dev_activity(dev_t dev)
>
> It seems a bit strange to me to associate a device LED trigger with
> dev_t. Some devices don't expose a dev node, some devices expose
> multiple dev nodes...
>
> Is there a reason why you are not tying to the device model?
>
Thanks for the comments.
The first proof of concept used `sturct device` as parameter in all API
calls, but then there's a problem of naming of a trigger in a sane
way. The trigger name followed the same approach as __dev_printk, and
the naming was done in this fashion:
sprintf(..., "dev-%s-%s", dev_driver_string(dev), dev_name(dev));
Then for instance on wandboard, /dev/ttymxc0 and /dev/ttymxc2 would
appear as `dev-serial-2020000` and `dev-serial-21ec000`. In my opinion
this was unnecessarily complicated. Also, if I'm not mistaken, using
this approach the partitions on MMC card or SATA drive would end up with
the same trigger name, as it is a single device. However the the
major:minor numbers assigned to respective partitions are different, and
you'd still be able to say trigger the LEDS on writes to a particular
partition.
Multiple dev nodes will already have different minor numbers, so
their dev_t is different anyway.
As for devices that do not have a dev_t assigned to them one can still
pass a custom tag in ledtrig_dev_add(). It's just a number so as long as
there's no collision in numbering things should be fine.
Hopefull this clears up the things a little.
> > +{
> > + struct ledtrig_dev_data *dev_trig;
> > +
> > + if (!down_read_trylock(&devs_list_lock))
> > + return;
> > +
> > + list_for_each_entry(dev_trig, &devs_list, node) {
> > + if (dev_trig->dev == dev) {
> > + led_trigger_blink_oneshot(dev_trig->trig,
> > + &blink_delay,
> > + &blink_delay,
> > + 0);
> > + break;
> > + }
> > + }
> > + up_read(&devs_list_lock);
> > +}
> > +EXPORT_SYMBOL(ledtrig_dev_activity);
>
> Not _GPL?
I'm ok with EXPORT_SYMBOL_GPL() if that's a policy for new code. Though,
I've looked at other triggers that are called from kernel code, and it
seems that ledtrig-camera is the only one using _GPL.
--
Maciek Borzecki
next prev parent reply other threads:[~2015-10-02 7:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 14:04 [PATCH v2 0/3] leds: add device trigger Maciek Borzecki
2015-10-01 14:04 ` [PATCH v2 1/3] leds: add device activity LED triggers Maciek Borzecki
2015-10-01 14:47 ` Josh Cartwright
2015-10-02 7:45 ` Maciek Borzecki [this message]
2015-10-02 17:08 ` Josh Cartwright
2015-10-02 19:09 ` Maciek Borzecki
2015-10-01 14:04 ` [PATCH v2 2/3] leds: add debugfs to device trigger Maciek Borzecki
2015-10-01 14:04 ` [PATCH v2 3/3] Documentation: leds: document ledtrig-device trigger Maciek Borzecki
2015-10-02 14:27 ` [PATCH v2 0/3] leds: add device trigger Jacek Anaszewski
2015-10-02 16:26 ` Maciek Borzecki
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=20151002074537.GC31149@corsair.lan \
--to=maciek.borzecki@gmail.com \
--cc=corbet@lwn.net \
--cc=j.anaszewski@samsung.com \
--cc=joshc@ni.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.