From: Puranjay Mohan <puranjay12@gmail.com>
To: bhelgaas@google.com, linux-pci@vger.kernel.org
Cc: Puranjay Mohan <puranjay12@gmail.com>
Subject: [PATCH 2/2] PCI: Use resource names in PCI log messages
Date: Sat, 6 Nov 2021 16:56:06 +0530 [thread overview]
Message-ID: <20211106112606.192563-3-puranjay12@gmail.com> (raw)
In-Reply-To: <20211106112606.192563-1-puranjay12@gmail.com>
Use the pci_resource_name() to get the name of the resource and use it
while printing log messages.
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
---
drivers/pci/probe.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d9fc02a71baa..407854d17efa 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -181,6 +181,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
u64 l64, sz64, mask64;
u16 orig_cmd;
struct pci_bus_region region, inverted_region;
+ int idx = res - dev->resource;
+ const char *resource_name = pci_resource_name(dev, idx);
mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
@@ -255,8 +257,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
sz64 = pci_size(l64, sz64, mask64);
if (!sz64) {
- pci_info(dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n",
- pos);
+ pci_info(dev, FW_BUG "%s: invalid BAR (can't size)\n",
+ resource_name);
goto fail;
}
@@ -266,8 +268,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED;
res->start = 0;
res->end = 0;
- pci_err(dev, "reg 0x%x: can't handle BAR larger than 4GB (size %#010llx)\n",
- pos, (unsigned long long)sz64);
+ pci_err(dev, "%s: can't handle BAR larger than 4GB (size %#010llx)\n",
+ resource_name, (unsigned long long)sz64);
goto out;
}
@@ -276,8 +278,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
res->flags |= IORESOURCE_UNSET;
res->start = 0;
res->end = sz64 - 1;
- pci_info(dev, "reg 0x%x: can't handle BAR above 4GB (bus address %#010llx)\n",
- pos, (unsigned long long)l64);
+ pci_info(dev, "%s: can't handle BAR above 4GB (bus address %#010llx)\n",
+ resource_name, (unsigned long long)l64);
goto out;
}
}
@@ -303,8 +305,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
res->flags |= IORESOURCE_UNSET;
res->start = 0;
res->end = region.end - region.start;
- pci_info(dev, "reg 0x%x: initial BAR value %#010llx invalid\n",
- pos, (unsigned long long)region.start);
+ pci_info(dev, "%s: initial BAR value %#010llx invalid\n",
+ resource_name, (unsigned long long)region.start);
}
goto out;
@@ -314,7 +316,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
res->flags = 0;
out:
if (res->flags)
- pci_info(dev, "reg 0x%x: %pR\n", pos, res);
+ pci_info(dev, "%s: %pR\n", resource_name, res);
return (res->flags & IORESOURCE_MEM_64) ? 1 : 0;
}
--
2.30.1
prev parent reply other threads:[~2021-11-06 11:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 11:26 [PATCH 0/2] PCI: Update BAR #/window messages Puranjay Mohan
2021-11-06 11:26 ` [PATCH 1/2] PCI: Update BAR # and window messages Puranjay Mohan
2021-11-06 11:58 ` Lukas Wunner
2021-11-19 21:43 ` Bjorn Helgaas
2021-11-24 4:28 ` Lukas Wunner
2021-11-06 11:26 ` Puranjay Mohan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211106112606.192563-3-puranjay12@gmail.com \
--to=puranjay12@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).