From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 34E3546984F; Wed, 9 Sep 2026 08:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940910; cv=none; b=S3+wcugvTip6YxQHa0iFzqVequ86uEjQMwgFTtVltLUBITVIzAMo10xhZ9Gls83WDsEz78HCYWDR914Llcvig/8gqBiDVwf/gZPqRSvwN8EqUhOgibVvgHowW9E1SQdqi2zZNxE2L4PG3oEtQvwSi4mYcR+lsBJxOHDBXEUXRXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940910; c=relaxed/simple; bh=436BEBrvhYDKLZC0gPrxHFS5zcpKgaQ3L0yxxJjxcmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PDTsNtRrbamvZy5UBl4VgHcaL7uh9WL38XOT56xjzfjV5VIkyNwQaliBI3N2I7QIJFsULEinAPf0l7LZ4l9DU7Jb0+ieV3L15OZ0a6JwHInhZ7TVuEanw74bQP3jogyh8eL3XACvLNyK9Z3EVEVA3n74JQKlFzxefXmRmFfFEoY= 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=ir/hgAsf; arc=none smtp.client-ip=185.246.85.4 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ir/hgAsf" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C465C4E415AE; Wed, 9 Sep 2026 08:01:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8BEEA60448; Wed, 9 Sep 2026 08:01:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A9C1811C7AF5E; Wed, 9 Sep 2026 10:01:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940901; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=KQ3Gtk8g856i6Rmp0MlolORY4bAvnrQI8T3cMHPFI2I=; b=ir/hgAsfOto/1mgzWsgz5Eq7g/f934zjZ2cbV6qHaOL1DIC2H97q7PubGSzi88//a5+Shr xGjk9r8SSAgiL7FQM0tVkI/Z/rKCYbAcgCpFVqJuoIc/BlMwusTi4+3Ewdg//7MCHsD86x K21+h02b6syuXQ28KfgMRLlSeHzP7K+ZM6Pm5E6HRBkUN8EeP4jzchEulxmhg6ROf4FYQD Ep4+hbZPKEO2iFoRkdsSZopnjGytyrllOiyDYaOgSghKiaMiC3527f3rZRS2bBQ/YCAtkm nHlKEd7nLyBXoRrwQc8CK3ckCvTuRWT/uA47mhH+RDekNJvzK+lLgyZW93xR0w== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable@vger.kernel.org, Ulf Hansson Subject: [PATCH v11 01/10] driver core: fw_devlink: Introduce fw_devlink_set_device() Date: Wed, 9 Sep 2026 10:01:00 +0200 Message-ID: <20260909080114.591938-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Setting fwnode->dev is specific to fw_devlink. In order to avoid having a direct 'fwnode->dev =3D dev;' in several place in the kernel, introduce fw_devlink_set_device() helper to perform this operation. Having this helper allows to hide the fwnode devlink related stuff behind the helper. Cc: stable@vger.kernel.org Signed-off-by: Herve Codina Reviewed-by: Andy Shevchenko Reviewed-by: Ulf Hansson Reviewed-by: Charles Keepax Reviewed-by: Richard Cheng Reviewed-by: Bartosz Golaszewski --- Cc stable because used by other patches with Fixes + Cc stable --- include/linux/fwnode.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index a9dcaf7e7076..3ce49575cf82 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -260,4 +260,10 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_h= andle *fwnode); void fw_devlink_refresh_fwnode(struct fwnode_handle *fwnode); bool fw_devlink_is_strict(void); =20 +static inline void fw_devlink_set_device(struct fwnode_handle *fwnode, + struct device *dev) +{ + fwnode->dev =3D dev; +} + #endif --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 6D53C44A3EC; Wed, 9 Sep 2026 08:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940915; cv=none; b=QI8bulMI4G4/fwIL/Dqg4hLIxMDy6eUTn+XDl8Ss6cb7rJ9fqN9VHgnhxDhIZLyX71JlWrlQNGxYN2GEz3geKxYiw2Fuh6JY0ndfs6axeL1Mjr5nJ7azoudSzaDXTQh3BdJMlAd0XL7oiwj6JR1NehyWoo19+eeZ24cUj7BYw4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940915; c=relaxed/simple; bh=erUfNySMebjwh3DKi3RCFTAPncfWBJassg0R49b5I54=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hRL+F5cydjwdIuSLcihO1G7a3tEggfFmtSzFd9NdwMZ5dt8sXoaKKKcfZx8SkaJ03hKXwG6EKEUhVHvUa4UGeLsn2wu0C3fRZPehZSlrwiJGft9zrScBFBoi4Qn5KrX7YiASw3vvg6aqilWeQDpCvCTzbR59zgBRwxzeEalODk4= 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=wGfygPtp; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="wGfygPtp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C5DD61A1A74; Wed, 9 Sep 2026 08:01:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 96DB660448; Wed, 9 Sep 2026 08:01:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D537011C7AF61; Wed, 9 Sep 2026 10:01:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940909; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=IAzbE3DsYKUJnc8qOywdrb6XseooHK0XCUB0p8PIr4A=; b=wGfygPtp7PpgpbRuNgatzrJBG6FaHuGsvsd5AVT2/axYAAu7YztWorR6lSJAouJQ/XNeco eLBvbJNofeWiP6fsd4lZF+0PV7J0tvk/HrjZFbo0vfL776yBZECcPMykXumVSnuEB/eFKU bL1Wu1uyRQ0uMoPKenEU6JA3KXpvS3pJTZAaRLsPALwh+y8+es2Gnpwd8Q10IQG+vtTg0m g0gv/gnT2roF1PXtaJryJwP1WadodeqIsCLVxCPx5QeUc2VsZ82lae5Bl5BrtlApsU5Xbf Ib51K7hhSPp19dB8EeM8dXBtLQDcqWf9xaZLE7SUzubPJRzyax+MX5Ph1SZN9A== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , Ulf Hansson Subject: [PATCH v11 02/10] drivers: core: Use fw_devlink_set_device() Date: Wed, 9 Sep 2026 10:01:01 +0200 Message-ID: <20260909080114.591938-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The code set directly fwnode->dev field. Use the dedicated fw_devlink_set_device() helper to perform this operation. Signed-off-by: Herve Codina Reviewed-by: Andy Shevchenko Reviewed-by: Ulf Hansson Reviewed-by: Richard Cheng Reviewed-by: Bartosz Golaszewski --- drivers/base/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 4c0c373998a1..3268e9350c86 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3754,7 +3754,7 @@ int device_add(struct device *dev) * device and the driver sync_state callback is called for this device. */ if (dev->fwnode && !dev->fwnode->dev) { - dev->fwnode->dev =3D dev; + fw_devlink_set_device(dev->fwnode, dev); fw_devlink_link_device(dev); } =20 @@ -3929,7 +3929,7 @@ void device_del(struct device *dev) device_unlock(dev); =20 if (dev->fwnode && dev->fwnode->dev =3D=3D dev) - dev->fwnode->dev =3D NULL; + fw_devlink_set_device(dev->fwnode, NULL); =20 /* Notify clients of device removal. This call must come * before dpm_sysfs_remove(). --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 ECE1945FFBB; Wed, 9 Sep 2026 08:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940921; cv=none; b=YtGHA9kZOOKl04uWmzLAtiIQf5pF+8ru6n764JSlXciG13kPBuR2ygtufemAemoz3vmBS2Ij/fjwRpopFRAYMDh55sxW/e7w/fKCysDcFJh+8oMAXgxIVKgqc82DC64yvoXz1m+dISwF296AqPoTBopxPGPJ2RIw2N2zelbmMos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940921; c=relaxed/simple; bh=/xNuXrPutRr9SN5ol6A+55MmnzHimcyrYtZumObfOX8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OnfYrU4bN5TD3vYNy21Vyf4zcGscU9XjUuUSQ5uitdKr0/1u2YFm9tFfnU4FDR5kUvz7Yo6yrmLnJSl3x/cBdkc3UunbMVUucsySe3CAVdy/T47OxsEGanInSzq8qE+DcsrsaasWmX1JPIZvEOKFYvzsEDUMpWMNuaIX5NDdn9w= 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=UBenKPlQ; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UBenKPlQ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 6C1B01A1A74; Wed, 9 Sep 2026 08:01:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 364D260448; Wed, 9 Sep 2026 08:01:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0A1FF11C7AF68; Wed, 9 Sep 2026 10:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940915; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=HpB/Xwbq3kubuMTeqzqA6/EITvrhe2rZGYPmHV3Uc6Y=; b=UBenKPlQfcxBwgrKp0KnmWXPTOIj/zwTo27DlGpeY4NiQOm75yRTCD1FxWNT7Na4AefdgI 4R2QMj1S1PrKK65qRkM0ZAXiO9YjGokfEL6BheLAJJDbbuyX2De5SbdIw0fJPk/ZLAh1bv UOCqiuTbLI6/QG7sqEqbCsz2/EMSvHnliPWNGmUT5vgKNNsuVmXNnB9PaUdSMVxd878d5X 0PQ5l9mxPtIHLANSb742rXVIXXxVDJRvdA2lY2j8ajHZ4aCDPkMTBAFZwZVQtWzm2fKFGu aeU74QkKlRgCvTBp1onN/8i8VKlZpn6FlB6mZg8C21xeF29J8K1DxXz59xi3xw== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: [PATCH v11 03/10] pinctrl: cs42l43: Use fw_devlink_set_device() Date: Wed, 9 Sep 2026 10:01:02 +0200 Message-ID: <20260909080114.591938-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The code set directly fwnode->dev field. Use the dedicated fw_devlink_set_device() helper to perform this operation. Signed-off-by: Herve Codina Reviewed-by: Andy Shevchenko Reviewed-by: Charles Keepax Acked-by: Linus Walleij Reviewed-by: Richard Cheng Reviewed-by: Bartosz Golaszewski --- drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cir= rus/pinctrl-cs42l43.c index 8990fab0446c..563070aba3d8 100644 --- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c +++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c @@ -576,7 +576,7 @@ static int cs42l43_pin_probe(struct platform_device *pd= ev) return ret; =20 if (!child->dev) - child->dev =3D priv->dev; + fw_devlink_set_device(child, priv->dev); fwnode =3D child; } } --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 837B145FFBB; Wed, 9 Sep 2026 08:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940929; cv=none; b=HUtwk10LbDuipCWo7Vl1+658mQ1gVVH9lBujHjYuhsuiTzzmh3xQWWHwimjVfIadBEd58B2MpGQ6Qjn4vBudpZpxtyZUsOz3UByCoodnqH7kXAkPfZVfzM9IwApGHI/9531TivrTyUA2AiLrygleCbL4j0vGV2eSlZrkL/tpIbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940929; c=relaxed/simple; bh=Jbdw0usvOZQDmqbHPlf/XV8ho+MieeERHIVywwe5C6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eTBFtltIkkfJNzZstuDbLbdH69WS1z6DKPjEGESiOno/KijCuq12/zPY90iSmrFKCMhZJQs2etELl2cR35InWSW7WeOyiP+/UrzyLBcBVjKDoGwiPDzsEOooJTGUPho4TroPSrMGOESeV1NqVgMCTvL+yTRcOFv7g8P4LYCkKnQ= 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=VEwSHCOC; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VEwSHCOC" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 15B931A1A74; Wed, 9 Sep 2026 08:02:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DB0F160448; Wed, 9 Sep 2026 08:02:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CAFAF11C7AF69; Wed, 9 Sep 2026 10:01:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940922; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=F5ZnkboCOsaNe86WTU/MdyF65AKP+FRRtRNjlyaevJo=; b=VEwSHCOCrbnZrHe0YOi8dDdZHq3L7uyKazzlsJWR8KA/ItHZpOTYTxJ+1vnMkPbFY7VUjM gGVWZrcnMBhE3OEY+151cwGXsL84R2buR4aIkNp/+iunYSirL2OIyxLrauSfzuQaKOBsZ3 FlJcY+I215f9k2FudKedUeTJJMhhWxB/uDWEIxnndTFNHDyEIqldEto9eSC765/8It5h+3 XG+hhl/wi2vZWkKoJT+mfI1gD0Nrphcbnk5gGlo+g3pt3qiqWyhSi2vnPxWu5qR/lRXbl6 vV3QPQTEDvY8kEwSUMWWCqi1y4dAbIg9L60Q9ejvi7nqaQBRXTDfuVglvRYN6Q== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , Jonathan Cameron Subject: [PATCH v11 04/10] cxl/test: Use device_set_node() Date: Wed, 9 Sep 2026 10:01:03 +0200 Message-ID: <20260909080114.591938-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The code set directly dev->fwnode. Use the dedicated helper to perform this operation. Signed-off-by: Herve Codina Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Reviewed-by: Richard Cheng Reviewed-by: Bartosz Golaszewski --- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c index 62bd92b3be45..547ebc97bf59 100644 --- a/tools/testing/cxl/test/cxl.c +++ b/tools/testing/cxl/test/cxl.c @@ -1677,7 +1677,7 @@ static void mock_companion(struct acpi_device *adev, = struct device *dev) { device_initialize(&adev->dev); fwnode_init(&adev->fwnode, NULL); - dev->fwnode =3D &adev->fwnode; + device_set_node(dev, &adev->fwnode); adev->fwnode.dev =3D dev; } =20 --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 D78C246E01A; Wed, 9 Sep 2026 08:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940938; cv=none; b=Sy0wZ7pGEKXvG/QneFw3ra2SIdHiGBlCt4a3MtQgVQuUTAnHvJhuct7iXT0dc4e072QM8b7hMfxCX5OFdEStbC+jdu1o0gYUfCVsnGU5ccr2jf/1dtTnEciqLF4hVv6J+eh94zebL6GD9DSrSq/Ql2AVHYmHQW2lrYEMgsZk6ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940938; c=relaxed/simple; bh=SmwQ8QEwzJgcZ1jBkH7Xr0wiu0lnuzkEavi/1uVxkmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uml9+zP8fTMxSAUssytrUE94465qiRuoOn61nLCfuMXLYZbjDQ9DtgHEvKUImRApulNKmnCVdIyCBCgr+MwJzFhRF+0wPFsYRukbjr7rlnhcDSbws5Tho+y4h4iXfsz4E6/IENeR6qcC7pMDCFp4kIZ6DLmfHf8niNHPHBwlHAU= 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=buYr8FVQ; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="buYr8FVQ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 51C301A1A74; Wed, 9 Sep 2026 08:02:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1E9AB60448; Wed, 9 Sep 2026 08:02:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6A85411C7AF5E; Wed, 9 Sep 2026 10:02:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940929; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=shn/uPnWilBveJPl5kqDMNdB3yaT7AmVUdGF6S6UFhc=; b=buYr8FVQ/rqvC82VgRObTs1i299Kq4Y2uWIyT4uJSUQ+rvlCJSl8U/U97Qd9ADxmy/rO7s SeML20G/D0vpKMo3PuI3tHxCzQEMz5Zp6qtISMZOp9aDjEx9fZ4CYR4bePLYQXomMIuYYC x2esv4XzUy/skgjpJLLHDPvVF9u2GoedMwzbW6aTmkZDVztNFrl4sYQ5lFMHvJAdf1yrSQ asoDSKb22helhz7p8g/YbiaZibeq0qLMIlBn2ocNlRoymyos3zRbeq9+IRaIkqoA9Z/s4N TCsYYFspwVNzJ9qFj+3m4GSYPlODroHxj1ztU2lgWqz83L8nkjcQlQYI9DcGfg== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , Jonathan Cameron Subject: [PATCH v11 05/10] cxl/test: Use fw_devlink_set_device() Date: Wed, 9 Sep 2026 10:01:04 +0200 Message-ID: <20260909080114.591938-6-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The code set directly fwnode.dev field. Use the dedicated fw_devlink_set_device() helper to perform this operation. Signed-off-by: Herve Codina Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Reviewed-by: Richard Cheng Reviewed-by: Bartosz Golaszewski --- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c index 547ebc97bf59..e21e45fe1572 100644 --- a/tools/testing/cxl/test/cxl.c +++ b/tools/testing/cxl/test/cxl.c @@ -1678,7 +1678,7 @@ static void mock_companion(struct acpi_device *adev, = struct device *dev) device_initialize(&adev->dev); fwnode_init(&adev->fwnode, NULL); device_set_node(dev, &adev->fwnode); - adev->fwnode.dev =3D dev; + fw_devlink_set_device(&adev->fwnode, dev); } =20 #ifndef SZ_64G --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 B462447C0FB; Wed, 9 Sep 2026 08:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940949; cv=none; b=JvpHx6CftWXvoU9Uv3zaHmre54V4D5Zwe6wt4b8hfhiRlySGRkMkmDYYlNFLCBgFc41ThIvmaIxvmxp/6rKhBhmDJ249x584+4ezFwitNlD2luVTVshOV9UlxQ8S4yB36/lk/I4jhLvfVm1MZHprEYvQM7X38EcGrDYKHRjM7lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940949; c=relaxed/simple; bh=9LeEu4x7V6y2YtuNmvhElFPZm3BTZTOIhLxpHirtN+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t0uT6i6kQ8yXNPSUAgCuiXo9vbJXPcsL/sCUwy5VvuVUGko1v/Fq2a1lXbbUr4575rYoV4LgR5XaUkh0a+GqH2uBpMboILWlLcDngWJhHLeee29JbGUIWtFL4vG1D/RAk7ZqwLs5E3ypyK/Gm+2prnxPGpHaoK+G1qwMF17DZ18= 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=nzIJsFZO; arc=none smtp.client-ip=185.246.85.4 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="nzIJsFZO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5531A4E415AE; Wed, 9 Sep 2026 08:02:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1F9D960448; Wed, 9 Sep 2026 08:02:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 95E5F11C7AF62; Wed, 9 Sep 2026 10:02:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940939; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=xsrAagyqRXEIrY2kRm2QxLCi483uP0dBlGJSQWRJ/JI=; b=nzIJsFZO7aqQTzJQIPcALUuuz0HNXdjiZcXHeEhX3IMfJ7+qwgTMSDaADtcRytz2+cT+GN 9nbxwDYT8/6tmVx41u5T4u7g1+fZ87b0ld0P83lilfpR+u/PchYRnGYiTu/IfYfxXeUrag /6b1A3KcUzHMz3dPdnvSASFQTml+mgN2eSXC6VByCJKpEH8VVyLL9EMQq662ORENgk9jQB Phi9r3RghHGPA8Uroayg34PCzZyYskUm+83+1cwJ1RbG8FZsqZQpiFiizKmfToC6kXpdMh EI+mFpZzqS2mYKZ/vv4sesw1Sc/fa353H3OI/Vi2EpRcy26evnrvoirv+UP6/A== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v11 06/10] PCI: of: Use fw_devlink_set_device() Date: Wed, 9 Sep 2026 10:01:05 +0200 Message-ID: <20260909080114.591938-7-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The code set directly fwnode.dev field. Use the dedicated fw_devlink_set_device() helper to perform this operation. Cc: stable@vger.kernel.org Signed-off-by: Herve Codina Reviewed-by: Andy Shevchenko Acked-by: Bjorn Helgaas Reviewed-by: Richard Cheng Acked-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- Cc stable because used by other patches with Fixes + Cc stable --- drivers/pci/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index a51dff91b196..0f45c5b72458 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -882,7 +882,7 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) * bus. Avoid any new device creation. */ of_node_set_flag(np, OF_POPULATED); - np->fwnode.dev =3D &bridge->dev; + fw_devlink_set_device(&np->fwnode, &bridge->dev); fwnode_dev_initialized(&np->fwnode, true); =20 ret =3D of_changeset_apply(cset); --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 CD49147ECCB; Wed, 9 Sep 2026 08:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940953; cv=none; b=gZe4Wij5BqGbn67RZxoPUd6bAdWF/P+m3LOXPphxcGDy6ZHUT7onSl8mxdLGBsRDYbqYCxXHhoxgnSfCxdfGdDE976C1iywnCTpGqnm6yJQLdD4KHUs9iPyU9xtIkNTGw+XGE4H/pU8bGPVnhdsEOrr7ZtTxzBzxmSSxtU2+rOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940953; c=relaxed/simple; bh=doFozkbQmIhIwnnl2kZ6KJ/alTEr96CSHcCvbOHZz9U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NFPmVkhdsjUDf93+rmE8u2KjJTzZT/lJOTi9+cOD0chYgBu9HX7F0pzp3Ispiaj2owaENUOoL0TsyluRBOiNUnVN2OA548PZJKXuhGls62yUCXbTOfX2Tv8ASWFQgcJiIxmpfwRDkO42vAR3mcO36gIl/IEEnu3XcQTZO+8M3nE= 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=RDE9CBvj; arc=none smtp.client-ip=185.246.85.4 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RDE9CBvj" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 77D984E415AE; Wed, 9 Sep 2026 08:02:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 41BC260448; Wed, 9 Sep 2026 08:02:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3334311C7AF4F; Wed, 9 Sep 2026 10:02:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940948; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=MkmdthSh8paWUEwmQAkZhqBjHWPZzyumh8DkXBWxqAQ=; b=RDE9CBvjZSPBSWe2rM/9+2WNzr+rU1gjvKrmoB8Va2yOiWu+01Nt7HOuUWhv35r89cR1fO P1Yh87BaYgSB1UBXTI145jbGV0KEvOomQfn7oBRnpgKqBex06HldCdQSyZyNmjkYoM5GZ2 exlZDM8F6oB1OH30jwywksNz7M5MD3EhFLU1WND5MrgMLh5QAettdULWycds7+xxLgGmuk zRcFtTpUDRoUFhMgu5IkyAC9uhP6EF3jcDJfUVU45/O6/4HYuvBaDWMU7sEfQD9GZk6qzE M/auScPf/GB7qhzh0VpCxFviWNUg0veZGoo1AjGgy55TIUu+3IBN7ObSTSOeUQ== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v11 07/10] PCI: of: Clear fwnode->dev during root bridge node removal and error path Date: Wed, 9 Sep 2026 10:01:06 +0200 Message-ID: <20260909080114.591938-8-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" During the of_pci_make_host_bridge_node() call, an OF node is created dynamically and its fwnode device (fwnode->dev) is set to the PCI root bridge device using the fw_devlink_set_device(&np->fwnode, &bridge->dev) call. On removal, of_pci_remove_host_bridge_node() is called and calls device_remove_of_node() which in turn set to NULL the related dev->fwnode. Later in the removal sequence, device_del() is called and runs its cleanup logic: if (dev->fwnode && dev->fwnode->dev =3D=3D dev) fw_devlink_set_device(dev->fwnode, NULL); Because dev->fwnode has been cleared earlier, fw_devlink_set_device() is not called and leaves fwnode->dev unchanged. This fwnode device (fwnode->dev) becomes an dangling pointer. If any reference to the OF node is held after this removal, the pointer is still accessible using the OF node (np->fwnode.dev) but points to a freed area. The exact same issue is present in the of_pci_make_host_bridge_node() error path leading to the exact same dangling fwnode->dev. Avoid this dangling fwnode->dev pointer by clearing it in of_pci_remove_host_bridge_node() and in of_pci_make_host_bridge_node() error path. Fixes: 1f340724419e ("PCI: of: Create device tree PCI host bridge node") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina Reviewed-by: Richard Cheng Acked-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/of.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 0f45c5b72458..29b63a9090ae 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -822,6 +822,7 @@ void of_pci_remove_host_bridge_node(struct pci_host_bri= dge *bridge) if (!np || !of_node_check_flag(np, OF_DYNAMIC)) return; =20 + fw_devlink_set_device(&np->fwnode, NULL); device_remove_of_node(&bridge->bus->dev); device_remove_of_node(&bridge->dev); of_changeset_revert(np->data); @@ -887,7 +888,7 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) =20 ret =3D of_changeset_apply(cset); if (ret) - goto out_free_node; + goto out_clear_devlink_dev; =20 np->data =3D cset; =20 @@ -909,6 +910,8 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) out_revert_cset: np->data =3D NULL; of_changeset_revert(cset); +out_clear_devlink_dev: + fw_devlink_set_device(&np->fwnode, NULL); out_free_node: of_node_put(np); out_destroy_cset: --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 D85CB484236; Wed, 9 Sep 2026 08:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940960; cv=none; b=CeI4rHfUbRBYbFYGRNpHFh8RcKeMBZrLomMMTZOgP8K7m83Vyl1UpGSXgMAMWSat1DW2fwq/s7rNvLmVFpQVBKJnJVpgbNAXFSHARSsg75Rexwj5fJdvayO4JsUrbCwNLkU0JLVsCWVBU8qEKfJXBwYY72b0c/VUaT+FNqQEUzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940960; c=relaxed/simple; bh=4RVhPavqbFdZB9dLlUgTUNkwX9QrrcgqvBFuvF2ryQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OCV1IKpFYKf4Sk0Mg2k3trBlOkWLBzn7bW0j316BkpYCNLeTFRF5LVETqAEjrsdBVbtLQA2eGl9OaulJ0gFXW/U435wza4TROw109jYp9bGJTqBeNJYqCCY8WnbZMSmEsnFr/RoWzCaaBHbwTRR2nrc6azPnZifbwvfY87A7XjU= 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=pjnC7K5p; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pjnC7K5p" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 5EC961A1A77; Wed, 9 Sep 2026 08:02:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2CE0460448; Wed, 9 Sep 2026 08:02:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D710111C7AF5E; Wed, 9 Sep 2026 10:02:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940954; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=S9hVX9w2762K2NqjWVW1JueaSmRHavaw67h+zQmQF34=; b=pjnC7K5pQ5BzeWmR3L2BvvYdnOoypY2LEsKre4EEi2Sql8RS1V6pfkZo5M4BK38ayRDMqL YidsM4LucG7w+0HJFFSNNuS9yOYEZ851mUrOH/tjaf4r5Zv4p/TRvI6sI628mI4A5DoLxM cpnNG87ZNq/51EMwI0A1/cbKQnogIUOo7f8YANkqi72Aq32awMp10K4OvklFZ2WUD5jjvm j27UNSD0tzb3NWT0CTGcdMSVxs9yOVPvEGcjitXFOpnFKEX5rY64LVOAbTcI0zsQqC0EC/ yJCWwDN5RsRcabMmiKlic/6o2skkgz+WjytJGxvrnmIx2ILl1F2UGn+Jh1Fjog== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v11 08/10] PCI: of: Set fwnode device of newly created PCI device nodes Date: Wed, 9 Sep 2026 10:01:07 +0200 Message-ID: <20260909080114.591938-9-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Device-tree node can be created when CONFIG_PCI_DYNAMIC_OF_NODES. Those nodes are created and filled based on PCI core information but the fwnode device field is not set. When later an overlay is applied, this confuses fw_devlink. Indeed, without any device attached to the node, fw_devlink considers that this node will never become a device. When this node is pointed as a supplier, devlink looks at its ancestors in order to find a node with a device that could be used as the supplier. In the PCI use case, this leads to links that wrongly use the PCI root bridge device as the supplier instead of the expected PCI device. Setting the fwnode device to the device of the PCI device allows devlink to use this device as a supplier and so, correct links are created. Fixes: 407d1a51921e ("PCI: Create device tree node for bridge") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina Acked-by: Bjorn Helgaas Reviewed-by: Richard Cheng Acked-by: Manivannan Sadhasivam --- drivers/pci/of.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 29b63a9090ae..8914bfa25dc1 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -736,6 +736,7 @@ void of_pci_remove_node(struct pci_dev *pdev) if (!np || !of_node_check_flag(np, OF_DYNAMIC)) return; =20 + fw_devlink_set_device(&np->fwnode, NULL); device_remove_of_node(&pdev->dev); of_changeset_revert(np->data); of_changeset_destroy(np->data); @@ -788,9 +789,16 @@ void of_pci_make_dev_node(struct pci_dev *pdev) if (ret) goto out_free_node; =20 + /* + * Set the fwnode device in order to have fw_devlink creating links + * pointing to this PCI device instead of walking up to the PCI host + * bridge. + */ + fw_devlink_set_device(&np->fwnode, &pdev->dev); + ret =3D of_changeset_apply(cset); if (ret) - goto out_free_node; + goto out_clear_devlink_dev; =20 np->data =3D cset; =20 @@ -805,6 +813,8 @@ void of_pci_make_dev_node(struct pci_dev *pdev) out_revert_cset: np->data =3D NULL; of_changeset_revert(cset); +out_clear_devlink_dev: + fw_devlink_set_device(&np->fwnode, NULL); out_free_node: of_node_put(np); out_destroy_cset: --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 DBBF545FFBB; Wed, 9 Sep 2026 08:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940966; cv=none; b=g93k7FkDsBxu2qTDR494RAHfQIjlYm8H4E3R3Z/hD935ckFDEMe1Kh9Ex/viR5tlUt6QejslZyWB2KobinmsNkZWYdYa4PNwhQHvwlmCQbc7aQ7RzLqLQRSm8w6pU9VSkLSY/UX8vjIjIWIiAsu+u0aajfyDMNYs5sCWMXd4vyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940966; c=relaxed/simple; bh=JyaYp74hyva8mz2RggMjk+t8RJI4RaB768yDtXt9oRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SG9PZoyii8b3Vt2uvh07jjt7dH4hHEd1sr5noLmbXuE/4HOHIVUeTIuWGEZ/zmkyKf7LlkOt7VYmNO4GHWFEoEjb6ZJCWIvcvC67YuvEjBX5FO9GjSi4ixXBRWv5iump8cw47aGiLBhw93vr//7ML/nVaYx557uel7VOy++nkjg= 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=sq8SzsJp; arc=none smtp.client-ip=185.246.85.4 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="sq8SzsJp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 640384E415A9; Wed, 9 Sep 2026 08:02:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3448660448; Wed, 9 Sep 2026 08:02:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DA92D11C7AF66; Wed, 9 Sep 2026 10:02:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940960; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=I1e0hByJo0lwlUNMu1e3zjHq/L3qiW6+OWE+PPvPOK4=; b=sq8SzsJpHrK3MC8xReqdKMdZsPs43TAZUcH/qjqvzq9zyQ1i14UKA+gjWHNFFb9UWn0G28 +bpG+7IV8uGXjVwHKZKoEWKjCXWXwSjE0PaxoxziUry24bCSLIAOUgPpkSLMOb22ssZ8VV TYoK5HxlWspRs4mTVGL+kKZPTO0/jE5mGyIPDEK8gswLDG7N2DWuMH8qO7oghD/xWNAbjB 8jmIYCWfsHfKBnX0IQtq/fbSvBytzxs+NE3jhpsQWdo/pzmfTXYp5QvqNYiQ+PQNhOp4OQ zBx5ajOhrZ61s4I59SK3wSWvyh54gS1mwE/r9lJuKLnylSVXilF1PA7fXQMstQ== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable@vger.kernel.org Subject: [PATCH v11 09/10] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node Date: Wed, 9 Sep 2026 10:01:08 +0200 Message-ID: <20260909080114.591938-10-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" During the instantiation of devices described by a device-tree overlay applied on a PCI device, devlink displays the following kind of debug messages instead of creating the expected links: 'Not linking xxxx - might never become dev' Without those expected links, the device removal order cannot be correct. Those debug traces are printed by fw_devlink_create_devlink(). In our use case, they are all printed because the supplier of the link has at least one of its ancestor with its fwnode flag FWNODE_FLAG_INITIALIZED set. The culprit ancestor is the PCI root bridge. The fwnode related to the PCI root bridge is created dynamically by the of_pci_make_host_bridge_node() function. During this creation fwnode_dev_initialized() is called which set the FWNODE_FLAG_INITIALIZED flag. Calling fwnode_dev_initialized() tells devlink that the device related to this node is handled out of the driver core. This is not correct in our case. Indeed the device related to this firmware node is handled using driver core mechanisms and is fully compliant devlink expectations. Simply remove the fwnode_dev_initialized() call. With that done, the devlink debug messages are no more displayed and links that were missing are correctly created. Fixes: 1f340724419e ("PCI: of: Create device tree PCI host bridge node") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina Acked-by: Bjorn Helgaas Reviewed-by: Richard Cheng --- drivers/pci/of.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 8914bfa25dc1..0a5797652e18 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -894,7 +894,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) */ of_node_set_flag(np, OF_POPULATED); fw_devlink_set_device(&np->fwnode, &bridge->dev); - fwnode_dev_initialized(&np->fwnode, true); =20 ret =3D of_changeset_apply(cset); if (ret) --=20 2.55.0 From nobody Fri Sep 25 19:19:14 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 96A3C46D096; Wed, 9 Sep 2026 08:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940975; cv=none; b=Lu+vHhjco97EJRb7pNpyhXUyTbMhMMRaVC2SGufmkOWI5izSAGtV2qtoO6uBqDvBL2+Y8YxMioobYvZaSE4rAKVUTIiMnZBTWtL1MDpJzWLUKIfvt5mPMjEidN9sD/zxA5+IvIieTxCntIjc+M8sp6D1C5rOAwzvlSICrfVryZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788940975; c=relaxed/simple; bh=AZf0hTGanZoBX9juw8A4Hkcbr/03el49J34+Wj833zM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FifWWQNUZkWtT8pCgYUuPWvzO8xArNDqRuhlYTI122H9PHQJJlYKS2oiQHeEbckxo/T5jxN0qvRRioYPgambN9Tiyou1x9V3grJkD9tMcBd6IEAlju7zwoivICM8CrAAG+IdvFNFy4URdzWEhsfeZaQ0irFuIgfTuGC437AU6bE= 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=RIraTNUr; arc=none smtp.client-ip=185.246.84.56 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="RIraTNUr" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 36D9D1A1A70; Wed, 9 Sep 2026 08:02:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0732F60448; Wed, 9 Sep 2026 08:02:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A0BF711C7AF61; Wed, 9 Sep 2026 10:02:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788940966; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=eCEDZNLNxkg3C8C9bAECCcFaN+XP6VaQ0+RYJcLH1V4=; b=RIraTNUrkx8rCgnGMdZIZgTAmId6aTvpFsKskmRr8sg58vyK+nsLZw+IEBJ/WApunHb/X8 kXXLsF/GCIY7yWlgLuQ1dLYx4qDXo5z3PainBnBqpGjZC9r4sZaUYSm9alaRpm+2RmlaRu lKFOoY5Th4hY02UleIwruKfgCzgUmV1nVSlZKkfIl9QtoePCzkCWZm7RUh9AmyxjdQiCA8 zNiQeW4LbncfeogkF85WKGhEA/Nmw/TYjgjiPeocqbZ2x3VGbN+6v/R1FLYbIfVXdS3vC/ buGYg/XJLb2IJBYAkx0Xzv0C1QpqFxMk5hvR/nMdJ4e0Ab6CGDzrnrHm8i3Kmg== From: Herve Codina To: Richard Cheng , Andrew Lunn , Rob Herring , Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Bartosz Golaszewski , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams , Ira Weiny , Li Ming , Herve Codina , Lizhi Hou Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Daniel Machon , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni , stable+noautosel@kernel.org Subject: [PATCH v11 10/10] PCI: of: Avoid np->data usage for the node changeset Date: Wed, 9 Sep 2026 10:01:09 +0200 Message-ID: <20260909080114.591938-11-herve.codina@bootlin.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909080114.591938-1-herve.codina@bootlin.com> References: <20260909080114.591938-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 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" of_pci_remove_node() and of_pci_remove_host_bridge_node() check whether the node is dynamic but not whether it has valid private data. During the node creation, an OF changeset is used and this changeset is stored in np->data to be available for removal functions. If, for instance, a PCI host bridge is created using a device-tree overlay, the related node will have the dynamic flag set but np->data will be NULL. This leads to NULL pointer dereferences. Checking for a non-NULL np->data pointer to determine if the node has been created by the PCI node creation process is not enough. Indeed, on some platforms like PowerPC, the OF_RECONFIG_ATTACH_NODE notifier (e.g., in the pci_dn_reconfig_notifier() function) intercepts node additions and populates np->data with its own structure, such as a struct pci_dn. In that case, np->data is not NULL but it is not related to our changeset stored during the PCI node process creation. Avoid the usage of np->data to store the changeset used during the PCI node creation. Store our changeset in a more relevant structure: either struct pci_dev when the node is created for a PCI device or struct pci_host_bridge when the node is created for the PCI host bridge. With that done, no ambiguity remains on removal. Indeed, this changeset, if non-NULL, is the one used during PCI node creation. Check and use this changeset on the removal process. Fixes: 407d1a51921e ("PCI: Create device tree node for bridge") Fixes: 1f340724419e ("PCI: of: Create device tree PCI host bridge node") Cc: # Issue not triggered but could be a prob= lem Signed-off-by: Herve Codina --- drivers/pci/of.c | 28 ++++++++++++++-------------- include/linux/pci.h | 11 +++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 0a5797652e18..cd87128c71dd 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -732,15 +732,16 @@ void of_pci_remove_node(struct pci_dev *pdev) { struct device_node *np; =20 - np =3D pci_device_to_OF_node(pdev); - if (!np || !of_node_check_flag(np, OF_DYNAMIC)) + if (!pdev->cset) return; =20 + np =3D pci_device_to_OF_node(pdev); fw_devlink_set_device(&np->fwnode, NULL); device_remove_of_node(&pdev->dev); - of_changeset_revert(np->data); - of_changeset_destroy(np->data); + of_changeset_revert(pdev->cset); + of_changeset_destroy(pdev->cset); of_node_put(np); + kfree(pdev->cset); } =20 void of_pci_make_dev_node(struct pci_dev *pdev) @@ -800,18 +801,17 @@ void of_pci_make_dev_node(struct pci_dev *pdev) if (ret) goto out_clear_devlink_dev; =20 - np->data =3D cset; - ret =3D device_add_of_node(&pdev->dev, np); if (ret) goto out_revert_cset; =20 + pdev->cset =3D cset; + kfree(name); =20 return; =20 out_revert_cset: - np->data =3D NULL; of_changeset_revert(cset); out_clear_devlink_dev: fw_devlink_set_device(&np->fwnode, NULL); @@ -828,16 +828,17 @@ void of_pci_remove_host_bridge_node(struct pci_host_b= ridge *bridge) { struct device_node *np; =20 - np =3D pci_bus_to_OF_node(bridge->bus); - if (!np || !of_node_check_flag(np, OF_DYNAMIC)) + if (!bridge->cset) return; =20 + np =3D pci_bus_to_OF_node(bridge->bus); fw_devlink_set_device(&np->fwnode, NULL); device_remove_of_node(&bridge->bus->dev); device_remove_of_node(&bridge->dev); - of_changeset_revert(np->data); - of_changeset_destroy(np->data); + of_changeset_revert(bridge->cset); + of_changeset_destroy(bridge->cset); of_node_put(np); + kfree(bridge->cset); } =20 void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge) @@ -899,8 +900,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) if (ret) goto out_clear_devlink_dev; =20 - np->data =3D cset; - /* Add the of_node to host bridge and the root bus */ ret =3D device_add_of_node(&bridge->dev, np); if (ret) @@ -910,6 +909,8 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) if (ret) goto out_remove_bridge_dev_of_node; =20 + bridge->cset =3D cset; + kfree(name); =20 return; @@ -917,7 +918,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridg= e *bridge) out_remove_bridge_dev_of_node: device_remove_of_node(&bridge->dev); out_revert_cset: - np->data =3D NULL; of_changeset_revert(cset); out_clear_devlink_dev: fw_devlink_set_device(&np->fwnode, NULL); diff --git a/include/linux/pci.h b/include/linux/pci.h index d31a8d107b1e..7b0ba9ec7b5c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -339,6 +339,9 @@ struct pcie_link_state; struct pci_sriov; struct pci_p2pdma; struct rcec_ea; +#ifdef CONFIG_PCI_DYNAMIC_OF_NODES +struct of_changeset; +#endif =20 /* struct pci_dev - describes a PCI device * @@ -598,6 +601,10 @@ struct pci_dev { u8 tph_mode; /* TPH mode */ u8 tph_req_type; /* TPH requester type */ #endif + +#ifdef CONFIG_PCI_DYNAMIC_OF_NODES + struct of_changeset *cset; /* Changeset used for OF node creation */ +#endif }; =20 static inline struct pci_dev *pci_physfn(struct pci_dev *dev) @@ -670,6 +677,10 @@ struct pci_host_bridge { unsigned int broken_l1ss_resume:1; /* Resuming from L1SS during system suspend is broken */ =20 +#ifdef CONFIG_PCI_DYNAMIC_OF_NODES + struct of_changeset *cset; /* Changeset used for OF node creation */ +#endif + /* Resource alignment requirements */ resource_size_t (*align_resource)(struct pci_dev *dev, const struct resource *res, --=20 2.55.0