Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2815574imu; Tue, 6 Nov 2018 23:23:25 -0800 (PST) X-Google-Smtp-Source: AJdET5cOWb1faJhYjJUJa3G9gaBLPhkiA4yNfl2KoIk1ah+jLb7LR9zaQPkknHKyp+E34wVHbMWa X-Received: by 2002:a63:5442:: with SMTP id e2-v6mr690968pgm.316.1541575405262; Tue, 06 Nov 2018 23:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541575405; cv=none; d=google.com; s=arc-20160816; b=lEt2UIjDzRSa5nRMm7XApPhkSctpWeGmCgWvedcOcfO2K0LQMBMlLUcmGhqjJXzbc9 t/2dD5gEvo6+DDInX9J0xD4nOUiQv+Ks3HJPniq9YMQZUcN6Ub37Y2RNWO8OVs+8k9+Y DzjYG9DXmKGe/xR0SqOR8buwj/+YpBtPLVIJsjT/Zk7C4MDpZIlRKiJkftLXqQWgfUQs H8IhAtXzY9flaShKaP2CywgPkS1X0mPBVNcix2rNgAUxMR5tC8rM14wQKmN7iSZTU088 mOjWa51/IcgAnRTQwRHiz8zy60l0jbw42OKMapb8Dvl/6/7Lfg0TTsq5R1c2/GsgJa9Z l81g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=E/QYVRqWatiPsHyhF/045rmlvu0p5kMoyiWwvimmKNM=; b=dILVid5mFycgbYnArd/mza8kORDFbvnAA/jqp/ypqVeWLKJw4FfYf4nGD8VLJQYTgR YlA17ETs8oK6dFmbne/B87EKSoUPHwROC66GcElhKSAT+RMv/R+e91uGgijPmjD45Dhy 7Dzpjq+gk51aKZo5TpT8Y+Fc5E6BDWQFQCbgv32UBkLvVHk0nUDKF7wD59RJGNj5VfGR YcEoNJghNg0EZmywi6II3evOaaF4dxE5FbIVwR21W0OwvpR9OjEh6OybxWTGS68AW0/a bUQA6Ke3uMJ27UbcIuoSPzomBfeiVlgYLWD1hcADJtwh4hAO2SiYhxwqZgu9LBtFAbIw qZdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M66Q42DV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12-v6si48511131pga.346.2018.11.06.23.23.09; Tue, 06 Nov 2018 23:23:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M66Q42DV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728216AbeKGQvx (ORCPT + 99 others); Wed, 7 Nov 2018 11:51:53 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41218 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeKGQvx (ORCPT ); Wed, 7 Nov 2018 11:51:53 -0500 Received: by mail-lf1-f67.google.com with SMTP id c16so10724017lfj.8 for ; Tue, 06 Nov 2018 23:22:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=E/QYVRqWatiPsHyhF/045rmlvu0p5kMoyiWwvimmKNM=; b=M66Q42DVZ3ZeZQoaPZ1KDKD1qjRpHs/9gaF2pEnvYi6aV7K+cm3zyuIuRycsnaQ7uL vAZuRUdXLBZBqqu39sKYAlrnGc7ZPItxSgn5e+7BfrAJzYd60jjGQxEVObWqlb/eRYiw WvIAQmXYzOJ18aVBMveS94+K17vvTim4RB0ws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=E/QYVRqWatiPsHyhF/045rmlvu0p5kMoyiWwvimmKNM=; b=YaBfWZejg1bG53n5FXdDzSh62X9f637tLBjwZqtdE+gfnp9i3KFFIyU9JzbWD8uSHw 88hINX8bSY16OsgtdbAjUfROgqONt/XUjvD3XSQW1kdoU+/jMwLhvi1uWqbx++J27P8O 2lXVLeVCpt5hAO4e3nOf9F/GI2guVWPxiTe8ClSt730rVqzBnMu850kQ82KgDeX9Pco4 zYndVB8M04wP8Z1fvuykGs5fjj51MuTVayLbzKMX9FwzDMvJDfbQbUMG0/k6hG2OYKL7 2sBG0wZkwElp4lec6MmUIkvhvnf/sy3i51cr4dwTSChmegooXv6MPrTo4DY6Os2xbryr OmNA== X-Gm-Message-State: AGRZ1gIsvB7ZSf4a4XTuUlKS6AwYziCjRMoDIvjD9kxOKk98mMLNYBrj WPk8OSQTl5wthySUbTLBy5ONbP7sUkEv0A5bSAl5+Q== X-Received: by 2002:a19:2203:: with SMTP id i3mr500702lfi.2.1541575366152; Tue, 06 Nov 2018 23:22:46 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a2e:95ca:0:0:0:0:0 with HTTP; Tue, 6 Nov 2018 23:22:45 -0800 (PST) In-Reply-To: <1541542052-10081-7-git-send-email-jacek.anaszewski@gmail.com> References: <1541542052-10081-1-git-send-email-jacek.anaszewski@gmail.com> <1541542052-10081-7-git-send-email-jacek.anaszewski@gmail.com> From: Baolin Wang Date: Wed, 7 Nov 2018 15:22:45 +0800 Message-ID: Subject: Re: [PATCH 06/24] leds: sc27xx-blt: Use led_compose_name() To: Jacek Anaszewski Cc: Linux LED Subsystem , DTML , LKML , Pavel Machek , Rob Herring , Xiaotong Lu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacek, On 7 November 2018 at 06:07, Jacek Anaszewski wrote: > Switch to using generic LED support for composing LED class > device name. > > Signed-off-by: Jacek Anaszewski > Cc: Xiaotong Lu > Cc: Baolin Wang Thanks for simplifying the code, it can work well for SC27XX LED. Tested-by: Baolin Wang > --- > 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 > #include > #include > -#include > > /* 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