From patchwork Thu Sep 17 22:33:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 255394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2764C43464 for ; Thu, 17 Sep 2020 22:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E35D20795 for ; Thu, 17 Sep 2020 22:35:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nic.cz header.i=@nic.cz header.b="G7EVmvmi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbgIQWfo (ORCPT ); Thu, 17 Sep 2020 18:35:44 -0400 Received: from lists.nic.cz ([217.31.204.67]:35872 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbgIQWeL (ORCPT ); Thu, 17 Sep 2020 18:34:11 -0400 Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id B76B514204D; Fri, 18 Sep 2020 00:33:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382038; bh=dpwUnrGSiVS9NDLxxq/du+zF4OLpRLtNHtt1AMGrQdI=; h=From:To:Date; b=G7EVmvmi9kmJYu6Jj6WoQP2l8Vyd5eEwAXFnmMllcqVxtYhaKZB2hr+k3uVCJ4fKa fGKvIPwu8FZW4P7mQlYS+Lcr15AaKksILdyMS9s/p35h8fHSq29j+mLU2N7nPneojT KQsPJqEwOr00VIfAAUkQnlbetWPpa8T9vURHeYhk= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: linux-leds@vger.kernel.org Cc: Pavel Machek , Dan Murphy , =?utf-8?q?On?= =?utf-8?q?d=C5=99ej_Jirman?= , linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , "H . Nikolaus Schaller" , Grant Feng Subject: [PATCH leds v2 30/50] leds: is31fl319x: use struct led_init_data when registering Date: Fri, 18 Sep 2020 00:33:18 +0200 Message-Id: <20200917223338.14164-31-marek.behun@nic.cz> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200917223338.14164-1-marek.behun@nic.cz> References: <20200917223338.14164-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Spamd-Bar: / X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org By using struct led_init_data when registering we do not need to parse `label` DT property. Moreover `label` is deprecated and if it is not present but `color` and `function` are, LED core will compose a name from these properties instead. Signed-off-by: Marek BehĂșn Cc: H. Nikolaus Schaller Cc: Grant Feng --- drivers/leds/leds-is31fl319x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 15bdbc6378d93..ef5b3e08c7313 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -269,6 +269,7 @@ static int is31fl319x_led_register(struct device *dev, struct is31fl319x_chip *is31, struct device_node *np) { + struct led_init_data init_data = {}; struct is31fl319x_led *led; u32 reg; int ret; @@ -292,9 +293,6 @@ static int is31fl319x_led_register(struct device *dev, return -EEXIST; } - if (of_property_read_string(np, "label", &led->cdev.name)) - led->cdev.name = np->name; - ret = of_property_read_string(np, "linux,default-trigger", &led->cdev.default_trigger); if (ret < 0 && ret != -EINVAL) /* is optional */ @@ -303,8 +301,9 @@ static int is31fl319x_led_register(struct device *dev, led->configured = true; led->chip = is31; led->cdev.brightness_set_blocking = is31fl319x_brightness_set; + init_data.fwnode = of_fwnode_handle(np); - ret = devm_led_classdev_register(dev, &led->cdev); + ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data); if (ret) dev_err(dev, "Failed to register LED for node %pOF\n", np);