Re: [PATCH led-next 1/1] leds: mlxreg: Allow multi-instantiation of same name LED for modular systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue,  6 Oct 2020 19:58:50 +0300
Vadim Pasternak <vadimp@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
>  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;




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux