All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Joe Perches <joe@perches.com>,
	sam@ravnborg.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
	daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 0/4] drm: core: Convert logging to drm_* functions.
Date: Mon, 13 Jul 2020 00:24:16 +0530	[thread overview]
Message-ID: <20200712185416.GC12262@blackclown> (raw)
In-Reply-To: <04ce5199522b4136909fa4926282b7da8abddc4a.camel@perches.com>


[-- Attachment #1.1: Type: text/plain, Size: 3239 bytes --]

On Sat, Jul 11, 2020 at 11:16:33AM -0700, Joe Perches wrote:
> On Sat, 2020-07-11 at 20:41 +0530, Suraj Upadhyay wrote:
> > On Fri, Jul 10, 2020 at 07:56:43PM +0200, Sam Ravnborg wrote:
> > > Hi Suraj.
> > > 
> > > On Tue, Jul 07, 2020 at 10:04:14PM +0530, Suraj Upadhyay wrote:
> > > > This patchset converts logging to drm_* functions in drm core.
> > > > 
> > > > The following functions have been converted to their respective
> > > > DRM alternatives :
> > > > dev_info()      --> drm_info()
> > > > dev_err()       --> drm_err()
> > > > dev_warn()      --> drm_warn()
> > > > dev_err_once()  --> drm_err_once().
> > > 
> > > I would prefer that DRM_* logging in the same files are converted in the
> > > same patch. So we have one logging conversion patch for each file you
> > > touches and that we do not need to re-vist the files later to change
> > > another set of logging functions.
> > 
> > Agreed.
> > 
> > > If possible WARN_* should also be converted to drm_WARN_*
> > > If patch is too large, then split them up but again lets have all
> > > logging updated when we touch a file.
> > > 
> > > Care to take a look at this approach?
> > > 
> > 
> > Hii,
> > 	The problem with WARN_* macros is that they are used without any
> > drm device context. For example [this use here](https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_edid.c#n1667) in drm_edid.c,
> > doesn't have a drm device context and only has one argument (namely !raw_edid).
> > There are many more such use cases.
> > 
> > And also there were cases where dev_* logging functions didn't have any
> > drm_device context.
> 
> Perhaps change the __drm_printk macro to not
> dereference the drm argument when NULL.
> 
> A trivial but perhaps inefficient way might be
> used like:
> 
> 	drm_<level>(NULL, fmt, ...)
> 
> ---
>  include/drm/drm_print.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 1c9417430d08..9323a8f46b3c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -395,8 +395,8 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>  
>  /* Helper for struct drm_device based logging. */
>  #define __drm_printk(drm, level, type, fmt, ...)			\
> -	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> -
> +	dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt,	\
> +			  ##__VA_ARGS__)
>  
>  #define drm_info(drm, fmt, ...)					\
>  	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
> 

Hi Joe,
	Thanks for your input.
But I don't think that this change would be a good idea as we are
supposed to find or make a substitute of WARN_* macros which
take a `condition` as an argument and check for its truth.
And I guess passing a NULL to dev_<level> would cause a format warning.

Also, the WARN_* macros are doing their job fine, and passing a NULL
value everytime you want to warn about a certain condition at a
particular line, doesn't seem good to me.

Thus, I think that WARN_* macros should be untouched.

I would like to hear what the MAINTAINERS think.

Thanks and Cheers,

Suraj Upadhyay.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Joe Perches <joe@perches.com>,
	sam@ravnborg.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
	daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 0/4] drm: core: Convert logging to drm_* functions.
Date: Mon, 13 Jul 2020 00:24:16 +0530	[thread overview]
Message-ID: <20200712185416.GC12262@blackclown> (raw)
In-Reply-To: <04ce5199522b4136909fa4926282b7da8abddc4a.camel@perches.com>

[-- Attachment #1: Type: text/plain, Size: 3239 bytes --]

On Sat, Jul 11, 2020 at 11:16:33AM -0700, Joe Perches wrote:
> On Sat, 2020-07-11 at 20:41 +0530, Suraj Upadhyay wrote:
> > On Fri, Jul 10, 2020 at 07:56:43PM +0200, Sam Ravnborg wrote:
> > > Hi Suraj.
> > > 
> > > On Tue, Jul 07, 2020 at 10:04:14PM +0530, Suraj Upadhyay wrote:
> > > > This patchset converts logging to drm_* functions in drm core.
> > > > 
> > > > The following functions have been converted to their respective
> > > > DRM alternatives :
> > > > dev_info()      --> drm_info()
> > > > dev_err()       --> drm_err()
> > > > dev_warn()      --> drm_warn()
> > > > dev_err_once()  --> drm_err_once().
> > > 
> > > I would prefer that DRM_* logging in the same files are converted in the
> > > same patch. So we have one logging conversion patch for each file you
> > > touches and that we do not need to re-vist the files later to change
> > > another set of logging functions.
> > 
> > Agreed.
> > 
> > > If possible WARN_* should also be converted to drm_WARN_*
> > > If patch is too large, then split them up but again lets have all
> > > logging updated when we touch a file.
> > > 
> > > Care to take a look at this approach?
> > > 
> > 
> > Hii,
> > 	The problem with WARN_* macros is that they are used without any
> > drm device context. For example [this use here](https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_edid.c#n1667) in drm_edid.c,
> > doesn't have a drm device context and only has one argument (namely !raw_edid).
> > There are many more such use cases.
> > 
> > And also there were cases where dev_* logging functions didn't have any
> > drm_device context.
> 
> Perhaps change the __drm_printk macro to not
> dereference the drm argument when NULL.
> 
> A trivial but perhaps inefficient way might be
> used like:
> 
> 	drm_<level>(NULL, fmt, ...)
> 
> ---
>  include/drm/drm_print.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 1c9417430d08..9323a8f46b3c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -395,8 +395,8 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>  
>  /* Helper for struct drm_device based logging. */
>  #define __drm_printk(drm, level, type, fmt, ...)			\
> -	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> -
> +	dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt,	\
> +			  ##__VA_ARGS__)
>  
>  #define drm_info(drm, fmt, ...)					\
>  	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
> 

Hi Joe,
	Thanks for your input.
But I don't think that this change would be a good idea as we are
supposed to find or make a substitute of WARN_* macros which
take a `condition` as an argument and check for its truth.
And I guess passing a NULL to dev_<level> would cause a format warning.

Also, the WARN_* macros are doing their job fine, and passing a NULL
value everytime you want to warn about a certain condition at a
particular line, doesn't seem good to me.

Thus, I think that WARN_* macros should be untouched.

I would like to hear what the MAINTAINERS think.

Thanks and Cheers,

Suraj Upadhyay.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-07-14  7:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 16:34 [PATCH 0/4] drm: core: Convert logging to drm_* functions Suraj Upadhyay
2020-07-07 16:34 ` Suraj Upadhyay
2020-07-07 16:28 ` [PATCH 1/4] drm: mipi-dsi: " Suraj Upadhyay
2020-07-07 16:35   ` Suraj Upadhyay
2020-07-07 16:35   ` Suraj Upadhyay
2020-07-07 16:28   ` Suraj Upadhyay
2020-07-10 18:01   ` Sam Ravnborg
2020-07-10 18:01     ` Sam Ravnborg
2020-07-07 16:36 ` [PATCH 2/4] drm: mipi-dbi: " Suraj Upadhyay
2020-07-07 16:36   ` Suraj Upadhyay
2020-07-07 16:36 ` [PATCH 3/4] drm: edid: " Suraj Upadhyay
2020-07-07 16:36   ` Suraj Upadhyay
2020-07-08  6:10   ` Thomas Zimmermann
2020-07-08  6:10     ` Thomas Zimmermann
2020-07-07 16:37 ` [PATCH 4/4] drm: fb-helper: " Suraj Upadhyay
2020-07-07 16:37   ` Suraj Upadhyay
2020-07-08  6:10   ` Thomas Zimmermann
2020-07-08  6:10     ` Thomas Zimmermann
2020-07-10 18:02   ` Sam Ravnborg
2020-07-10 18:02     ` Sam Ravnborg
2020-07-10 17:56 ` [PATCH 0/4] drm: core: " Sam Ravnborg
2020-07-10 17:56   ` Sam Ravnborg
2020-07-11 15:11   ` Suraj Upadhyay
2020-07-11 15:11     ` Suraj Upadhyay
2020-07-11 18:16     ` Joe Perches
2020-07-11 18:16       ` Joe Perches
2020-07-12 18:54       ` Suraj Upadhyay [this message]
2020-07-12 18:54         ` Suraj Upadhyay
2020-07-12 19:07         ` Joe Perches
2020-07-12 19:07           ` Joe Perches
2020-07-13 13:58           ` Suraj Upadhyay
2020-07-13 13:58             ` Suraj Upadhyay
2020-07-16 20:19     ` Sam Ravnborg
2020-07-16 20:19       ` Sam Ravnborg

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=20200712185416.GC12262@blackclown \
    --to=usuraj35@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /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.