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

From: Joe Perches
Date: Wed Aug 12 2020 - 12:10:37 EST


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