From: Joe Perches <joe@perches.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.de>
Subject: Re: [PATCH v2 1/1] PCI: Introduce pci_bus_*() printing macros when device is not available
Date: Thu, 09 Dec 2021 10:40:57 -0800 [thread overview]
Message-ID: <411886e9e89f797d3f9513245f94b2a5f4a33e7d.camel@perches.com> (raw)
In-Reply-To: <20211209182711.28709-1-andriy.shevchenko@linux.intel.com>
On Thu, 2021-12-09 at 20:27 +0200, Andy Shevchenko wrote:
> In some cases PCI device structure is not available and we want to print
> information based on the bus and devfn parameters. For this cases introduce
> pci_bus_*() printing macros and replace in existing users.
[]
> diff --git a/include/linux/pci.h b/include/linux/pci.h
[]
> @@ -2482,4 +2482,12 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type);
> WARN_ONCE(condition, "%s %s: " fmt, \
> dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)
>
> +#define pci_bus_printk(level, bus, devfn, fmt, arg...) \
> + printk(level "pci %04x:%02x:%02x.%d: " fmt, \
> + pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), ##arg)
I have a small preference for using ... and __VA_ARGS___
#define pci_bus_printk(level, bus, devfn, fmt, ...) \
printk(level "pci %04x:%02x:%02x.%d: " fmt, \
pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), ##__VA_ARGS__)
and likely this should have parentheses around bus
printk(level "pci %04x:%02x:%02x.%d: " fmt, \
pci_domain_nr(bus), (bus)->number, PCI_SLOT(devfn), PCI_FUNC(devfn), ##__VA_ARGS__)
> +#define pci_bus_err(bus, devfn, fmt, arg...) pci_bus_printk(KERN_ERR, bus, devfn, fmt, ##arg)
> +#define pci_bus_warn(bus, devfn, fmt, arg...) pci_bus_printk(KERN_WARNING, bus, devfn, fmt, ##arg)
> +#define pci_bus_info(bus, devfn, fmt, arg...) pci_bus_printk(KERN_INFO, bus, devfn, fmt, ##arg)
__VA_ARGS__ etc...
next prev parent reply other threads:[~2021-12-09 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 18:27 Andy Shevchenko
2021-12-09 18:40 ` Joe Perches [this message]
2021-12-09 19:33 ` Andy Shevchenko
2021-12-09 19:55 ` Joe Perches
2021-12-09 20:00 ` Krzysztof Wilczyński
2021-12-09 20:13 ` Andy Shevchenko
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=411886e9e89f797d3f9513245f94b2a5f4a33e7d.camel@perches.com \
--to=joe@perches.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®