[PATCH v2 13/16] PCI: Split pci_resource_post_release() out of pci_release_resource()
From: Ilpo Järvinen
Date: Fri Dec 04 2026 - 19:43:07 EST
pci_release_resource() updates the resource after removing it from the
resource tree. Releasing PCI resources in other ways needs the same
update.
Split the update into pci_resource_post_release().
No functional changes.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
---
drivers/pci/setup-res.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 1317d645a178..a56e0cc3db58 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -463,6 +463,19 @@ int pci_reassign_resource(struct pci_dev *dev, int resno,
return 0;
}
+/* Update @resno of @dev after it has been removed from the resource tree */
+static void pci_resource_post_release(struct pci_dev *dev, int resno)
+{
+ struct resource *res = pci_resource_n(dev, resno);
+ const char *res_name = pci_resource_name(dev, resno);
+
+ pci_info(dev, "%s %pR: released\n", res_name, res);
+
+ res->end = resource_size(res) - 1;
+ res->start = 0;
+ res->flags |= IORESOURCE_UNSET;
+}
+
int pci_release_resource(struct pci_dev *dev, int resno)
{
struct resource *res = pci_resource_n(dev, resno);
@@ -479,11 +492,7 @@ int pci_release_resource(struct pci_dev *dev, int resno)
return ret;
}
- pci_info(dev, "%s %pR: released\n", res_name, res);
-
- res->end = resource_size(res) - 1;
- res->start = 0;
- res->flags |= IORESOURCE_UNSET;
+ pci_resource_post_release(dev, resno);
return 0;
}
--
2.47.3