Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp754715pxk; Thu, 17 Sep 2020 15:38:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVzjwbCSeyqKX2GvJ4Hx6T3avK/fh5EMZQlZTqF/3lo0nE3plGTbQ8gJjINZx3wBR7cs2s X-Received: by 2002:a50:fe0f:: with SMTP id f15mr34821341edt.235.1600382315835; Thu, 17 Sep 2020 15:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600382315; cv=none; d=google.com; s=arc-20160816; b=IT7vPVTsOnAko5lNJ4vIc3xD7SHD7fB1fEtyqZekkhOZ+fT0zcRS1dJeCw186isvEM L2GTUklJfR/yF7AbA39ZW1bYU57Dvc0I2Xr5y4k74UeFaOBRB6VU685K7VRDBqEbrNwN QHv86YzHd45m0W1Cdt3KdmH5BCGz+mEO6C8U3KH92z/YqDrWhrKWSqTUvktGlfylPec4 aAYjXiNZ0F/Lq5Iha+zlAW5yHAqDSPIFCKsAOvEw70CbbUf02033E9gEjm4DsjmxjYln JSg1M0j1XfZIvkjqulJJjUM55mAbFAbYsXQLA443gJ4vzxosv+LfoTVbyQYNLpaIabPf uViw== 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=g8mWaA70/vJYd3c8jp5YjpHA9LUbTvW2mHwjrJWTr40=; b=QpR7+T2qWnyPHRToIhZonQjIz6V0vAbL2itflZZzKwb/TLW80lSuHyuTmY/iUBNG4V uqVER82Ok/xf3NiWAKvihEnHzfb88QVXay+smiIEKYEc8sXAcTAaXB6qIBBgVuca1ZeT PQLCw7EkEgjPb1ZNNQD6Up0tvC2SSHNjv1RlNrsjYu7bZHGlrReGbDJH8hTyeeXd/ybn IerZ1PFKDLsN11GoJ4kjG88/1xnKurwNcZkGz6LQfU/lnV5l/Qq2z4+c5un7XUZUjgNz Q49O3buTAR6rsrxaMlti7kBqiQzBt4uxnBXAHzoMcrPaTU1RtUBfbphYjQrjtXgOU6Ui 7jxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=Aqc1zzfn; 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 g2si875951ejp.429.2020.09.17.15.38.12; Thu, 17 Sep 2020 15:38:35 -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=Aqc1zzfn; 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 S1726594AbgIQWev (ORCPT + 99 others); Thu, 17 Sep 2020 18:34:51 -0400 Received: from lists.nic.cz ([217.31.204.67]:35720 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbgIQWeS (ORCPT ); Thu, 17 Sep 2020 18:34:18 -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 A9710142070; Fri, 18 Sep 2020 00:34:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1600382042; bh=miG+OrQL2mOeZJTyg/24ok7NmhQ7y6FtesErJ/4bw4E=; h=From:To:Date; b=Aqc1zzfnogZhx8F7WickLfm1VuQV4HneQH5Zf549bf0fMGj7LbAGfreRJlVJZZgMj tIxscvcErp5himhNgCOY4I4g7Hj804Fe00zI00TRWbvyHjqxHTVrDktL2MkJtFbqLW osFoeB8ijEzJJ2CEtsU5WmEpsd25FVfddjXcCaEQ= 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?= , Simon Guinot , Simon Guinot , Vincent Donnefort , Thomas Petazzoni , Linus Walleij Subject: [PATCH leds v2 49/50] leds: ns2: use struct led_init_data when registering Date: Fri, 18 Sep 2020 00:33:37 +0200 Message-Id: <20200917223338.14164-50-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: Simon Guinot Cc: Simon Guinot Cc: Vincent Donnefort Cc: Thomas Petazzoni Cc: Linus Walleij --- drivers/leds/leds-ns2.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 01c54ab0aa00e..b021e94d512c9 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -174,14 +174,11 @@ ATTRIBUTE_GROUPS(ns2_led); static int ns2_led_register(struct device *dev, struct device_node *np, struct ns2_led *led) { + struct led_init_data init_data = {}; struct ns2_led_modval *modval; enum ns2_led_modes mode; int nmodes, ret, i; - ret = of_property_read_string(np, "label", &led->cdev.name); - if (ret) - led->cdev.name = np->name; - led->cmd = devm_gpiod_get_from_of_node(dev, np, "cmd-gpio", 0, GPIOD_ASIS, np->name); if (IS_ERR(led->cmd)) @@ -238,7 +235,9 @@ static int ns2_led_register(struct device *dev, struct device_node *np, led->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; led->cdev.brightness = (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL; - ret = devm_led_classdev_register(dev, &led->cdev); + init_data.fwnode = of_fwnode_handle(np); + + 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); -- 2.26.2