linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Joe Perches <joe@perches.com>,
	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 19:28:08 +0530	[thread overview]
Message-ID: <20200713135808.GA6783@blackclown> (raw)
In-Reply-To: <bc58f9b3f11c5da224187fac0eba33f769d0fb45.camel@perches.com>

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

On Sun, Jul 12, 2020 at 12:07:45PM -0700, Joe Perches wrote:
> On Mon, 2020-07-13 at 00:24 +0530, Suraj Upadhyay wrote:
> > On Sat, Jul 11, 2020 at 11:16:33AM -0700, Joe Perches wrote:
> []
> > > 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, ...)
> []
> > > diff --git 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.
> 
> So do I but the suggestion was not about WARN macros
> only about drm_<level> macros and possibly unnecessary
> conversions to dev_<level> when a drm_device context
> is unavailable.
> 
> Also, you don't have to guess, the code is there for
> you to inspect.
> 
> dev_<level> when a NULL is used as the first argument
> emits "(NULL device *)" instead of dev_driver_string(dev)
> and dev_name(dev).
> 
> See: drivers/base/core.c::__dev_printk()

Yes, Thanks my bad.
But the dev_<level> usages in drm/* always have a context and doesn't need
NULL to be passed, i.e. some of them have only a `struct device` context which
cannot be simply converted into drm_<level> since they take a struct
pointer with a `dev` member and not a `dev` itself.
What we can convert is calls to dev_<level> with a drm_device context or
with a struct pointer which has a dev member.

And, I really want the MAINTAINERS to look into it.

Thanks and Cheers,

Suraj Upadhyay.


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

  reply	other threads:[~2020-07-13 13:58 UTC|newest]

Thread overview: 17+ 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:28 ` [PATCH 1/4] drm: mipi-dsi: " Suraj Upadhyay
2020-07-07 16:35   ` Suraj Upadhyay
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 ` [PATCH 3/4] drm: edid: " Suraj Upadhyay
2020-07-08  6:10   ` Thomas Zimmermann
2020-07-07 16:37 ` [PATCH 4/4] drm: fb-helper: " Suraj Upadhyay
2020-07-08  6:10   ` Thomas Zimmermann
2020-07-10 18:02   ` Sam Ravnborg
2020-07-10 17:56 ` [PATCH 0/4] drm: core: " Sam Ravnborg
2020-07-11 15:11   ` Suraj Upadhyay
2020-07-11 18:16     ` Joe Perches
2020-07-12 18:54       ` Suraj Upadhyay
2020-07-12 19:07         ` Joe Perches
2020-07-13 13:58           ` Suraj Upadhyay [this message]
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=20200713135808.GA6783@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).