Re: [PATCH 2/2] w1/ds2490: remove dump from ds_recv_status & less verbose

From: Greg KH
Date: Fri Mar 18 2022 - 09:07:08 EST


On Fri, Mar 11, 2022 at 08:28:33PM +0100, Christian Vogel wrote:
> The ds_recv_status function has a "dump" parameter that is used only
> once, and mixes in extremely verbose debugging to the kernel log with
> fetching the status registers.
>
> Removing the logging from ds_recv_status(), making logging explitic at
> the one place where it was used. Also decoding of the status register
> is turned off by default, and a module parameter added to re-enable.
>
> Signed-off-by: Christian Vogel <vogelchr@xxxxxxxx>
> ---
> Documentation/w1/masters/ds2490.rst | 7 +++++++
> drivers/w1/masters/ds2490.c | 28 +++++++++++++++++++---------
> 2 files changed, 26 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/w1/masters/ds2490.rst b/Documentation/w1/masters/ds2490.rst
> index 7e5b50f9c0f5..8aa455627aad 100644
> --- a/Documentation/w1/masters/ds2490.rst
> +++ b/Documentation/w1/masters/ds2490.rst
> @@ -70,3 +70,10 @@ Notes and limitations.
> or the host OS and more likely the host OS.
>
> 03-06-2008 David Fries <David@xxxxxxxxx>
> +
> +Kernel Parameter
> +----------------
> +
> +A kernel parameter verbose_dump=1 can be added to make the module
> +decode the status register on errors in a very verbose way. By default
> +this verbose decode is turned off.
> diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
> index f6664fc9596a..354a35726967 100644
> --- a/drivers/w1/masters/ds2490.c
> +++ b/drivers/w1/masters/ds2490.c
> @@ -120,6 +120,10 @@
> #define EP_DATA_OUT 2
> #define EP_DATA_IN 3
>
> +static int verbose_dump;
> +module_param(verbose_dump, int, 0644);
> +MODULE_PARM_DESC(verbose_dump, "Generate a very verbose dump of the status registers on errors.");
> +
> struct ds_device {
> struct list_head ds_entry;
>
> @@ -222,6 +226,9 @@ static void ds_dump_status(struct ds_device *dev, unsigned char *buf, int count)
> dev_info(&dev->udev->dev, "ep_status=0x%x, count=%d, status=%*phC",
> dev->ep[EP_STATUS], count, count, buf);
>
> + if (!verbose_dump)
> + return;
> +

Please just turn all of these dev_info() lines into dev_dbg() and then
the kernel-wide dynamic debugging logic will be used instead of a custom
module parameter.

thanks,

greg k-h