Re: [PATCH 2/4] PCI: pciehp: Replace ctrl_*() with pci_*()

Lukas Wunner
2019-04-27T20:03:06Z

On Sat, Apr 27, 2019 at 02:13:02PM -0500, fred@fredlawl.com wrote:
> Hotplug useses custom ctrl_*() dev_*() printk wrappers for logging
> messages. To make hotplug conform to pci logging, replace uses of these
> wrappers with pci_*() printk wrappers. In addition, replace any
> printk() calls with pr_*() wrappers.

A lot of pciehp's messages are preceded by "Slot(%s): ", where %s is
replaced by the Physical Slot Number in the Slot Capabilities register
(which is cached in struct controller) plus an optional suffix if the
same PSN is used by multiple slots. For some reason (probably a
historic artefact), this prefix is included only in *some* of the
messages.

I think it would be useful to make the messages consistent by *always*
including the "Slot(%s): " prefix. However the prefix is unknown until
pci_hp_initialize() has been called. I'd solve this by keeping the
ctrl_*() wrappers and amending them to print the "Slot(%s): " prefix,
then making sure that ctrl_*() is not called before pci_hp_initialize().
(pci_*() has to be used instead).

> @@ -182,39 +184,39 @@ static int pciehp_probe(struct pcie_device *dev)
>
> if (!dev->port->subordinate) {
> /* Can happen if we run out of bus numbers during probe */
> - dev_err(&dev->device,
> - "Hotplug bridge without secondary bus, ignoring\n");
> + pci_err(dev->port, "Hotplug bridge without secondary bus, ignoring\n");

Hm, the string was likely deliberately put on a new line to avoid
exceeding 80 chars, so I'd keep it that way.

Thanks,

Lukas