Re: [PATCH v7 03/15] drivers: thermal: tsens: Add __func__ identifier to debug statements

From: Doug Anderson
Date: Fri Nov 01 2019 - 18:54:12 EST


Hi,

On Thu, Oct 31, 2019 at 11:38 AM Amit Kucheria <amit.kucheria@xxxxxxxxxx> wrote:
>
> Printing the function name when enabling debugging makes logs easier to
> read.
>
> Signed-off-by: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
> Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> Reviewed-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> ---
> drivers/thermal/qcom/tsens-common.c | 8 ++++----
> drivers/thermal/qcom/tsens.c | 6 +++---
> 2 files changed, 7 insertions(+), 7 deletions(-)

Obviously my opinion doesn't trump maintainers ones, but I have always
heard that this is the wrong thing to do for "dev_xxx" debug
statements. Specifically:

* For "dev_xxx" statements, the device name is already printed which
is pretty good for getting you to the right driver.

* Once you're in the right driver, error messages should be unique
enough to find the right function.

If having __func__ in all messages was beneficial then the "dev_xxx"
macros would include it by default. They don't and such things just
uglify the logs and chew up log space. I suppose you could try
including a CONFIG option to add it to all "dev_xxx" functions and see
if it would be accepted? Then you can turn it on locally.

Using __func__ in cases where you don't happen to have a "struct
device" (and can't get one easily) makes some sense, but otherwise I
believe it should be kept out.

-Doug