netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Re: [PATCH net-next v2 6/9] net: phy: add backplane kr driver support
@ 2020-04-24 14:39 Florinel Iordache
  2020-04-24 14:56 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Florinel Iordache @ 2020-04-24 14:39 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem@davemloft.net, netdev@vger.kernel.org, f.fainelli@gmail.com,
	hkallweit1@gmail.com, linux@armlinux.org.uk,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	robh+dt@kernel.org, mark.rutland@arm.com, kuba@kernel.org,
	corbet@lwn.net, shawnguo@kernel.org, Leo Li, Madalin Bucur (OSS),
	Ioana Ciornei, linux-kernel@vger.kernel.org, Florinel Iordache

> > +/* Backplane custom logging */
> > +#define bpdev_fn(fn)                                                 \
> > +void bpdev_##fn(struct phy_device *phydev, char *fmt, ...)           \
> > +{                                                                    \
> > +     struct va_format vaf = {                                        \
> > +             .fmt = fmt,                                             \
> > +     };                                                              \
> > +     va_list args;                                                   \
> > +     va_start(args, fmt);                                            \
> > +     vaf.va = &args;                                                 \
> > +     if (!phydev->attached_dev)                                      \
> > +             dev_##fn(&phydev->mdio.dev, "%pV", &vaf);               \
> > +     else                                                            \
> > +             dev_##fn(&phydev->mdio.dev, "%s: %pV",                  \
> > +                     netdev_name(phydev->attached_dev), &vaf);       \
> > +     va_end(args);                                                   \
> > +}
> > +
> > +bpdev_fn(err)
> > +EXPORT_SYMBOL(bpdev_err);
> > +
> > +bpdev_fn(warn)
> > +EXPORT_SYMBOL(bpdev_warn);
> > +
> > +bpdev_fn(info)
> > +EXPORT_SYMBOL(bpdev_info);
> > +
> > +bpdev_fn(dbg)
> > +EXPORT_SYMBOL(bpdev_dbg);
> 
> Didn't i say something about just using phydev_{err|warn|info|dbg}?
> 
>        Andrew

Hi Andrew,

I used this custom logging in order to be able to add any kind of useful information we might need to all prints (err/warn/info/dbg).
For example all these bpdev_ functions are equivalent with phydev_ but only in the case when there is no attached device: phydev->attached_dev == NULL.
Otherwise, if there is a device attached, then we also want to add its name to all these prints in order to know to which device the information refers to.
For example in this case the print looks like this:
[   50.853515] backplane_qoriq 8c13000:00: eth1: 10gbase-kr link trained, Tx equalization: C(-1)=0x0, C(0)=0x29, C(+1)=0x5
This is very useful because we can see very easy to which interface the information printed is related to: in this case the link was trained for interface: eth1
This information (the name of attached device: eth1) is not printed by phydev_ functions.
I'm sorry I have not explained all this earlier, the first time when you asked about it. 

Florin.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-24 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-24 14:39 Re: [PATCH net-next v2 6/9] net: phy: add backplane kr driver support Florinel Iordache
2020-04-24 14:56 ` Andrew Lunn
2020-04-24 15:08   ` [EXT] " Florinel Iordache
2020-04-24 15:11     ` Andrew Lunn

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).