Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp64844ybn; Thu, 3 Oct 2019 01:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQoMGQDZV+y4rmQ0gzXjcSaiD4cVvl8tmeyxbVpi+C8VQc6CjFa+DCQ/kPfK3cl3qJmAw0 X-Received: by 2002:a50:98c6:: with SMTP id j64mr8264543edb.34.1570091349281; Thu, 03 Oct 2019 01:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570091349; cv=none; d=google.com; s=arc-20160816; b=N0rYD05wToez7hhmNu389JQbyNYy4gzfpc1s5d5KQwMPTAsGM05TPFeq65zpsJQb39 qcJzWWdCCvbAShegZHEOwa9JCl2uDE5O/k7C2ZEc04MWNFNWohAJh5UzXxqN5AiT8yKk VntvTO88wb76wr/LiVJW3XvRIVQKAip3qp/Ow7UUX7IazxKHanPqnGRQPd0dgqBOQyCG xQqnGQMeCCPHgFk05bbrL1V9I3XZIoEu93WHYJa0fRo3t6VGToHaQ2urTA6NNzv9+brD 2gvm0y+YQFB3YXBnziI16AiYClOASjPHkv4KMMwewxNZoQ7rSSDNjctuVBp5rGXyTK0W QZfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zHZNeDL779jJyDu708ggzOFMfXOscN51xWhlBD7mkHE=; b=js9677P2q7E9X/hvy5QFDU3NkBvEIddtbOU1Dll0tFmBgy4I7zfdGez5c+vAvT/Urg vz1uvUBkUaC6pVc46DPxP3MNPIY6DY21GZc2p0SVvw4FYTUJMQUaAgfgY3bTW22bt4Qu t+VvRvp5RQ2fB3m3JQNNOcWjhFfGsaaGAmf3k/64jHvWwPcJr6x6HcTepOCXGunqKWTb X+gjj4QC3RsJ+ww3grJmZtOHAY/WhePvxxDh7KQyaC8tEwBe6+lfrEP2rj5f3ibrWIxd +oF4Fq3JNiXUqxXqgZpQGcAtzjj1EWDYOjuGvcDGHxc+4VkYcxoVyEU4XmqbCQjWHMsq C0lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="BQL/d8vh"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si790407ejd.270.2019.10.03.01.28.44; Thu, 03 Oct 2019 01:29:09 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b="BQL/d8vh"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728723AbfJCI23 (ORCPT + 99 others); Thu, 3 Oct 2019 04:28:29 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36022 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbfJCI23 (ORCPT ); Thu, 3 Oct 2019 04:28:29 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x938SJTt037686; Thu, 3 Oct 2019 03:28:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1570091299; bh=zHZNeDL779jJyDu708ggzOFMfXOscN51xWhlBD7mkHE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BQL/d8vhZh4aWHBwYpdSMgD+qbCIIX79p+KyCFfsWk8nQyFwTs/FrT3anI2CPNGdC B84Lq4nL1Q0/ZcjKG1k5fJ/LxWtyajMJP0lT1H8OaGwuowG4hY8fDLjpVYIewGpB9J qTlAqP/ZVaSmfTnC7MhIYqXHwBxJg1RlVvh7ba4g= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x938SJoJ058528; Thu, 3 Oct 2019 03:28:19 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 3 Oct 2019 03:28:07 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 3 Oct 2019 03:28:18 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x938SIAn082890; Thu, 3 Oct 2019 03:28:18 -0500 From: Jean-Jacques Hiblot To: , , , , , CC: , , , , , Jean-Jacques Hiblot Subject: [PATCH v8 1/5] leds: populate the device's of_node when possible Date: Thu, 3 Oct 2019 10:28:08 +0200 Message-ID: <20191003082812.28491-2-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191003082812.28491-1-jjhiblot@ti.com> References: <20191003082812.28491-1-jjhiblot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If initialization data is available and its fwnode is actually a of_node, store this information in the led device's structure. This will allow the device to use or provide OF-based API such (devm_xxx). Signed-off-by: Jean-Jacques Hiblot --- drivers/leds/led-class.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 647b1263c579..c2167b66b61f 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -276,8 +276,11 @@ int led_classdev_register_ext(struct device *parent, mutex_unlock(&led_cdev->led_access); return PTR_ERR(led_cdev->dev); } - if (init_data && init_data->fwnode) + if (init_data && init_data->fwnode) { led_cdev->dev->fwnode = init_data->fwnode; + if (is_of_node(init_data->fwnode)) + led_cdev->dev->of_node = to_of_node(init_data->fwnode); + } if (ret) dev_warn(parent, "Led %s renamed to %s due to name collision", -- 2.17.1