[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180510112229.GE6977@amd>
Date: Thu, 10 May 2018 13:22:29 +0200
From: Pavel Machek <pavel@....cz>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>, Johan Hovold <johan@...nel.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
linux-serial@...r.kernel.org, linux-leds@...r.kernel.org,
linux-can@...r.kernel.org, kernel@...gutronix.de,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
linux-kernel@...r.kernel.org, Robin Murphy <robin.murphy@....com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3 1/3] leds: triggers: provide
led_trigger_register_format()
On Thu 2018-05-10 13:21:01, Pavel Machek wrote:
> Hi!
>
> > This allows one to simplify drivers that provide a trigger with a
> > non-constant name (e.g. one trigger per device with the trigger name
> > depending on the device's name).
> >
> > Internally the memory the name member of struct led_trigger points to
> > now always allocated dynamically instead of just taken from the caller.
> >
> > The function led_trigger_rename_static() must be changed accordingly and
> > was renamed to led_trigger_rename() for consistency, with the only user
> > adapted.
>
> Well, I'm not sure if we want to have _that_ many trigger. Trigger
> interface is going to become.. "interesting".
>
> We have 4K limit on total number of triggers. We use rather strange
> interface to select trigger.
>
> > @@ -115,13 +115,13 @@ static int can_led_notifier(struct notifier_block *nb, unsigned long msg,
> >
> > if (msg == NETDEV_CHANGENAME) {
> > snprintf(name, sizeof(name), "%s-tx", netdev->name);
> > - led_trigger_rename_static(name, priv->tx_led_trig);
> > + led_trigger_rename(priv->tx_led_trig, name);
> >
> > snprintf(name, sizeof(name), "%s-rx", netdev->name);
> > - led_trigger_rename_static(name, priv->rx_led_trig);
> > + led_trigger_rename(priv->rx_led_trig, name);
> >
> > snprintf(name, sizeof(name), "%s-rxtx", netdev->name);
> > - led_trigger_rename_static(name, priv->rxtx_led_trig);
> > + led_trigger_rename(priv->rxtx_led_trig, name);
> > }
> >
>
> I know this is not your fault, but if you have a space or "[]" in
> netdev names, confusing things will happen.
Hmm. If we are doing this we really should check trigger names for
forbidden characters. At least "[] " should be forbidden.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists