All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Johan Hovold <johan@kernel.org>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	linux-serial@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-can@vger.kernel.org, kernel@pengutronix.de,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	linux-kernel@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 1/3] leds: triggers: provide led_trigger_register_format()
Date: Thu, 10 May 2018 13:21:01 +0200	[thread overview]
Message-ID: <20180510112101.GD6977@amd> (raw)
In-Reply-To: <20180508100543.12559-2-u.kleine-koenig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1777 bytes --]

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.

I believe we should have triggers "net-rx, net-tx" and it should have
parameter "which device it acts on". 
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: pavel@ucw.cz (Pavel Machek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/3] leds: triggers: provide led_trigger_register_format()
Date: Thu, 10 May 2018 13:21:01 +0200	[thread overview]
Message-ID: <20180510112101.GD6977@amd> (raw)
In-Reply-To: <20180508100543.12559-2-u.kleine-koenig@pengutronix.de>

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.

I believe we should have triggers "net-rx, net-tx" and it should have
parameter "which device it acts on". 
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180510/4e84c1e3/attachment.sig>

  parent reply	other threads:[~2018-05-10 11:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 10:05 [PATCH v3 0/3] led_trigger_register_format and tty triggers Uwe Kleine-König
2018-05-08 10:05 ` Uwe Kleine-König
2018-05-08 10:05 ` [PATCH v3 1/3] leds: triggers: provide led_trigger_register_format() Uwe Kleine-König
2018-05-08 10:05   ` Uwe Kleine-König
2018-05-08 19:33   ` Jacek Anaszewski
2018-05-08 19:33     ` Jacek Anaszewski
2018-05-08 20:17     ` Uwe Kleine-König
2018-05-08 20:17       ` Uwe Kleine-König
2018-05-09 19:57       ` Jacek Anaszewski
2018-05-09 19:57         ` Jacek Anaszewski
2018-05-10 11:21   ` Pavel Machek [this message]
2018-05-10 11:21     ` Pavel Machek
2018-05-10 11:22     ` Pavel Machek
2018-05-10 11:22       ` Pavel Machek
2018-05-12 18:59       ` Uwe Kleine-König
2018-05-12 18:59         ` Uwe Kleine-König
2018-05-13 14:34       ` Andy Shevchenko
2018-05-13 14:34         ` Andy Shevchenko
2018-05-08 10:05 ` [PATCH v3 2/3] can: simplify LED trigger handling Uwe Kleine-König
2018-05-08 10:05   ` Uwe Kleine-König
2018-05-08 11:04   ` Marc Kleine-Budde
2018-05-08 11:04     ` Marc Kleine-Budde
2018-05-08 10:05 ` [PATCH v3 3/3] tty: implement led triggers Uwe Kleine-König
2018-05-08 10:05   ` Uwe Kleine-König
2018-05-08 10:08   ` Johan Hovold
2018-05-08 10:08     ` Johan Hovold
2018-05-08 10:51     ` Uwe Kleine-König
2018-05-08 10:51       ` Uwe Kleine-König
2018-05-13 14:23   ` Andy Shevchenko
2018-05-13 14:23     ` Andy Shevchenko

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=20180510112101.GD6977@amd \
    --to=pavel@ucw.cz \
    --cc=f.fainelli@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=johan@kernel.org \
    --cc=jslaby@suse.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=robin.murphy@arm.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.