Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp755346pxk; Thu, 17 Sep 2020 15:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVWXUUNMtb9ENQSe5RZClqjpWVj9e8ZfsNeLjxINY4229xzoOYfizu5ls+qJc7Iup/l/Ef X-Received: by 2002:aa7:df14:: with SMTP id c20mr35807965edy.334.1600382398221; Thu, 17 Sep 2020 15:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600382398; cv=none; d=google.com; s=arc-20160816; b=ybyjnccFPolR5h/6vEolpWLD6MU2cZhiwpWXJPDI/Jbe2VnWw94YIf8HFeX8fH+vW0 nnr8ZpB1uNVeG35YRivZOLr+LmjstkoaOVf5Hd15P5dutvVk1oz+lY7ED21fRjA4YLst F/eitmvRMvhxQ3cQiXfXzV46uhsPRCn8zMWNUDwjVZ59WPJ9LucKhXxRz+GI7/qeQHz/ lKvqVsfeRrqoCCBEQfK4BE08pZ1u/CRqc4dPUYlQYTiGZGW4T+ru13qQB8ydyGXSbfJT cjJrFHydfP4D1RRM3whe58S5uFcB6dr/dr5Gsiw7ZOEEhlcae0CpmeZt0+5DVukvh10r /GLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+FXte8zCIE3aAoBzwi9VLdL341wEPM5mGtDovYUsntg=; b=Nr1l7qqyhhhUyg1WmEP4hL8fV3fx+JsnawWCYrzOeYmLu0JyYJRUZxLVZ6NSms7ffb YxmU45Nzc79yFpLH6DJFLvH0R4UczVqyBcDwOOQcCiu+9krPrr9bYiuY222k73FgL8YX dvzNMe0AsfvZKto/n9J9alt3BaZ+LUA4xji9iO+qW0Apic63Yi+VG7lC9oEWtjewX/cs SH9Z/Q0dKcIULex2SuzyslevoiScz6F5bSuL+SwTWvNYTTDWmla2gW5kshlqly9w7+hQ VQzRliUaeSvJ0kP37XnzJtXOCTiG+NRc9nNgAK6OYjAA6aqjNV4X0vNrex1rakmroNWL T8Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=m7jnkU0W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nic.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si893628eji.157.2020.09.17.15.39.35; Thu, 17 Sep 2020 15:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=m7jnkU0W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nic.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbgIQWgA (ORCPT + 99 others); Thu, 17 Sep 2020 18:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgIQWeL (ORCPT ); Thu, 17 Sep 2020 18:34:11 -0400 Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6900C061352; Thu, 17 Sep 2020 15:33:59 -0700 (PDT) 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 9A447140A4F; Fri, 18 Sep 2020 00:33:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382037; bh=81EuTMVUBmsnLEzejgo3xcizWjv8hAhA273os+JXhxY=; h=From:To:Date; b=m7jnkU0WVghbOP4jSxqKGZWdCGsz4fRNumnhEuXseDeFy+QM4QeWf3BrnL7YyvTrz BtsKkcJ482vSw8cXvgdNFMjdHw1QOMiUMIUq9K/kjKIdbQDCNee4UIRmAHpnub3jXm e/RHkqfU4/N2qq2t77gvf0V3m2DxUXxGVw2/XxsU= From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: linux-leds@vger.kernel.org Cc: Pavel Machek , Dan Murphy , =?UTF-8?q?Ond=C5=99ej=20Jirman?= , linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , "H . Nikolaus Schaller" , David Rivshin Subject: [PATCH leds v2 24/50] leds: is31fl32xx: use struct led_init_data when registering Date: Fri, 18 Sep 2020 00:33:12 +0200 Message-Id: <20200917223338.14164-25-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.nic.cz X-Spam-Status: No, score=0.00 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-kernel@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: David Rivshin --- drivers/leds/leds-is31fl32xx.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c index 7bacd01289770..279f52931a177 100644 --- a/drivers/leds/leds-is31fl32xx.c +++ b/drivers/leds/leds-is31fl32xx.c @@ -332,9 +332,6 @@ static int is31fl32xx_parse_child_dt(const struct device *dev, int ret = 0; u32 reg; - if (of_property_read_string(child, "label", &cdev->name)) - cdev->name = child->name; - ret = of_property_read_u32(child, "reg", ®); if (ret || reg < 1 || reg > led_data->priv->cdef->channels) { dev_err(dev, @@ -373,6 +370,7 @@ static int is31fl32xx_parse_dt(struct device *dev, int ret = 0; for_each_available_child_of_node(dev_of_node(dev), child) { + struct led_init_data init_data = {}; struct is31fl32xx_led_data *led_data = &priv->leds[priv->num_leds]; const struct is31fl32xx_led_data *other_led_data; @@ -388,17 +386,18 @@ static int is31fl32xx_parse_dt(struct device *dev, led_data->channel); if (other_led_data) { dev_err(dev, - "%s and %s both attempting to use channel %d\n", - led_data->cdev.name, - other_led_data->cdev.name, - led_data->channel); + "Node %pOF 'reg' conflicts with another LED\n", + child); goto err; } - ret = devm_led_classdev_register(dev, &led_data->cdev); + init_data.fwnode = of_fwnode_handle(child); + + ret = devm_led_classdev_register_ext(dev, &led_data->cdev, + &init_data); if (ret) { - dev_err(dev, "failed to register PWM led for %s: %d\n", - led_data->cdev.name, ret); + dev_err(dev, "Failed to register LED for %pOF: %d\n", + child, ret); goto err; } -- 2.26.2