From: Joe Perches <joe@perches.com>
To: Suraj Upadhyay <usuraj35@gmail.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: Sun, 12 Jul 2020 12:07:45 -0700 [thread overview]
Message-ID: <bc58f9b3f11c5da224187fac0eba33f769d0fb45.camel@perches.com> (raw)
In-Reply-To: <20200712185416.GC12262@blackclown>
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()
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-07-12 19:07 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 [this message]
2020-07-13 13:58 ` Suraj Upadhyay
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=bc58f9b3f11c5da224187fac0eba33f769d0fb45.camel@perches.com \
--to=joe@perches.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
--cc=usuraj35@gmail.com \
/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).