Re: [PATCH] soundwire: stream: uniquify dev_err() logs

From: Vinod Koul
Date: Fri Mar 17 2023 - 09:37:29 EST


On 15-03-23, 09:38, Pierre-Louis Bossart wrote:
>
>
> On 3/15/23 05:09, Vinod Koul wrote:
> > On 09-03-23, 13:49, Bard Liao wrote:
> >> From: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> >>
> >> There are a couple of duplicate logs which makes harder than needed to
> >> follow the error flows. Add __func__ or make the log unique.
> >>
> >> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> >> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
> >> Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
> >> ---
> >> drivers/soundwire/stream.c | 18 ++++++++++--------
> >> 1 file changed, 10 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> >> index 2e39587ed1de..dd09855caac9 100644
> >> --- a/drivers/soundwire/stream.c
> >> +++ b/drivers/soundwire/stream.c
> >> @@ -1389,7 +1389,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
> >>
> >> ret = do_bank_switch(stream);
> >> if (ret < 0) {
> >> - dev_err(bus->dev, "Bank switch failed: %d\n", ret);
> >> + pr_err("%s: do_bank_switch failed: %d\n", __func__, ret);
> >
> > why make it pr_ and loose the dev name? There is a trick to emit
> > function for dev_err too using dynamic debug
>
> a stream can be cased on multiple managers/buses.
>
> It's incorrect to use bus->dev in this case, see all other error cases
> in stream.c, they all use pr_err already for the same reason. bus->dev
> is only valid when dealing with a single bus, typically in loops in that
> file.
>
> That said we could have split the two changes where dev_err() is changed
> as pr_err() for clarity.

Thanks, that would be better way

--
~Vinod