linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Linux LED Subsystem <linux-leds@vger.kernel.org>,
	DTML <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Rob Herring <robh@kernel.org>,
	Xiaotong Lu <xiaotong.lu@spreadtrum.com>
Subject: Re: [PATCH 06/24] leds: sc27xx-blt: Use led_compose_name()
Date: Wed, 7 Nov 2018 15:22:45 +0800	[thread overview]
Message-ID: <CAMz4kuL9r7pOiqVm9vD4G0AOXe6_UN2nTGmCchp=TVy98XLWJw@mail.gmail.com> (raw)
In-Reply-To: <1541542052-10081-7-git-send-email-jacek.anaszewski@gmail.com>

Hi Jacek,

On 7 November 2018 at 06:07, Jacek Anaszewski
<jacek.anaszewski@gmail.com> wrote:
> Switch to using generic LED support for composing LED class
> device name.
>
> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Cc: Xiaotong Lu <xiaotong.lu@spreadtrum.com>
> Cc: Baolin Wang <baolin.wang@linaro.org>

Thanks for simplifying the code, it can work well for SC27XX LED.
Tested-by: Baolin Wang <baolin.wang@linaro.org>

> ---
>  drivers/leds/leds-sc27xx-bltc.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c
> index 9d9b7aa..9fe7cb1 100644
> --- a/drivers/leds/leds-sc27xx-bltc.c
> +++ b/drivers/leds/leds-sc27xx-bltc.c
> @@ -6,7 +6,6 @@
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
> -#include <uapi/linux/uleds.h>
>
>  /* PMIC global control register definition */
>  #define SC27XX_MODULE_EN0      0xc08
> @@ -36,7 +35,7 @@
>  #define SC27XX_LEDS_MAX                3
>
>  struct sc27xx_led {
> -       char name[LED_MAX_NAME_SIZE];
> +       struct fwnode_handle *fwnode;
>         struct led_classdev ldev;
>         struct sc27xx_led_priv *priv;
>         u8 line;
> @@ -132,16 +131,22 @@ static int sc27xx_led_register(struct device *dev, struct sc27xx_led_priv *priv)
>
>         for (i = 0; i < SC27XX_LEDS_MAX; i++) {
>                 struct sc27xx_led *led = &priv->leds[i];
> +               struct led_init_data init_data = { led->fwnode };
>
>                 if (!led->active)
>                         continue;
>
> +               err = led_compose_name(led->fwnode, "sc27xx", ":",
> +                                      init_data.name);
> +               if (err)
> +                       return err;
> +
>                 led->line = i;
>                 led->priv = priv;
> -               led->ldev.name = led->name;
>                 led->ldev.brightness_set_blocking = sc27xx_led_set;
>
> -               err = devm_led_classdev_register(dev, &led->ldev);
> +               err = devm_led_classdev_register_ext(dev, &led->ldev,
> +                                                    &init_data);
>                 if (err)
>                         return err;
>         }
> @@ -154,7 +159,6 @@ static int sc27xx_led_probe(struct platform_device *pdev)
>         struct device *dev = &pdev->dev;
>         struct device_node *np = dev->of_node, *child;
>         struct sc27xx_led_priv *priv;
> -       const char *str;
>         u32 base, count, reg;
>         int err;
>
> @@ -196,15 +200,8 @@ static int sc27xx_led_probe(struct platform_device *pdev)
>                         return -EINVAL;
>                 }
>
> +               priv->leds[reg].fwnode = of_fwnode_handle(child);
>                 priv->leds[reg].active = true;
> -
> -               err = of_property_read_string(child, "label", &str);
> -               if (err)
> -                       snprintf(priv->leds[reg].name, LED_MAX_NAME_SIZE,
> -                                "sc27xx::");
> -               else
> -                       snprintf(priv->leds[reg].name, LED_MAX_NAME_SIZE,
> -                                "sc27xx:%s", str);
>         }
>
>         err = sc27xx_led_register(dev, priv);
> --
> 2.1.4
>



-- 
Baolin Wang
Best Regards

  reply	other threads:[~2018-11-07  7:22 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 22:07 [PATCH 00/24] Add generic support for composing LED class device name Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 01/24] leds: class: Improve LED and LED flash class registration API Jacek Anaszewski
