From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ian Cowan <ian@linux.cowan.aero>
Cc: clabbe@baylibre.com, mchehab@kernel.org,
gregkh@linuxfoundation.org, mjpeg-users@lists.sourceforge.net,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH] media: staging: zoran: refactor printk debugging function
Date: Thu, 21 Apr 2022 17:21:54 +0300 [thread overview]
Message-ID: <20220421142153.GA2462@kadam> (raw)
In-Reply-To: <20220421002316.873109-1-ian@linux.cowan.aero>
On Wed, Apr 20, 2022 at 08:23:16PM -0400, Ian Cowan wrote:
> This is a patch to refactor the zoran debugging function. This function
> existed in all of the changed files and they also all import the
> videocodec header file. This patch moves the dprintk function into the
> videocodec header file and out of each of the individual files.
>
> Signed-off-by: Ian Cowan <ian@linux.cowan.aero>
> ---
> drivers/staging/media/zoran/videocodec.c | 67 +++++++++++++--------
> drivers/staging/media/zoran/videocodec.h | 7 +++
> drivers/staging/media/zoran/zr36016.c | 48 ++++++++-------
> drivers/staging/media/zoran/zr36050.c | 77 ++++++++++++------------
> drivers/staging/media/zoran/zr36060.c | 54 ++++++++---------
> 5 files changed, 141 insertions(+), 112 deletions(-)
>
> diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
> index 3af7d02bd910..e35d1f54d9b8 100644
> --- a/drivers/staging/media/zoran/videocodec.c
> +++ b/drivers/staging/media/zoran/videocodec.c
> @@ -20,12 +20,6 @@ static int videocodec_debug;
> module_param(videocodec_debug, int, 0);
> MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)");
>
> -#define dprintk(num, format, args...) \
> - do { \
> - if (videocodec_debug >= num) \
> - printk(format, ##args); \
> - } while (0)
> -
> struct attached_list {
> struct videocodec *codec;
> struct attached_list *next;
> @@ -56,8 +50,8 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
> return NULL;
> }
>
> - dprintk(2, "%s: '%s', flags %lx, magic %lx\n", __func__,
> - master->name, master->flags, master->magic);
> + dprintk(videocodec_debug, 2, "%s: '%s', flags %lx, magic %lx\n",
> + __func__, master->name, master->flags, master->magic);
[ snip ]
> +/* Print debug information based on the specified level of debugging */
> +#define dprintk(debug, num, format, args...) \
> +do { \
> + if (debug > num) \
> + printk(format, ##args); \
> +} while (0)
> +
I don't like the new format. It needs to have a KERN_DEBUG at the
start. Passing the param_module is awkward. No one knows what the
magic "num" things are.
Using a module parameter is old school badness. The standard dev_dbg()
macros are better and more flexible. Just use them instead.
regards,
dan carpenter
next prev parent reply other threads:[~2022-04-21 14:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 0:23 [PATCH] media: staging: zoran: refactor printk debugging function Ian Cowan
2022-04-21 14:21 ` Dan Carpenter [this message]
2022-04-21 15:22 ` Ian Cowan
2022-04-21 15:52 ` Dan Carpenter
2022-04-21 18:13 ` Ian Cowan
2022-04-22 0:30 ` Ian Cowan
2022-04-22 5:10 ` Greg KH
2022-04-23 5:23 ` Ian Cowan
2022-04-23 5:51 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220421142153.GA2462@kadam \
--to=dan.carpenter@oracle.com \
--cc=clabbe@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=ian@linux.cowan.aero \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mjpeg-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.