linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: Vadim Pasternak <vadimp@nvidia.com>
Cc: jacek.anaszewski@gmail.com, linux-leds@vger.kernel.org
Subject: Re: [PATCH led-next 1/1] leds: mlxreg: Allow multi-instantiation of same name LED for modular systems
Date: Wed, 7 Oct 2020 01:15:27 +0200	[thread overview]
Message-ID: <20201007011527.420e03b2@nic.cz> (raw)
In-Reply-To: <20201006165850.17790-1-vadimp@nvidia.com>

On Tue,  6 Oct 2020 19:58:50 +0300
Vadim Pasternak <vadimp@nvidia.com> wrote:

> It could be more than one instance of LED with the same name in the
> modular systems. For example, "status" or "uid" LED can be located
> on chassis and on each line card of modular system.
> In order to avoid conflicts with duplicated names, append platform
> device Id, which is unquie, to LED name after driver name.
> Thus, for example, "status" LED on chassis is to be called, like it is
> called now on non modular systems, on which platform device Id is not
> specified: "mlxreg:status:green". While for the line cards LEDs it will
> be called like: "mlxreg48:status:green", "mlxreg66:status:green",
> etcetera.

:( what types of modules are these? Are they hotpluggable network
adapter or something like that? What should I imagine for
example mlxreg48 device to be?

Btw it would be nice if mlx-platform was converted to Device Tree API
instead of registering each device in a system by hand.

Marek

> 
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> ---
>  drivers/leds/leds-mlxreg.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c
> index 82aea1cd0c12..53130a8656b1 100644
> --- a/drivers/leds/leds-mlxreg.c
> +++ b/drivers/leds/leds-mlxreg.c
> @@ -228,8 +228,12 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv)
>  			brightness = LED_OFF;
>  			led_data->base_color = MLXREG_LED_GREEN_SOLID;
>  		}
> -		snprintf(led_data->led_cdev_name, sizeof(led_data->led_cdev_name),
> -			 "mlxreg:%s", data->label);
> +		if (priv->pdev->id > 0)
> +			sprintf(led_data->led_cdev_name, "%s%d:%s", "mlxreg",
> +				priv->pdev->id, data->label);
> +		else
> +			sprintf(led_data->led_cdev_name, "%s:%s", "mlxreg",
> +				data->label);
>  		led_cdev->name = led_data->led_cdev_name;
>  		led_cdev->brightness = brightness;
>  		led_cdev->max_brightness = LED_ON;


  reply	other threads:[~2020-10-06 23:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 16:58 [PATCH led-next 1/1] leds: mlxreg: Allow multi-instantiation of same name LED for modular systems Vadim Pasternak
2020-10-06 23:15 ` Marek Behun [this message]
2020-10-07  6:07   ` Vadim Pasternak
2020-10-07 12:17     ` Marek Behun
2020-10-07 11:31 ` Pavel Machek
2020-10-07 12:20   ` Marek Behun
2020-10-08  6:16     ` Vadim Pasternak
2020-10-08  7:56       ` Pavel Machek
2020-10-08  8:47         ` Vadim Pasternak
2020-10-08  8:55           ` Marek Behun
2020-10-08  9:30             ` Vadim Pasternak
2020-10-08 10:05               ` Pavel Machek
2020-10-08 10:32                 ` Vadim Pasternak
2020-11-25 11:20                   ` Pavel Machek
2020-11-25 12:01                     ` Vadim Pasternak
2020-12-30 18:48                       ` Pavel Machek
2020-10-08 10:32               ` Marek Behun
2020-10-12 10:14                 ` Vadim Pasternak
2020-10-21  8:33                   ` Pavel Machek
2020-10-21 12:29                     ` Vadim Pasternak

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=20201007011527.420e03b2@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=vadimp@nvidia.com \
    /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).