2018-11-07  6:55   ` Baolin Wang
2018-11-07 20:51     ` Jacek Anaszewski
2018-11-08 17:50   ` Dan Murphy
2018-11-08 20:47     ` Jacek Anaszewski
2018-11-11 11:31   ` Pavel Machek
2018-11-06 22:07 ` [PATCH 02/24] leds: core: Add support for composing LED class device names Jacek Anaszewski
2018-11-07  7:20   ` Baolin Wang
2018-11-08 20:47     ` Jacek Anaszewski
2018-11-09  2:35       ` Baolin Wang
2018-11-08 18:06   ` Dan Murphy
2018-11-08 20:48     ` Jacek Anaszewski
2018-11-11 12:02   ` Pavel Machek
2018-11-11 20:02     ` Jacek Anaszewski
2018-11-11 20:16       ` Pavel Machek
2018-11-11 21:14         ` Jacek Anaszewski
2018-11-12  0:01           ` Vesa Jääskeläinen
2018-11-12 15:59             ` Jacek Anaszewski
2018-11-12 21:25             ` Linus Walleij
2018-11-12 22:11               ` LEDs on USB keyboards was " Pavel Machek
2018-11-12 10:35           ` Pavel Machek
2018-11-12 16:01             ` Jacek Anaszewski
2018-11-12 19:05               ` Pavel Machek
2018-11-12 20:11                 ` Jacek Anaszewski
2018-11-12 22:06                   ` Pavel Machek
2018-11-13 20:57                     ` Jacek Anaszewski
2018-11-13 21:38                     ` Geert Uytterhoeven
2018-11-13 21:50                       ` Pavel Machek
2018-11-12 21:23     ` Linus Walleij
2018-11-13 19:55       ` Jacek Anaszewski
2018-11-15  9:10         ` Linus Walleij
2018-11-06 22:07 ` [PATCH 03/24] leds: dt-bindings: Add LED_FUNCTION definitions Jacek Anaszewski
2018-11-07  8:36   ` Vokáč Michal
2018-11-07 19:28     ` Jacek Anaszewski
2018-11-08 15:13   ` Rob Herring
2018-11-08 21:03     ` Jacek Anaszewski
2018-11-11 11:31   ` Pavel Machek
2018-11-11 20:02     ` Jacek Anaszewski
2018-11-11 20:20       ` Pavel Machek
2018-11-11 21:16         ` Jacek Anaszewski
2018-11-12  0:25   ` Vesa Jääskeläinen
2018-11-12 16:01     ` Jacek Anaszewski
2018-11-15  9:16   ` Linus Walleij
2018-11-06 22:07 ` [PATCH 04/24] dt-bindings: leds: Add function and color properties Jacek Anaszewski
2018-11-08 18:00   ` Dan Murphy
2018-11-08 20:47     ` Jacek Anaszewski
2018-11-08 21:08       ` Dan Murphy
2018-11-09 20:00         ` Jacek Anaszewski
2018-11-09  8:32   ` Vesa Jääskeläinen
2018-11-09 20:42     ` Jacek Anaszewski
2018-11-10 17:19       ` Vesa Jääskeläinen
2018-11-12 16:02         ` Jacek Anaszewski
2018-11-13  7:10           ` Vesa Jääskeläinen
2018-11-13 19:02             ` Jacek Anaszewski
     [not found]   ` <5bea0eb8.1c69fb81.6b921.80e6@mx.google.com>
2018-11-13 20:57     ` Jacek Anaszewski
2018-11-27 20:37       ` Jacek Anaszewski
2018-11-30 14:38         ` Rob Herring
2018-11-30 21:08           ` Pavel Machek
2018-11-30 22:19             ` Rob Herring
2018-12-01 21:17               ` Jacek Anaszewski
2018-12-11 17:27                 ` Rob Herring
2018-12-11 22:44                   ` Pavel Machek
2018-12-21 10:12                   ` Linus Walleij
2018-12-12  9:59           ` Pavel Machek
2018-12-12 13:56             ` Rob Herring
2018-12-12 18:32               ` Pavel Machek
2018-12-23 20:11                 ` Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 05/24] dt-bindings: sc27xx-blt: " Jacek Anaszewski
2018-11-11 14:29   ` Pavel Machek
2018-11-11 20:03     ` Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 06/24] leds: sc27xx-blt: Use led_compose_name() Jacek Anaszewski
2018-11-07  7:22   ` Baolin Wang [this message]
2018-11-11 14:31   ` Pavel Machek
2018-11-06 22:07 ` [PATCH 07/24] dt-bindings: lt3593: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 08/24] leds: lt3593: Use led_compose_name() Jacek Anaszewski
2018-11-07 19:37   ` Daniel Mack
2018-11-07 19:49     ` Jacek Anaszewski
2018-11-08  8:33       ` Daniel Mack
2018-11-06 22:07 ` [PATCH 09/24] dt-bindings: lp8860: Add function and color properties Jacek Anaszewski
2018-11-08 18:01   ` Dan Murphy
2018-11-06 22:07 ` [PATCH 10/24] leds: lp8860: Use led_compose_name() Jacek Anaszewski
2018-11-08 18:16   ` Dan Murphy
2018-11-08 20:48     ` Jacek Anaszewski
2018-11-12 14:05       ` Dan Murphy
2018-11-06 22:07 ` [PATCH 11/24] dt-bindings: lm3692x: Add function and color properties Jacek Anaszewski
2018-11-08 18:12   ` Dan Murphy
2018-11-06 22:07 ` [PATCH 12/24] leds: lm3692x: Use led_compose_name() Jacek Anaszewski
2018-11-08 18:14   ` Dan Murphy
2018-11-08 20:48     ` Jacek Anaszewski
2018-11-08 21:11       ` Dan Murphy
2018-11-11 14:31   ` Pavel Machek
2018-11-06 22:07 ` [PATCH 13/24] dt-bindings: lm36010: Add function and color properties Jacek Anaszewski
2018-11-08 18:15   ` Dan Murphy
2018-11-06 22:07 ` [PATCH 14/24] leds: lm3601x: Use led_compose_name() Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 15/24] dt-bindings: cr0014114: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 16/24] leds: cr0014114: Use led_compose_name() Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 17/24] dt-bindings: aat1290: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 18/24] leds: aat1290: Use led_compose_name() Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 19/24] dt-bindings: as3645a: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 20/24] leds: as3645a: Use led_compose_name() Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 21/24] dt-bindings: leds-gpio: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 22/24] leds: gpio: Use led_compose_name() Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 23/24] dt-bindings: an30259a: Add function and color properties Jacek Anaszewski
2018-11-06 22:07 ` [PATCH 24/24] leds: an30259a: Use led_compose_name() 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='CAMz4kuL9r7pOiqVm9vD4G0AOXe6_UN2nTGmCchp=TVy98XLWJw@mail.gmail.com' \
    --to=baolin.wang@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.org \
    --cc=xiaotong.lu@spreadtrum.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).