All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: fred@fredlawl.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com,
	andriy.shevchenko@linux.intel.com, keith.busch@intel.com,
	mr.nuke.me@gmail.com, liudongdong3@huawei.com,
	thesven73@gmail.com
Subject: Re: [PATCH 2/4] PCI: pciehp: Replace ctrl_*() with pci_*()
Date: Sun, 28 Apr 2019 19:36:18 -0500	[thread overview]
Message-ID: <20190429003618.GN14616@google.com> (raw)
In-Reply-To: <20190427200301.tujp2535jxmlqttr@wunner.de>

On Sat, Apr 27, 2019 at 10:03:01PM +0200, Lukas Wunner wrote:
> 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).

I was hoping to get rid of the ctrl_*() wrappers completely, but the
"Slot(%s)" prefix is actually a pretty good reason to keep them.

Moving the prefix from the call site to the ctrl_*() wrappers should be a
separate patch that doesn't change the output at all (except maybe
adding the prefix to messages that don't currently include it).

So you probably need three steps (each in a separate patch):

  1) Convert ctrl_*() to use pci_dev instead of pcie_device, something
     like this:

        + #define pr_fmt(fmt) "pciehp: " fmt
	+ #define dev_fmt pr_fmt

	  #define ctrl_info(ctrl, format, arg...) \
	-   dev_info(&ctrl->pcie->device, format, ## arg)
	+   pci_info(&ctrl->pcie->port, format, ## arg)

  2) Convert any output before pci_hp_initialize() from ctrl_*() to
     pci_*().

  3) Centralize the "Slot(%s): " prefix, something like this:

	  #define ctrl_info(ctrl, format, arg...) \
	-   pci_info(&ctrl->pcie->port, format, ## arg)
	+   pci_info(&ctrl->pcie->port, "Slot(%s): " format, slot_name(ctrl), ## arg)

	- ctrl_info(ctrl, "Slot(%s): ...", slot_name(ctrl));
	+ ctrl_info(ctrl, "...");


  reply	other threads:[~2019-04-29  0:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27 19:13 [PATCH 0/4] PCI: Use PCIe service name in dmesg logs fred
2019-04-27 19:13 ` [PATCH 1/4] PCI: Replace dev_*() printk wrappers with pci_*() printk wrappers fred
2019-04-28 15:43   ` Andy Shevchenko
2019-04-30 22:25     ` Frederick Lawler
2019-04-29  0:02   ` Bjorn Helgaas
2019-04-29  0:52     ` Bjorn Helgaas
2019-04-30 22:26       ` Frederick Lawler
2019-04-27 19:13 ` [PATCH 2/4] PCI: pciehp: Replace ctrl_*() with pci_*() fred
2019-04-27 20:03   ` Lukas Wunner
2019-04-29  0:36     ` Bjorn Helgaas [this message]
2019-04-27 19:13 ` [PATCH 3/4] PCI: pciehp: Remove unused macro definitions fred
2019-04-28 15:55   ` Andy Shevchenko
2019-04-29  0:13     ` Bjorn Helgaas
2019-04-27 19:13 ` [PATCH 4/4] PCI/portdrv: Add dev_fmt() to port drivers fred
2019-04-29  0:17   ` Bjorn Helgaas

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=20190429003618.GN14616@google.com \
    --to=helgaas@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=fred@fredlawl.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liudongdong3@huawei.com \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mr.nuke.me@gmail.com \
    --cc=thesven73@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.