linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org, dtor@google.com,
	linux@roeck-us.net, dmurphy@ti.com,
	Baolin Wang <baolin.wang@linaro.org>,
	Daniel Mack <daniel@zonque.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Oleh Kravchenko <oleg@kaa.org.ua>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Simon Shields <simon@lineageos.org>
Subject: Re: [PATCH v5 05/26] leds: core: Add support for composing LED class device names
Date: Thu, 4 Jul 2019 00:00:43 +0200	[thread overview]
Message-ID: <20190703220043.GA876@amd> (raw)
In-Reply-To: <20190609190803.14815-6-jacek.anaszewski@gmail.com>

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

Hi!

Sorry for the delay.

> @@ -27,6 +29,18 @@ EXPORT_SYMBOL_GPL(leds_list_lock);
>  LIST_HEAD(leds_list);
>  EXPORT_SYMBOL_GPL(leds_list);
>  
> +const char *led_colors[LED_COLOR_ID_MAX] = {

const char * const , if we want to play that game?


> +	[LED_COLOR_ID_WHITE] = "white",
> +	[LED_COLOR_ID_RED] = "red",
> +	[LED_COLOR_ID_GREEN] = "green",
> +	[LED_COLOR_ID_BLUE] = "blue",
> +	[LED_COLOR_ID_AMBER] = "amber",
> +	[LED_COLOR_ID_VIOLET] = "violet",
> +	[LED_COLOR_ID_YELLOW] = "yellow",
> +	[LED_COLOR_ID_IR] = "ir",
> +};
> +EXPORT_SYMBOL_GPL(led_colors);
> +

> +	if (fwnode_property_present(fwnode, "label")) {
> +		ret = fwnode_property_read_string(fwnode, "label", &props->label);
> +		if (ret)
> +			dev_err(dev, "Error parsing \'label\' property (%d)\n", ret);
> +		return;

I don't think you need to escape ' with \.

> +	if (fwnode_property_present(fwnode, "function")) {
> +		ret = fwnode_property_read_string(fwnode, "function", &props->function);
> +		if (ret) {
> +			dev_err(dev,
> +				"Error parsing \'function\' property (%d)\n",
> +				ret);
> +		}
> +	} else {
> +		return;
> +	}

> +
> +	if (fwnode_property_present(fwnode, "function-enumerator")) {

I'd do if (!fwnode_property_present()) return; in both occasions, to
save an indentation level; but that's nitpicking.

> +	if (props.label) {
> +		/*
> +		 * If init_data.devicename is NULL, then it indicates that
> +		 * DT label should be used as-is for LED class device name.
> +		 * Otherwise the label is prepended with devicename to compose
> +		 * the final LED class device name.
> +		 */
> +		if (!devicename) {
> +			strncpy(led_classdev_name, props.label,
> +				LED_MAX_NAME_SIZE);
> +		} else {
> +			snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s:%s",
> +				 devicename, props.label);
> +		}

Unlike snprintf(), strncpy() does not guarantee NULL termination.

I did not check the shell script.

With that fixed,

Acked-by: Pavel Machek <pavel@ucw.cz>

									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 --]

  parent reply	other threads:[~2019-07-03 22:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-09 19:07 [PATCH v5 00/26] Add generic support for composing LED class device name Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 01/26] leds: class: Improve LED and LED flash class registration API Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 02/26] dt-bindings: leds: Add LED_COLOR_ID definitions Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 03/26] dt-bindings: leds: Add LED_FUNCTION definitions Jacek Anaszewski
2019-11-15 13:01   ` Geert Uytterhoeven
2019-11-15 20:14     ` Jacek Anaszewski
2019-11-25 15:17     ` Pavel Machek
2019-06-09 19:07 ` [PATCH v5 04/26] dt-bindings: leds: Add properties for LED name construction Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 05/26] leds: core: Add support for composing LED class device names Jacek Anaszewski
2019-06-26 19:05   ` Jacek Anaszewski
2019-06-26 20:07     ` Oleh Kravchenko
2019-06-27 18:28       ` Jacek Anaszewski
2019-06-28  8:46   ` Linus Walleij
2019-06-28 13:30     ` David Laight
2019-07-03 22:05       ` Various LED complexities was " Pavel Machek
2019-07-03 22:00   ` Pavel Machek [this message]
2019-07-17 21:03     ` Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 06/26] dt-bindings: sc27xx-blt: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 07/26] leds: sc27xx-blt: Use generic support for composing LED names Jacek Anaszewski
2019-06-10  2:52   ` Baolin Wang
2019-06-09 19:07 ` [PATCH v5 08/26] dt-bindings: lt3593: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 09/26] leds: lt3593: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 10/26] dt-bindings: lp8860: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 11/26] leds: lp8860: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 12/26] dt-bindings: lm3692x: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 13/26] leds: lm3692x: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 14/26] dt-bindings: lm36010: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 15/26] leds: lm3601x: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 16/26] dt-bindings: cr0014114: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 17/26] leds: cr0014114: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 18/26] dt-bindings: aat1290: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 19/26] leds: aat1290: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 20/26] dt-bindings: as3645a: Add function and color properties Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 21/26] leds: as3645a: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:07 ` [PATCH v5 22/26] dt-bindings: leds-gpio: Add function and color properties Jacek Anaszewski
2019-06-09 19:08 ` [PATCH v5 23/26] leds: gpio: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:08 ` [PATCH v5 24/26] dt-bindings: an30259a: Add function and color properties Jacek Anaszewski
2019-06-09 19:08 ` [PATCH v5 25/26] leds: an30259a: Use generic support for composing LED names Jacek Anaszewski
2019-06-09 19:08 ` [PATCH v5 26/26] leds: Document standard LED functions Jacek Anaszewski
2019-07-18 11:03   ` Pavel Machek
2019-07-18 13:31     ` Jacek Anaszewski
2019-07-17 21:14 ` [PATCH v5 00/26] Add generic support for composing LED class device name Jacek Anaszewski
2019-07-18 10:52   ` Pavel Machek
2019-07-24 21:02     ` Jacek Anaszewski

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=20190703220043.GA876@amd \
    --to=pavel@ucw.cz \
    --cc=baolin.wang@linaro.org \
    --cc=daniel@zonque.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=dtor@google.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=oleg@kaa.org.ua \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=simon@lineageos.org \
    /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).