All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "Pavel Machek" <pavel@ucw.cz>,
	"Thomas Weißschuh" <thomas@weissschuh.net>,
	"Benson Leung" <bleung@chromium.org>,
	"Guenter Roeck" <groeck@chromium.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	chrome-platform@lists.linux.dev,
	"Dustin Howett" <dustin@howett.net>,
	"Mario Limonciello" <mario.limonciello@amd.com>
Subject: Re: [PATCH 1/5] leds: introduce led_color_name function
Date: Fri, 31 May 2024 16:42:42 +0100	[thread overview]
Message-ID: <20240531154242.GQ1005600@google.com> (raw)
In-Reply-To: <20240520-cros_ec-led-v1-1-4068fc5c051a@weissschuh.net>

It would save me a lot of work if you could follow the conventions of
the subsystem when drafting subjects.

`git log --online -- <subsystem>` is your friend.

> This is similar to the existing led_colors array but is safer to use and
> usable by everyone.

Place spaces between paragraphs or don't line-break at all please.

> Getting string representations of color ids is useful for drivers

"IDs"

> which are handling color ids anyways, for example for the multicolor API.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/leds/led-core.c |  9 +++++++++
>  include/linux/leds.h    | 10 ++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
> index 89c9806cc97f..04a49958458e 100644
> --- a/drivers/leds/led-core.c
> +++ b/drivers/leds/led-core.c
> @@ -534,6 +534,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,
>  }
>  EXPORT_SYMBOL_GPL(led_compose_name);
>  
> +const char *led_color_name(u8 color_id)

led_get_color_name()

> +{
> +	if (color_id >= ARRAY_SIZE(led_colors))
> +		return NULL;
> +
> +	return led_colors[color_id];
> +}
> +EXPORT_SYMBOL_GPL(led_color_name);
> +
>  enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode)
>  {
>  	const char *state = NULL;
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index db6b114bb3d9..0f1b955fa3f7 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -427,6 +427,16 @@ void led_sysfs_enable(struct led_classdev *led_cdev);
>  int led_compose_name(struct device *dev, struct led_init_data *init_data,
>  		     char *led_classdev_name);
>  
> +/**
> + * led_color_name - get string representation of color id
> + * @color_id: The LED_COLOR_ID_* constant
> + *
> + * Get the string name of a LED_COLOR_ID_* constant.
> + *
> + * Returns: A string constant or NULL on an invalid ID.
> + */
> +const char *led_color_name(u8 color_id);


>  /**
>   * led_sysfs_is_disabled - check if LED sysfs interface is disabled
>   * @led_cdev: the LED to query
> 
> -- 
> 2.45.1
> 
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2024-05-31 15:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 10:00 [PATCH 0/5] ChromeOS Embedded Controller LED driver Thomas Weißschuh
2024-05-20 10:00 ` [PATCH 1/5] leds: introduce led_color_name function Thomas Weißschuh
2024-05-31 15:42   ` Lee Jones [this message]
2024-05-20 10:00 ` [PATCH 2/5] leds: multicolor: use " Thomas Weißschuh
2024-05-20 10:00 ` [PATCH 3/5] leds: unexport led_colors array Thomas Weißschuh
2024-05-20 10:00 ` [PATCH 4/5] leds: add ChromeOS EC driver Thomas Weißschuh
2024-05-28  5:09   ` Tzung-Bi Shih
2024-05-28  5:25     ` Thomas Weißschuh
2024-05-28  7:15       ` Tzung-Bi Shih
2024-05-28  7:23         ` Thomas Weißschuh
2024-05-20 10:00 ` [PATCH 5/5] mfd: cros_ec: Register LED subdevice Thomas Weißschuh

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=20240531154242.GQ1005600@google.com \
    --to=lee@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dustin@howett.net \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=mario.limonciello@amd.com \
    --cc=pavel@ucw.cz \
    --cc=thomas@weissschuh.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.