Re: [PATCH 35/44] staging: regulator: hi6421v600-regulator: add a driver-specific debug macro

From: Joe Perches
Date: Thu Aug 13 2020 - 11:07:37 EST


On Thu, 2020-08-13 at 12:10 +0200, Mauro Carvalho Chehab wrote:
> Em Wed, 12 Aug 2020 09:10:29 -0700
> Joe Perches <joe@xxxxxxxxxxx> escreveu:
>
> > On Wed, 2020-08-12 at 17:56 +0200, Mauro Carvalho Chehab wrote:
> > > Using dev_dbg() is not too nice, as, instead of printing the
> > > name of the regulator, it prints "regulator.<number>", making
> > > harder to associate what is happening with each ldo line.
> > >
> > > So, add a debug-specific macro, which will print the rdev's
> > > name, just like the regulator core.
> >
> > Seems sensible, but trivially:
> >
> > > diff --git a/drivers/staging/hikey9xx/hi6421v600-regulator.c b/drivers/staging/hikey9xx/hi6421v600-regulator.c
> > []
> > > @@ -209,10 +212,10 @@ static unsigned int hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev
> > > struct hi6421v600_regulator *sreg = rdev_get_drvdata(rdev);
> > >
> > > if (load_uA || ((unsigned int)load_uA > sreg->eco_uA)) {
> > > - dev_dbg(&rdev->dev, "%s: normal mode", __func__);
> > > + rdev_dbg(rdev, "normal mode");
> > > return REGULATOR_MODE_NORMAL;
> > > } else {
> > > - dev_dbg(&rdev->dev, "%s: idle mode", __func__);
> > > + rdev_dbg(rdev, "idle mode");
> >
> > missing terminating newlines
>
> As per request from Jonathan, I ended dropping those rdev_dbg()
> on a followup patch.
>
> Btw, after this changeset:
>
> commit 563873318d328d9bbab4b00dfd835ac7c7e28697
> Merge: 24532f768121 bfd8d3f23b51
> Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Date: Mon Oct 10 09:29:50 2016 -0700
>
> Merge branch 'printk-cleanups'
>
> Merge my system logging cleanups, triggered by the broken '\n' patches.
>
> the printk lib will add a line feed if a "\n" is missing. I had
> to get rid of pr_cont() & friends on that time on media, due to that.

I know.

Message formats should still end in a newline.

Any other subsystem could use a pr_cont and that
could be added to any line without a terminating
newline.

Also any line without a newline will not be emitted
until another message is emitted.