From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 303F01F4274; Fri, 8 Nov 2024 14:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076569; cv=none; b=JELTTSsTwuWDYKfME4Oot0MXeHZXD4K6XBamvmU/SWpG6mYb62wdsphQ2qv45uy5SawNN7mXlSFHb4d/fVx4+SwmXn2zfahPlHq3TZQhEaZIvarJFs+vsoYYVX91mlh6shusnzjJoF4qZ3SBgFDlW6EQVXlRrhjlDLqmAGxutfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076569; c=relaxed/simple; bh=fFlSWRo5CGj/soJ4FeN/4ywI5xwXWTwJU19CnsnNvWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eiBSgkyY/AO1CED7opo0FtGDIy8SyPBpQ6UND9nPDisnGtKPZIvER1MKQJYoUFv2d2kY4iM33cyufbOLaxjA/1+moUTOv88lHFk5ub9KlCk+mC7T72tcvJUG7kspmehw+9ohLrcetpb78IIi90RSHFnis8XXQF0woA0USMM7dEE= 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=pgS0KQfn; arc=none smtp.client-ip=217.70.183.200 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="pgS0KQfn" Received: by mail.gandi.net (Postfix) with ESMTPA id 156272000D; Fri, 8 Nov 2024 14:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076564; 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=UOcOQCBpfyT+DU0uSsNnEAQ1wPpL7/ZNAwbM9KbqeXY=; b=pgS0KQfnEvMpUgDgcdBiPM9hmo93VLDBQugwgdC70MGNn2uOctv+E3Dvt38rPb3bLImHLJ mxACsq51Uicj/5zprU0oeM/TQLgYfOV3qmswjcixmzg5mCyLplUIa6KZ/uGHfmTP20p8bl 9pTba6X3gyaxpaXkSpktrCXNVuUgU6Mk1B4qlo+4FV6HVTqpsOlhXtgKyFV1Q+HNdpJG4P cG0s4OqJO90Jx6ATaKvEOwjhdY9Pv8n2qT3Davk3DvSJXc+9tDAJs9Fz+khXQMMwoHzYZw uOcTNNoJ8VnAbqX9vbLJ+1IvJiU2YUZtdxKCq+TjnzTyLzYBUxpQxYSbioKSyQ== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 1/6] driver core: Introduce device_{add,remove}_of_node() Date: Fri, 8 Nov 2024 15:35:54 +0100 Message-ID: <20241108143600.756224-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" An of_node can be set to a device using device_set_node(). This function cannot prevent any of_node and/or fwnode overwrites. When adding an of_node on an already present device, the following operations need to be done: - Attach the of_node if no of_node were already attached - Attach the of_node as a fwnode if no fwnode were already attached This is the purpose of device_add_of_node(). device_remove_of_node() reverts the operations done by device_add_of_node(). Signed-off-by: Herve Codina --- drivers/base/core.c | 52 ++++++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 54 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 24c572031403..0aa63371f55d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -5118,6 +5118,58 @@ void set_secondary_fwnode(struct device *dev, struct= fwnode_handle *fwnode) } EXPORT_SYMBOL_GPL(set_secondary_fwnode); =20 +/** + * device_remove_of_node - Remove an of_node from a device + * @dev: device whose device-tree node is being removed + */ +void device_remove_of_node(struct device *dev) +{ + dev =3D get_device(dev); + if (!dev) + return; + + if (!dev->of_node) + goto end; + + if (dev->fwnode =3D=3D of_fwnode_handle(dev->of_node)) + dev->fwnode =3D NULL; + + of_node_put(dev->of_node); + dev->of_node =3D NULL; + +end: + put_device(dev); +} +EXPORT_SYMBOL_GPL(device_remove_of_node); + +/** + * device_add_of_node - Add an of_node to an existing device + * @dev: device whose device-tree node is being added + * @of_node: of_node to add + */ +void device_add_of_node(struct device *dev, struct device_node *of_node) +{ + if (!of_node) + return; + + dev =3D get_device(dev); + if (!dev) + return; + + if (WARN(dev->of_node, "%s: Cannot replace node %pOF with %pOF\n", + dev_name(dev), dev->of_node, of_node)) + goto end; + + dev->of_node =3D of_node_get(of_node); + + if (!dev->fwnode) + dev->fwnode =3D of_fwnode_handle(of_node); + +end: + put_device(dev); +} +EXPORT_SYMBOL_GPL(device_add_of_node); + /** * device_set_of_node_from_dev - reuse device-tree node of another device * @dev: device whose device-tree node is being set diff --git a/include/linux/device.h b/include/linux/device.h index b4bde8d22697..e3aa25ce1f90 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1146,6 +1146,8 @@ int device_online(struct device *dev); void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode= ); void device_set_node(struct device *dev, struct fwnode_handle *fwnode); +void device_add_of_node(struct device *dev, struct device_node *of_node); +void device_remove_of_node(struct device *dev); void device_set_of_node_from_dev(struct device *dev, const struct device *= dev2); =20 static inline struct device_node *dev_of_node(struct device *dev) --=20 2.46.2 From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 3035938DC8; Fri, 8 Nov 2024 14:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076569; cv=none; b=dl31+ZhXWmDGVbQ33tIHlkDiNfKF203JOtIhaPs1urbO1oW8cSXMLCBz8v/mNNfMwYUb5EOfVmwcwS7YOEQDKsKt2UI2hPelpvrKyTRmi0HZJs0bviKc4ikCtZyeTliyjDO8KfTmuNXfa/iidLU4f1VJFjSxLEztOU9kYMERhcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076569; c=relaxed/simple; bh=iC/tjyklxFXoTOf6oiIBxBquODf1xpsZRKEBUxujKqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CuGD4xuev0FByaJoRvWt4EQ+NIfnzIgN1VgIFScBZMgf7CAipicrPPYFNvDwWWxEMr3FeFYJWSOiYxFEOW96ydsDpO3tN0f1fB7nrNql3Txui2R7HGgJ6UX3+33zVqBJCU5snkYse0kYYMBqwP6bLE9Ex5tUT7swtr5gYgmcHog= 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=eS3znHT6; arc=none smtp.client-ip=217.70.183.200 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="eS3znHT6" Received: by mail.gandi.net (Postfix) with ESMTPA id EABF12000A; Fri, 8 Nov 2024 14:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076565; 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=R60WsNzvgmPsBwX9PYv+8rZFmtBKiv6od0fGxwx0fbc=; b=eS3znHT6SV6YmrG5ChPGDpVal1KL4026SFCfN3KWgFZmhvApu8cKYleEZ1draEMsb2mSP7 MnGEtVGLgsIYvOvI6VhtzE5zVljgJSBXVUGhXJNQb3ugoXuDfC7joUYzCTTXCelfG9Ig98 OdQwHtuWNvhGF99+pPGgd8Kw8QnY5OeACsbNxzgg4nClFK8d5SeqXkbQrg/yAMU3bwYmmd tNfuK+/s7ez/1W73HxGxXX4dCpbEGN80VrccrrZqPwop2CtLojAIdb8kcVwPo18CItgOEo 9j5MjYZ8U+mMw1Y2IwTESkg16HDFHsoO4S5L000VVOTJBVz87FhMzvdG6mmuBw== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 2/6] PCI: of: Use device_{add,remove}_of_node() to attach of_node to existing device Date: Fri, 8 Nov 2024 15:35:55 +0100 Message-ID: <20241108143600.756224-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" The commit 407d1a51921e ("PCI: Create device tree node for bridge") creates of_node for PCI devices. The newly created of_node is attached to an existing device. This is done setting directly pdev->dev.of_node in the code. Even if pdev->dev.of_node cannot be previously set, this doesn't handle the fwnode field of the struct device. Indeed, this field needs to be set if it hasn't already been set. device_{add,remove}_of_node() have been introduced to handle this case. Use them instead of the direct setting. Signed-off-by: Herve Codina --- drivers/pci/of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index dacea3fc5128..141ffbb1b3e6 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -655,8 +655,8 @@ void of_pci_remove_node(struct pci_dev *pdev) np =3D pci_device_to_OF_node(pdev); if (!np || !of_node_check_flag(np, OF_DYNAMIC)) return; - pdev->dev.of_node =3D NULL; =20 + device_remove_of_node(&pdev->dev); of_changeset_revert(np->data); of_changeset_destroy(np->data); of_node_put(np); @@ -713,7 +713,7 @@ void of_pci_make_dev_node(struct pci_dev *pdev) goto out_free_node; =20 np->data =3D cset; - pdev->dev.of_node =3D np; + device_add_of_node(&pdev->dev, np); kfree(name); =20 return; --=20 2.46.2 From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 89D241EABA2; Fri, 8 Nov 2024 14:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076571; cv=none; b=an3xWGH/JbDQjrHu+epiMZ/8k6TTHjPSpdkGrZml3RUcAZH/+ObkUVeBaMHSP18rNskD2Tu7RtQU1JVmAneLvdQd/G6QzK4U4tQi+NTCC6il8w4v8vHnMekJ0Vi5PtaMDbo4B7l8LVPfTSOT33fPRApSc1uT5Th+hkdU7YW48ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076571; c=relaxed/simple; bh=KbQcH2DUBO4XBFA/lTskG3ADO76dFxPNoXmfqDECx2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=apkgkeU5zjNDtA1RYo279GjXSFfNZLmMpIFtkoOp/1FGGRnHIFDYKuFcnBM0uVaQOwU3RdlzxpNN/N9xRjCG3GpLHO00e9n0Vo7DmpYVljXcFO1od4VLDwubGtFy28hjo5S9z57v+TqFEdorQMTEns/2LzixojoHjcu7DIsmpEA= 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=UdTNNBgb; arc=none smtp.client-ip=217.70.183.200 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="UdTNNBgb" Received: by mail.gandi.net (Postfix) with ESMTPA id BA51F20002; Fri, 8 Nov 2024 14:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076566; 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=OWUWbgIcwwkYpx2sGFB36arAHxZpqg+uUR07E7hW3jI=; b=UdTNNBgbzpcSv/Bb4gIeUvZkAIjcOcCmraY864z9PUzZCEy4upyj70UvLnqgj7eUkCaVq5 0o1Uh0zPJo8QpvwUtFFhbKLDhCWtcMStFdPIIunkqOt8rQ5zBAUwA7uG76pNM1/VrrLEIb wzqxLr/fmWkVaOIbcCEdGg3uSTMlmxMW5VNtS73Y/fleR9NAfq6s/CmXti6FNK/6zQhC0+ T8hgrlcluwiA4L9UUiCY9CL2GbehNIod7VWlpxS7f5C16XuQCZ5SM0ELpZ3OeivqX5GwyG Xu1vF6me6lPNLX3tOVu7nx4L3UWYn7Wnu0dvOYHS0XpqK3ur1Xn77NFkDZpJlA== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 3/6] PCI: of_property: Add support for NULL pdev in of_pci_set_address() Date: Fri, 8 Nov 2024 15:35:56 +0100 Message-ID: <20241108143600.756224-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" The pdev (pointer to a struct pci_dev) parameter of of_pci_set_address() cannot be NULL. In order to reuse of_pci_set_address() when creating the PCI root bus node, this function needs to support a NULL pdev parameter. Indeed, in the case of the PCI root bus node creation, no pdev are available and of_pci_set_address() will be used with the bridge windows. Allow to call of_pci_set_address() with a NULL pdev. Signed-off-by: Herve Codina --- drivers/pci/of_property.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 5a0b98e69795..59cc5c851fc3 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -54,9 +54,13 @@ enum of_pci_prop_compatible { static void of_pci_set_address(struct pci_dev *pdev, u32 *prop, u64 addr, u32 reg_num, u32 flags, bool reloc) { - prop[0] =3D FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) | - FIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) | - FIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn)); + if (pdev) + prop[0] =3D FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) | + FIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) | + FIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn)); + else + prop[0] =3D 0; + prop[0] |=3D flags | reg_num; if (!reloc) { prop[0] |=3D OF_PCI_ADDR_FIELD_NONRELOC; --=20 2.46.2 From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 8A0391F4709; Fri, 8 Nov 2024 14:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076571; cv=none; b=YlTgF0hUoziFC5d9UBQ19I1cHKN6ZUYLR14CUzuUP9x3Pf73QlBKakBeBs30+OnjYRXxECljkRB1WYJ7lPFLs8y0vDb8gsnwlvsA1oMU/2F3zvXtGai1h5/GGc5+XJqJY//g1A1TUSdoreBH72BbF/bp5fWZnnYNlBLjw3m0NOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076571; c=relaxed/simple; bh=fYwE5EjMh19lhQDnSaq4yYULUe6QFJR/LjTL/pR+GRg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U3+zVKUBxhT++XPsHBCsS5hjMOnzbejrIY7ofqBMsKfywEFTc1m/x3cBLojlKWw88BrrZ3AdJC3a+PWlh9H8YdjGcR5kQXc4j6VjAIygwN35bLN8yDWDjwVEwysGIkx6Rb5gBRJdzt8I/r0808GSZqg2EvheroAmX577+nEEn9c= 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=oGfE/lo0; arc=none smtp.client-ip=217.70.183.200 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="oGfE/lo0" Received: by mail.gandi.net (Postfix) with ESMTPA id 8B1A820009; Fri, 8 Nov 2024 14:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076567; 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=GxzxY5tO2wGGtnAYK1ZdH8OX9CY4/fDjyHiH50aTJak=; b=oGfE/lo0wsEqQ1FNpOVEjJlANoPwJhdtUYaUscQOsX+VfPWa33C8o0n28vyCJnEWJXLXr3 aJgHWSPWMXgFRBhV3bCe9tLDIoXxIUtIVxXc8xjt4z6rw4LyqETvvTXZBRMKpyGEoWbsDD Kwh7OB3omL5E0hdtk86yXWn2cKlZLvx4GmIEEJ7EEE1L8fGvUruNvxqyVzTE+g6pyNsg/j WY9b3LdAWeUksbEk5YWWT5fZl9wft/UR+cPAp5J89/ZKbsOFvIzS1w82Qo8gCvSJeeW7/n OJoi7P/SvdO5kEJfONJbCULTb48pIjWmSAJvYvc9jwQgw1k7U6H8C6UVZvePDA== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 4/6] PCI: of_property: Constify parameter in of_pci_get_addr_flags() Date: Fri, 8 Nov 2024 15:35:57 +0100 Message-ID: <20241108143600.756224-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" The res parameter has no reason to be a pointer to an un-const struct resource. Indeed, struct resource is not supposed to be modified by the function. Constify the res parameter. Signed-off-by: Herve Codina --- drivers/pci/of_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 59cc5c851fc3..e56159cc48e8 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -69,7 +69,7 @@ static void of_pci_set_address(struct pci_dev *pdev, u32 = *prop, u64 addr, } } =20 -static int of_pci_get_addr_flags(struct resource *res, u32 *flags) +static int of_pci_get_addr_flags(const struct resource *res, u32 *flags) { u32 ss; =20 --=20 2.46.2 From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 8C2971F4295; Fri, 8 Nov 2024 14:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076572; cv=none; b=a4yxyYoqvdbD0S68ONqFQootnhYnopVPSseBI/ibjD0LPYleeKSHSMReHrjJ2uMq36FN/z0YFM82OsYzxf4fjwbUmWlAdgbrP4VO7kMwnfLNQfyv6lluMPKggsd9G4+tJ8TpbgnoIgJ3fZf9ZurpMCr1nha8YxPAAo7VnRW7BLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076572; c=relaxed/simple; bh=6slO009d/9VQJg5blm25QM7TQPdNoNYn/yLCwGyNYeE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cLwew3yqleV1dvE8ceCUUZ0IOMG7TrvXFj9cztR9RYDXTuponZFCeZRqhK28VuEu81rRmztNGtbNkGnB0Kht5RELf5GPHrYnoSNc6TjzLzaDvxSB0J0JoShDyN+kMnFPW/Mqq1neADh/DdPHNq1QayygcvRyE0xjkR3IHxTtACs= 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=IquwqNOR; arc=none smtp.client-ip=217.70.183.200 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="IquwqNOR" Received: by mail.gandi.net (Postfix) with ESMTPA id 722B420004; Fri, 8 Nov 2024 14:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076568; 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=7OgyLhE+jNXZk7m4HF7bpGki7AeOrZWO847eMX6Y0+o=; b=IquwqNOR4EnGHdegHxI9dVN3UTG9kf0ueY3C6wpWTPwhdamaUcup9x5YbQk8EnZhjWcOZw GcEfTFf6G8MNjEbOEawHlWM1gVcLVVdxCLOgeFHWh0MxI7lIdjDqEqeehLDf4M8Z+FGEcW 9d/okO+nvGOl/KCZBvMCI2NXOOavUzhEpr0yu38qYr8V3hPpkQyNx1SbpNrlFo4xxD2XCe 3jVBsmmZUctWM5pA2F1omGiM7YWFhxe3+Jw6XymaId4crtdxHsmTDG7x+XTnb56/E7NiSj FNpnF05NV0uTeMQHxLukYkzge1HCAnxf3KDD3dMop6wiJkL11jUQTBHR9qCYBg== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 5/6] of: Add #address-cells/#size-cells in the device-tree root empty node Date: Fri, 8 Nov 2024 15:35:58 +0100 Message-ID: <20241108143600.756224-6-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" On systems where ACPI is enabled or when a device-tree is not passed to the kernel by the bootloader, a device-tree root empty node is created. This device-tree root empty node doesn't have the #address-cells and the This leads to the use of the default address cells and size cells values which are defined in the code to 1 for address cells and 1 for size cells According to the devicetree specification and the OpenFirmware standard (IEEE 1275-1994) the default value for #address-cells should be 2. Also, according to the devicetree specification, the #address-cells and the #size-cells are required properties in the root node. Modern implementation should have the #address-cells and the #size-cells properties set and should not rely on default values. On x86, this root empty node is used and the code default values are used. In preparation of the support for device-tree overlay on PCI devices feature on x86 (i.e. the creation of the PCI root bus device-tree node), the default value for #address-cells needs to be updated. Indeed, on x86_64, addresses are on 64bits and the upper part of an address is needed for correct address translations. On x86_32 having the default value updated does not lead to issues while the uppert part of a 64bits address is zero. Changing the default value for all architectures may break device-tree compatibility. Indeed, existing dts file without the #address-cells property set in the root node will not be compatible with this modification. Instead of updating default values, add required #address-cells and Signed-off-by: Herve Codina --- drivers/of/empty_root.dts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/of/empty_root.dts b/drivers/of/empty_root.dts index cf9e97a60f48..5017579f34dc 100644 --- a/drivers/of/empty_root.dts +++ b/drivers/of/empty_root.dts @@ -2,5 +2,11 @@ /dts-v1/; =20 / { - + /* + * #address-cells/#size-cells are required properties at root node + * according to the devicetree specification. Use same values as default + * values mentioned for #address-cells/#size-cells properties. + */ + #address-cells =3D <0x02>; + #size-cells =3D <0x01>; }; --=20 2.46.2 From nobody Sun Nov 24 01:06:01 2024 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 9B6B51F5825; Fri, 8 Nov 2024 14:36:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076574; cv=none; b=JTUOb3w2F2csgcaE4u3M6LWYP2tEZOcO1IWcpm5QcT+5SYKUarnN2ZjS/ICc8M62mKDJQ0BA27L8B7U7oLb8aEgKfaRdrAvZ6Upaz426DOdFaLpV705gI7NfCTqTr6yc5Fs7BC7Uwdvyast89NyCLpm+xeXRF1UTedPrZmxpJ/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731076574; c=relaxed/simple; bh=3kvlDqV0tXgEzAPAtwg8yui0NrIq88s4pdVp/yxJzfE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oWsuVdXlBHh5oLwyUxFZRkh7TStCiA8tSzVzsdROHK0FrHUJjWBc9zFnxsbNRI4szrwkXAdBKtdu52V530VRhBKKWEqaiJma54dKpvyPjs0JXyLoLaMjLXf4qnShyBW7wRU1eJ+VVRgLqx+YO9wiWnhIinEyA/CbDq1Aue6kTFM= 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=FjSSh+c7; arc=none smtp.client-ip=217.70.183.200 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="FjSSh+c7" Received: by mail.gandi.net (Postfix) with ESMTPA id 3C4D72000E; Fri, 8 Nov 2024 14:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1731076568; 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=XOigWkMO2U2ofXPZcVrSkjfciW4tfAlRbP7bVVv6C6w=; b=FjSSh+c7WVylQYQ7FJsL/nQafsc3e0SiFcQ7GKRpymQbkVTOOZ050LrcDH9bav1s4IgLHN DUarGQ20f0pKh/x7PXklVUXkfDI93KmXvArPtl8UBGT9q5jNFlGQOk/q6O6jiEcy5zY9Qa ni18uyoML8rqQwhSuauXR3nhWUT9OjANZENHFLJiCbpOKgtsxJd4gy8EEorwQvhMHCMrJp Nyv1vgSvVXnTkEew2XFz5D0MS3V7YW3l7oT4339OqIckqxoFstOaWQAlnyQODLXOVv3bqF EK74wrOlFHLgYnE+Q0l8zapl7Zgzz7tU1+iku0H2oedtrKEM2pwEgasQdZkYQg== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Saravana Kannan , Bjorn Helgaas , Lizhi Hou Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 6/6] PCI: of: Create device-tree PCI host bridge node Date: Fri, 8 Nov 2024 15:35:59 +0100 Message-ID: <20241108143600.756224-7-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241108143600.756224-1-herve.codina@bootlin.com> References: <20241108143600.756224-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-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" PCI devices device-tree nodes can be already created. This was introduced by commit 407d1a51921e ("PCI: Create device tree node for bridge"). In order to have device-tree nodes related to PCI devices attached on their PCI root bus (the PCI bus handled by the PCI host bridge), a PCI root bus device-tree node is needed. This root bus node will be used as the parent node of the first level devices scanned on the bus. On device-tree based systems, this PCI root bus device tree node is set to the node of the related PCI host bridge. The PCI host bridge node is available in the device-tree used to describe the hardware passed at boot. On non device-tree based system (such as ACPI), a device-tree node for the PCI host bridge or for the root bus do not exist. Indeed, the PCI host bridge is not described in a device-tree used at boot simply because no device-tree are passed at boot. The device-tree PCI host bridge node creation needs to be done at runtime. This is done in the same way as for the creation of the PCI device nodes. I.e. node and properties are created based on computed information done by the PCI core. Also, as is done on device-tree based systems, this PCI host bridge node is used for the PCI root bus. Signed-off-by: Herve Codina --- drivers/pci/of.c | 94 ++++++++++++++++++++++++++++++++++- drivers/pci/of_property.c | 102 ++++++++++++++++++++++++++++++++++++++ drivers/pci/pci.h | 6 +++ drivers/pci/probe.c | 2 + drivers/pci/remove.c | 2 + 5 files changed, 205 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 141ffbb1b3e6..316c31d13aa8 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -726,7 +726,99 @@ void of_pci_make_dev_node(struct pci_dev *pdev) out_free_name: kfree(name); } -#endif + +void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge) +{ + struct device_node *np; + + np =3D pci_bus_to_OF_node(bridge->bus); + if (!np || !of_node_check_flag(np, OF_DYNAMIC)) + return; + + device_remove_of_node(&bridge->bus->dev); + device_remove_of_node(&bridge->dev); + of_changeset_revert(np->data); + of_changeset_destroy(np->data); + of_node_put(np); +} + +void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge) +{ + struct device_node *np =3D NULL; + struct of_changeset *cset; + const char *name; + int ret; + + /* + * If there is already a device-tree node linked to the PCI bus handled + * by this bridge (i.e. the PCI root bus), nothing to do. + */ + if (pci_bus_to_OF_node(bridge->bus)) + return; + + /* The root bus has no node. Check that the host bridge has no node too */ + if (bridge->dev.of_node) { + pr_err("PCI host bridge of_node already set"); + return; + } + + /* Check if there is a DT root node to attach the created node */ + if (!of_root) { + pr_err("of_root node is NULL, cannot create PCI host bridge node\n"); + return; + } + + name =3D kasprintf(GFP_KERNEL, "pci@%x,%x", pci_domain_nr(bridge->bus), + bridge->bus->number); + if (!name) + return; + + cset =3D kmalloc(sizeof(*cset), GFP_KERNEL); + if (!cset) + goto out_free_name; + of_changeset_init(cset); + + np =3D of_changeset_create_node(cset, of_root, name); + if (!np) + goto out_destroy_cset; + + ret =3D of_pci_add_host_bridge_properties(bridge, cset, np); + if (ret) + goto out_free_node; + + /* + * This of_node will be added to an existing device. The of_node parent + * is the root OF node and so this node will be handled by the platform + * bus. Avoid any new device creation. + */ + of_node_set_flag(np, OF_POPULATED); + np->fwnode.dev =3D &bridge->dev; + fwnode_dev_initialized(&np->fwnode, true); + + ret =3D of_changeset_apply(cset); + if (ret) + goto out_free_node; + + np->data =3D cset; + + /* Add the of_node to host bridge and the root bus */ + device_add_of_node(&bridge->dev, np); + device_add_of_node(&bridge->bus->dev, np); + + kfree(name); + + return; + +out_free_node: + of_node_put(np); +out_destroy_cset: + of_changeset_destroy(cset); + kfree(cset); +out_free_name: + kfree(name); +} + +#endif /* CONFIG_PCI_DYNAMIC_OF_NODES */ =20 #endif /* CONFIG_PCI */ =20 diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index e56159cc48e8..e8e2c3ecc255 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -394,3 +394,105 @@ int of_pci_add_properties(struct pci_dev *pdev, struc= t of_changeset *ocs, =20 return 0; } + +static bool of_pci_is_range_resource(const struct resource *res, u32 *flag= s) +{ + if (!(resource_type(res) & IORESOURCE_MEM) && + !(resource_type(res) & IORESOURCE_MEM_64)) + return false; + + if (of_pci_get_addr_flags(res, flags)) + return false; + + return true; +} + +static int of_pci_host_bridge_prop_ranges(struct pci_host_bridge *bridge, + struct of_changeset *ocs, + struct device_node *np) +{ + struct resource_entry *window; + unsigned int ranges_sz =3D 0; + unsigned int n_range =3D 0; + struct resource *res; + int n_addr_cells; + u32 *ranges; + u64 val64; + u32 flags; + int ret; + + n_addr_cells =3D of_n_addr_cells(np); + if (n_addr_cells <=3D 0 || n_addr_cells > 2) + return -EINVAL; + + resource_list_for_each_entry(window, &bridge->windows) { + res =3D window->res; + if (!of_pci_is_range_resource(res, &flags)) + continue; + n_range++; + } + + if (!n_range) + return 0; + + ranges =3D kcalloc(n_range, + (OF_PCI_ADDRESS_CELLS + OF_PCI_SIZE_CELLS + + n_addr_cells) * sizeof(*ranges), + GFP_KERNEL); + if (!ranges) + return -ENOMEM; + + resource_list_for_each_entry(window, &bridge->windows) { + res =3D window->res; + if (!of_pci_is_range_resource(res, &flags)) + continue; + + /* PCI bus address */ + val64 =3D res->start; + of_pci_set_address(NULL, &ranges[ranges_sz], val64 - window->offset, + 0, flags, false); + ranges_sz +=3D OF_PCI_ADDRESS_CELLS; + + /* Host bus address */ + if (n_addr_cells =3D=3D 2) + ranges[ranges_sz++] =3D upper_32_bits(val64); + ranges[ranges_sz++] =3D lower_32_bits(val64); + + /* Size */ + val64 =3D resource_size(res); + ranges[ranges_sz] =3D upper_32_bits(val64); + ranges[ranges_sz + 1] =3D lower_32_bits(val64); + ranges_sz +=3D OF_PCI_SIZE_CELLS; + } + + ret =3D of_changeset_add_prop_u32_array(ocs, np, "ranges", ranges, ranges= _sz); + kfree(ranges); + return ret; +} + +int of_pci_add_host_bridge_properties(struct pci_host_bridge *bridge, + struct of_changeset *ocs, + struct device_node *np) +{ + int ret; + + ret =3D of_changeset_add_prop_string(ocs, np, "device_type", "pci"); + if (ret) + return ret; + + ret =3D of_changeset_add_prop_u32(ocs, np, "#address-cells", + OF_PCI_ADDRESS_CELLS); + if (ret) + return ret; + + ret =3D of_changeset_add_prop_u32(ocs, np, "#size-cells", + OF_PCI_SIZE_CELLS); + if (ret) + return ret; + + ret =3D of_pci_host_bridge_prop_ranges(bridge, ocs, np); + if (ret) + return ret; + + return 0; +} diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa..f2092a119f2c 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -802,9 +802,15 @@ void of_pci_make_dev_node(struct pci_dev *pdev); void of_pci_remove_node(struct pci_dev *pdev); int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs, struct device_node *np); +void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge); +void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge); +int of_pci_add_host_bridge_properties(struct pci_host_bridge *bridge, stru= ct of_changeset *ocs, + struct device_node *np); #else static inline void of_pci_make_dev_node(struct pci_dev *pdev) { } static inline void of_pci_remove_node(struct pci_dev *pdev) { } +static inline void of_pci_make_host_bridge_node(struct pci_host_bridge *br= idge) { } +static inline void of_pci_remove_host_bridge_node(struct pci_host_bridge *= bridge) { } #endif =20 #ifdef CONFIG_PCIEAER diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4f68414c3086..bfe89ce8d800 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1049,6 +1049,8 @@ static int pci_register_host_bridge(struct pci_host_b= ridge *bridge) dev_info(&bus->dev, "root bus resource %pR%s\n", res, addr); } =20 + of_pci_make_host_bridge_node(bridge); + down_write(&pci_bus_sem); list_add_tail(&bus->node, &pci_root_buses); up_write(&pci_bus_sem); diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index e4ce1145aa3e..2c379c9ab5b4 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -160,6 +160,8 @@ void pci_stop_root_bus(struct pci_bus *bus) &bus->devices, bus_list) pci_stop_bus_device(child); =20 + of_pci_remove_host_bridge_node(host_bridge); + /* stop the host bridge */ device_release_driver(&host_bridge->dev); } --=20 2.46.2