Re: [PATCH] vfio: Use dev_printk() when possible
From: Alex Williamson
Date: Fri Mar 29 2019 - 16:32:42 EST
On Fri, 29 Mar 2019 12:03:11 -0500
Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:
> On Mon, Mar 25, 2019 at 3:49 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> >
> > On Mon, 2019-03-25 at 14:42 -0500, Bjorn Helgaas wrote:
> > > Use dev_printk() when possible to make messages consistent with other
> > > device-related messages.
> >
> > trivial note:
> >
> > > diff --git a/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c b/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c
> > []
> > > @@ -89,7 +89,8 @@ static int vfio_platform_amdxgbe_reset(struct vfio_platform_device *vdev)
> > > } while ((pcs_value & MDIO_CTRL1_RESET) && --count);
> > >
> > > if (pcs_value & MDIO_CTRL1_RESET)
> > > - pr_warn("%s XGBE PHY reset timeout\n", __func__);
> > > + dev_warn(&vdev->device, "%s XGBE PHY reset timeout\n",
> > > + __func__);
> >
> > Many of these could use a colon after the %s used with __func__
> > to make the output more consistent with other modules.
>
> Thanks, Joe. I added a colon to the two in
> vfio_platform_amdxgbe_reset(). Those were the only ones I saw, except
> for a couple "%s failed" messages in
> drivers/vfio/vfio_iommu_spapr_tce.c, which I didn't change because (1)
> they can't use dev_err() so slightly out of scope for this patch, and
> (2) it arguably reads more naturally without the colon.
>
> In vfio_pci.c, I converted some pr_info() to dev_info() without adding
> a dev_fmt definition, so that removed the KBUILD_MODNAME prefix, which
> I didn't intend. I'll add "#define dev_fmt pr_fmt" to restore the
> prefix.
>
> Messages from drivers/vfio use a variety of prefixes (none, "VFIO: ",
> KBUILD_MODNAME, __func__). That could potentially be rationalized but
> I would want Alex's guidance first.
Hmm, sort of hard to generalize. I suspect "VFIO:" is not super
useful, the module name is probably a better choice, augmented by
__func__ where it adds useful context. That's probably the approach
I'd take. Thanks,
Alex