linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Hermes Zhang <chenhui.zhang@axis.com>
Cc: dmurphy@ti.com, robh+dt@kernel.org, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	chenhuiz@axis.com, lkml@axis.com, kernel@axis.com
Subject: Re: [PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver
Date: Fri, 26 Mar 2021 14:49:39 +0100	[thread overview]
Message-ID: <20210326134939.GA11578@duo.ucw.cz> (raw)
In-Reply-To: <20210326052801.17666-3-chenhui.zhang@axis.com>

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

Hi!

> Introduce a new multiple GPIOs LED driver. This LED will made of
> multiple GPIOs (up to 8) and will map different brightness to different
> GPIOs states which defined in dts file.
> 
> Signed-off-by: Hermes Zhang <chenhuiz@axis.com>


> index 000000000000..7aef82701f86
> --- /dev/null
> +++ b/drivers/leds/simple/Kconfig
> @@ -0,0 +1,23 @@
> +menuconfig LEDS_SIMPLE
> +	bool "Simple LED support"
> +	depends on LEDS_CLASS
> +	help
> +	  This option enables simple leds support for the leds class.
> +	  If unsure, say Y.

No need for new config symbol.

> +	if (ret != 1 << gpios->ndescs) {

I'd do (ret != (1 << gpios->ndescs))

> +	priv = devm_kzalloc(dev, sizeof(struct multi_gpio_led_priv)
> +			+ sizeof(u8) * nr_states , GFP_KERNEL);

Sizeof(u8) is always 1, no need for space before , . 

> +	of_property_read_string(node, "default-state", &state);
> +	if (!strcmp(state, "on"))
> +		multi_gpio_led_set(&priv->cdev, priv->cdev.max_brightness);
> +	else
> +		multi_gpio_led_set(&priv->cdev, 0);

No need for default-state handling, unless you are using it.

Best regards,
									Pavel

-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2021-03-26 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  5:27 [PATCH v2 0/2] New multiple GPIOs LED driver Hermes Zhang
2021-03-26  5:28 ` [PATCH v2 1/2] dt-binding: leds: Document leds-multi-gpio bindings Hermes Zhang
2021-03-27 18:12   ` Rob Herring
2021-03-29  6:03     ` Hermes Zhang
2021-03-26  5:28 ` [PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver Hermes Zhang
2021-03-26  5:56   ` Alexander Dahl
2021-03-26  6:07     ` Hermes Zhang
2021-03-26 13:49   ` Pavel Machek [this message]
2021-03-29  6:00     ` Hermes Zhang

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=20210326134939.GA11578@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=chenhui.zhang@axis.com \
    --cc=chenhuiz@axis.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=lkml@axis.com \
    --cc=robh+dt@kernel.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).