From patchwork Tue Feb 20 11:10:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 203555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp325229dyc; Tue, 20 Feb 2024 03:12:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU2p73gF2c6O6+0rqWJbHI/10NmUNMyaU2NjDYq0HKUowyENeeQE0g62gwsbyZPIKFbjodM033FcdZm5/RWosq3FCYwUg== X-Google-Smtp-Source: AGHT+IEy3k+3y6qWwexdxlbtXH55AM93LlkLC4x/SHzikKE+Wu/cl/1aWxCws69b+zVHYgGYyIFK X-Received: by 2002:a17:903:1205:b0:1db:68d5:6281 with SMTP id l5-20020a170903120500b001db68d56281mr18501380plh.35.1708427536040; Tue, 20 Feb 2024 03:12:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708427536; cv=pass; d=google.com; s=arc-20160816; b=it/BKFtiJ/072uh5htVzndAKmfP4Q2HvLvq8CXSMgnP35Bo0lG/cS2rhhv8AFsdFaj AlmTtLVDMLcPOBeySC+yuOONaneEVkPfAFVZQkVxw+An8kLA4mewtwFIMEA56ci3iWOH 0QXi5Jx9TIIVEI7riS1jrbPCapU1AEYvnhA6S9Ie8CobgkUIqlWkvGOcbnd8HG5ubFLZ VA0dYGo3zr+oULXCOYsbCV8mGrRMtTlF/F6RFSRoPniYdClkYE4ZZEfPSUYBsU4ZvoAa j4uTTXNXsKg2aidggWHnGQtqCo1MFU1LhePf/H7sqC514DwbHrobV6QtDyFbs1KKKxj/ ITHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dIMzuvrtDamZE0HiEkiJxqOPfEthKIYmnyBT6Ohkkxg=; fh=njSy/rlbAoKk1TdE9G+RzNVawG67mOpp31Vpsfilr4g=; b=inekXfJ7Er5S00x70GlLzbnOItRyri8biRUKZ5c74LPAqLgcH0JgBCwL8DC48vVu72 VPt+7HcNBm2Pe4UhG1OxdYOP9HHzkK8h+TdxvtTxiO1oWbpTS34etbt5rxKwU4NUYmoG 3Tv2VXOz6Uj/t6otYYvG4HYteLhwgjFcT71vzmkcvAg5VAq49rshx9npoPqpUNKtq4hj VTU8HjLs7LZpngJ4Y08/EiVFNWaBmjGlyAJ5O2ZfaUO7MEEw1Uuwu3vmb1XWbdxgPeie P8cvR4WIkJ7WwbJ5j8DucckzI/+ID1YpfemlFixTPwnMMvGjznf7cx5l71ZyyYFk2ZVH XVOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BSSqGygS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-72880-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72880-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e8-20020a170902784800b001d8ffa784cfsi5968099pln.130.2024.02.20.03.12.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:12:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72880-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BSSqGygS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-72880-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72880-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 18D16287454 for ; Tue, 20 Feb 2024 11:11:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3F04664DC; Tue, 20 Feb 2024 11:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BSSqGygS" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7826664CE; Tue, 20 Feb 2024 11:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708427459; cv=none; b=KTZyC14ktQClUCiXAIk0pki1PwXdJAihePlEPannGM0rJiMl9l+vQmjkQ28PwjEiZhMan2eHKHiPj3IcpSKMPfezMe/mMnItlxWsacByzzcFrKil6D6PYM9lCRZeo00tOOiquoY0L22D/qr7vUVbN+QOX1s1l9thJWQT1TgNnXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708427459; c=relaxed/simple; bh=eRdcavBrbS7Z1tgoLtld/S/+yifdcL68SWTMBVmtqiw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdZrQjECEnIgtDZJfEQ4z19X/uhT0LuJp8n+D2dJAv38+KFSzJDvjqZ7hm8Dr7hCXRiFeHiChWP9boLUtdsoste7HM3xYdt+GyWNnUtQTEIUilJbL6He6CiO17pGst2hCMeMFmeqdrSwaqLBQeeZyAXzTHDR0qrSrjuxH9+7vo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BSSqGygS; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id 8228F1BF211; Tue, 20 Feb 2024 11:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708427455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dIMzuvrtDamZE0HiEkiJxqOPfEthKIYmnyBT6Ohkkxg=; b=BSSqGygS1kfJ6h9uzsvevdfUzDbIxGanc5XtUCMUXQGcdCnf3cnhtH0K7dvIZnvx1o4gv9 pb8b/liLFtzXzfv9QHiHxYs6OKadiTWet707mwjuUUWn+48AZGNzUacFArNfD7qRADz366 CH7XVs+tmLzCYIaR1jRaQEG7WipxeK+paTL9zXrHvGFqFqITUr+onbxt1Z5ZZ6T7Tenksz zNJl2XJlmMUsG4+Ok1TjcDClxVbHO4MsSQ8f0AeKsDJjegLT/08RTNak4iyejl2G4ZRJj7 8CLqxjwkIZXE4ur2TBC4seu3WJnSSrkMS9zlPTkP3GyxV9kpZb9GR2Trg0DJVw== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Shawn Guo , Saravana Kannan , Wolfram Sang , Mark Brown Cc: Geert Uytterhoeven , Rob Herring , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Ceresoli , Thomas Petazzoni , Herve Codina , stable@vger.kernel.org Subject: [PATCH 1/2] driver core: Clear FWNODE_FLAG_NOT_DEVICE when a device is added Date: Tue, 20 Feb 2024 12:10:36 +0100 Message-ID: <20240220111044.133776-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220111044.133776-1-herve.codina@bootlin.com> References: <20240220111044.133776-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791416112224292819 X-GMAIL-MSGID: 1791416112224292819 Since commit 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays"), when using device-tree overlays, the FWNODE_FLAG_NOT_DEVICE is set on each overlay nodes. When an overlay contains a node related to a bus (i2c for instance) and its children nodes representing i2c devices, the flag is cleared for the bus node by the OF notifier but the "standard" probe sequence takes place (the same one is performed without an overlay) for the bus and children devices are created simply by walking the children DT nodes without clearing the FWNODE_FLAG_NOT_DEVICE flag for these devices. Clear the FWNODE_FLAG_NOT_DEVICE when the device is added, no matter if an overlay is used or not. Fixes: 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays") Cc: Signed-off-by: Herve Codina --- drivers/base/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 14d46af40f9a..61d09ac57bfb 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3619,6 +3619,7 @@ int device_add(struct device *dev) */ if (dev->fwnode && !dev->fwnode->dev) { dev->fwnode->dev = dev; + dev->fwnode->flags &= ~FWNODE_FLAG_NOT_DEVICE; fw_devlink_link_device(dev); } From patchwork Tue Feb 20 11:10:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 203556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp325293dyc; Tue, 20 Feb 2024 03:12:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURkp11OQN8Ntw2LwT8rgRRZOFQEOn3Dc8VN2RgLDqqXy+aK1pvnNak5HTepV2JVqh2ESreXfd16Z/0Yvt+a6KvLzj7ow== X-Google-Smtp-Source: AGHT+IGXwQD9jem7LqmfUAxPPsC5sCYbYW6TkWodp0XTP/lD4BzpYiF6Hd1PGT3TSM+d0nq19jBT X-Received: by 2002:a17:90a:34cf:b0:299:5b95:cd7d with SMTP id m15-20020a17090a34cf00b002995b95cd7dmr4705956pjf.45.1708427543593; Tue, 20 Feb 2024 03:12:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708427543; cv=pass; d=google.com; s=arc-20160816; b=KI5KrkzpUFLxQJVY3lUkGQ7638Tg8Eo4lTgYqfG48Gz3y1YWrvaNzVcAgDmSV9lWbT Sp3OP//rutQxX/AOnN/HNXkIXMkoXKhYHrK2RzGtsLEyDi/8dHzzThxu2wvMMG1u28Ds sV0fgUF+QpXwOKPfFMPO72Cxk/qhEWq0Dlu8LOW3+rF7/ZiEo8i7My/8eeVj3MVZJkHL +/zeL9a996uDWW+BfG6SjzSoOhrNSFclaGruRoQPbzw0nP4nJtp3+xZqeXrptdxlHoE8 SmWypeD24x+kbMRO3YYibFlmIKpg7KGXOtiC4PNl8zZFlo/1vx+QxRtZFqr6g9LeOOhi Ui7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eFeqAc0viLZubDduFEQRtTQhhOqlv7YIdJ9vqQOHsWs=; fh=njSy/rlbAoKk1TdE9G+RzNVawG67mOpp31Vpsfilr4g=; b=aWwzKmCQOk/UCQnI38k/Vsc9s6vVBl83RJFsqIHx1hYQGq9nnfD+OEjCfZcnGZspAd kK9vdzGBho50TQij3sj9ixL12dqIpfDbnD0kO7kbugGAqfsKrxtRIZa9JGJWM8rYcE/4 M2JMZuHYVYo3ywCF6+pIyZO1gYidKnFi/ko9IMHocv3M0TG7cT64XN5oDMQWxpelktNT p5P5WQg2vwnyxWp9MvDDmCaxtUhjQekeCEiRH42CO2bpn/sHNlpvccCFLYNX7QDwaqym eBrZ3Czp5pg4Z2OJ2O+p95rqDtRYtKbiC6i3scTDTq5q8rIX2XpY7HNGLwDqKMUi4ePK +Axg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RKYZaPEJ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-72881-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72881-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mu12-20020a17090b388c00b00298f81cae30si6103383pjb.44.2024.02.20.03.12.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:12:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72881-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RKYZaPEJ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-72881-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72881-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 594B9282717 for ; Tue, 20 Feb 2024 11:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F24767E62; Tue, 20 Feb 2024 11:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RKYZaPEJ" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E9E467C45; Tue, 20 Feb 2024 11:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708427461; cv=none; b=jZOee6QQzxXvjw9g4IByYkP0fZOagQIi83ddoHhwyhsWIJeUJxX7ljR/dny9LtAIUSDB2flUZoLr10mFdgcDH+zmvLjqcB8AAlkTP8XR+6vFtYsDkMPwTQYkK+G6ijCLyTZZ1lwhDS1AE8/zPs27XcN2rkytfdq4DClvL1Vwf+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708427461; c=relaxed/simple; bh=SORknAyK89FTpPMUYDIygldtRacLzHgxp/VDNZfKqJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pq3pI8mV6JOKKi8JE4jnvuWrEAox7oCPbV2dIUHEqhaarbl665BPh1++dRzH06xNGBdky1Lzeno1su7g2H7xlJWZLvLA+WuXkf+/MBrTmpHb2syIMKyzK9VtcPEzluCQugaVxx+pViJ4sF7tnGlZfRMIPfxgUbui68JmEgk/g/U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=RKYZaPEJ; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id 4906C1BF209; Tue, 20 Feb 2024 11:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708427456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eFeqAc0viLZubDduFEQRtTQhhOqlv7YIdJ9vqQOHsWs=; b=RKYZaPEJC+YwyWaq+Vd6q3jwz1J1O+djnucz/L2Nc/pCdc+LpnnqKGweCyYqqab0hxw/zo llSi0TCWhhLFGQUF7veRhkz1jHCHvkbEdeFIk6M2w8FDQnn45TApkJifS/7WcX729LnMM4 RmQnIqzu+OARccUzXZasSo8HtO5/z5roV8ztrMgx1HneWTrD3kRc+8NJd9bABDhLwochuR +H3HG11tkb74Ei4sWNoxk+sxr0WeVyBecQim9ytbovIkEeYXqXwwjJdb8J85gmfnSo9YIF OoUGO+0QjNoKtbzy10C7CpDmQfPdQQWLk3zFktun/qPy2Ast6p9au2TwSEcEXw== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Shawn Guo , Saravana Kannan , Wolfram Sang , Mark Brown Cc: Geert Uytterhoeven , Rob Herring , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Ceresoli , Thomas Petazzoni , Herve Codina , stable@vger.kernel.org Subject: [PATCH 2/2] of: property: fw_devlink: Fix links to supplier when created from phandles Date: Tue, 20 Feb 2024 12:10:37 +0100 Message-ID: <20240220111044.133776-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220111044.133776-1-herve.codina@bootlin.com> References: <20240220111044.133776-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791416120302922642 X-GMAIL-MSGID: 1791416120302922642 Since commit 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays"), when using device-tree overlays, the FWNODE_FLAG_NOT_DEVICE is set on each overlay nodes. This flag is cleared when a struct device is actually created for the DT node. Also, when a device is created, the device DT node is parsed for known phandle and devlinks consumer/supplier links are created between the device (consumer) and the devices referenced by phandles (suppliers). As these supplier device can have a struct device not already created, the FWNODE_FLAG_NOT_DEVICE can be set for suppliers and leads the devlink supplier point to the device's parent instead of the device itself. Avoid this situation clearing the supplier FWNODE_FLAG_NOT_DEVICE just before the devlink creation if a device is supposed to be created and handled later in the process. Fixes: 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays") Cc: Signed-off-by: Herve Codina --- drivers/of/property.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 641a40cf5cf3..ff5cac477dbe 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1097,6 +1097,7 @@ static void of_link_to_phandle(struct device_node *con_np, struct device_node *sup_np) { struct device_node *tmp_np = of_node_get(sup_np); + struct fwnode_handle *sup_fwnode; /* Check that sup_np and its ancestors are available. */ while (tmp_np) { @@ -1113,7 +1114,20 @@ static void of_link_to_phandle(struct device_node *con_np, tmp_np = of_get_next_parent(tmp_np); } - fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np)); + /* + * In case of overlays, the fwnode are added with FWNODE_FLAG_NOT_DEVICE + * flag set. A node can have a phandle that references an other node + * added by the overlay. + * Clear the supplier's FWNODE_FLAG_NOT_DEVICE so that fw_devlink links + * to this supplier instead of linking to its parent. + */ + sup_fwnode = of_fwnode_handle(sup_np); + if (sup_fwnode->flags & FWNODE_FLAG_NOT_DEVICE) { + if (of_property_present(sup_np, "compatible") && + of_device_is_available(sup_np)) + sup_fwnode->flags &= ~FWNODE_FLAG_NOT_DEVICE; + } + fwnode_link_add(of_fwnode_handle(con_np), sup_fwnode); } /**