Skip to contentSkip to conversation

PCI: Improve printout in pdev_sort_resources()

PATCH Bjorn Helgaas 1 participant 1 message Oct 21, 2024 1 message not in the archive PCI

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Oops, I inadvertently removed the cc list when I sent the response below. Adding it back here.

Quoted 49 lines · Bjorn Helgaas

[+cc Jonathan]

Quoted 5 lines · Ilpo Järvinen

Use pci_resource_name() helper in pdev_sort_resources() to print resources in user-friendly format. Also replace the vague "bogus alignment" with a more precise explanation of the problem.

Applied with Philipp's reviewed-by to pci/resource for v6.13, thanks!

Happy to add yours, too, Jonathan, if you want. You basically said so, but I don't want to presume :)

Quoted 35 lines

---

v2:
- Place colon after %s %pR to be consistent with other printouts
- Replace vague "bogus alignment" with the exact cause

 drivers/pci/setup-bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/setup-bus.c +3 -2
index 23082bc0ca37..0fd286f79674 100644
@@ -134,6 +134,7 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
 	int i;
 
 	pci_dev_for_each_resource(dev, r, i) {
+		const char *r_name = pci_resource_name(dev, i);
 		struct pci_dev_resource *dev_res, *tmp;
 		resource_size_t r_align;
 		struct list_head *n;
@@ -146,8 +147,8 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
 
 		r_align = pci_resource_alignment(dev, r);
 		if (!r_align) {
-			pci_warn(dev, "BAR %d: %pR has bogus alignment\n",
-				 i, r);
+			pci_warn(dev, "%s %pR: alignment must not be zero\n",
+				 r_name, r);
 			continue;
 		}
 
Signature · 1 line
2.39.5