From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Siddh Raman Pant <code@siddh.me>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>, Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Suraj Upadhyay <usuraj35@gmail.com>
Subject: Re: [PATCH v9 2/8] drm/print: Fix and add support for NULL as first argument in drm_* macros
Date: Tue, 6 Jun 2023 17:47:32 +0300 [thread overview]
Message-ID: <20230606144732.GG5197@pendragon.ideasonboard.com> (raw)
In-Reply-To: <18891219d8e.6a7d8f15119986.32609419593331086@siddh.me>
On Tue, Jun 06, 2023 at 08:04:39PM +0530, Siddh Raman Pant wrote:
> On Tue, 06 Jun 2023 19:35:12 +0530, Laurent Pinchart wrote:
> > Hi Siddh,
> >
> > Thank you for the patch.
>
> Anytime :)
>
> > On Tue, Jun 06, 2023 at 04:15:16PM +0530, Siddh Raman Pant wrote:
> > > Comments say macros DRM_DEBUG_* are deprecated in favor of
> > > drm_dbg_*(NULL, ...), but they have broken support for it,
> > > as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
> >
> > What's the problem there ?
>
> (NULL)->dev is invalid C. It's a macro, so preprocessor substitutes
> that text directly, there is no evaluation. GCC will throw an error
> regarding dereferencing a void* pointer.
>
> > > /* Helper for struct drm_device based logging. */
> > > #define __drm_printk(drm, level, type, fmt, ...) \
> > > - dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> > > +({ \
> > > + struct device *__dev_ = __drm_dev_ptr(drm); \
> > > + if (__dev_) \
> > > + dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__); \
> > > + else \
> > > + pr_##level##type("[drm] " fmt, ##__VA_ARGS__); \
> >
> > If I recall correctly, dev_*() handle a NULL dev pointer just fine. Do
> > we need to manually fall back to pr_*() ?
>
> I took drm_dev_printk (on line 261 of drm_print.c) as the reference,
> wherein it uses a conditional for determining whether dev_printk or
> printk should be called.
>
> I suppose it is to avoid printing "(NULL device *)", which dev_printk
> does if it gets a NULL device pointer (refer the definition on line
> 4831 of drivers/base/core.c). Though if I'm wrong, kindly let me know.
You're right, it's probably best to avoid the "(NULL device *)".
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-06-06 14:49 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 10:45 [PATCH v9 0/8] drm: Remove usage of deprecated DRM_* macros Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 1/8] Revert "drm: mipi-dsi: Convert logging to drm_* functions." Siddh Raman Pant
2023-06-06 12:55 ` Laurent Pinchart
2023-06-06 13:07 ` Jani Nikula
2023-06-06 13:21 ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 2/8] drm/print: Fix and add support for NULL as first argument in drm_* macros Siddh Raman Pant
2023-06-06 14:05 ` Laurent Pinchart
2023-06-06 14:34 ` Siddh Raman Pant
2023-06-06 14:47 ` Laurent Pinchart [this message]
2023-06-06 10:45 ` [PATCH v9 3/8] drm: Remove usage of deprecated DRM_INFO Siddh Raman Pant
2023-06-06 14:23 ` Laurent Pinchart
2023-06-06 14:38 ` Siddh Raman Pant
2023-06-06 14:46 ` Laurent Pinchart
2023-06-06 16:39 ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 4/8] drm: Remove usage of deprecated DRM_NOTE Siddh Raman Pant
2023-06-06 14:39 ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 5/8] drm: Remove usage of deprecated DRM_ERROR Siddh Raman Pant
2023-06-06 14:44 ` Laurent Pinchart
2023-06-06 17:06 ` Siddh Raman Pant
2023-06-06 17:13 ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 6/8] drm: Remove usage of deprecated DRM_DEBUG Siddh Raman Pant
2023-06-06 14:57 ` Laurent Pinchart
2023-06-06 17:14 ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 7/8] drm: Remove usage of deprecated DRM_DEBUG_DRIVER Siddh Raman Pant
2023-06-06 14:38 ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 8/8] drm: Remove usage of deprecated DRM_DEBUG_KMS Siddh Raman Pant
2023-06-06 15:04 ` Laurent Pinchart
2023-06-06 17:17 ` Siddh Raman Pant
2023-06-06 21:39 ` Jani Nikula
2023-06-07 3:53 ` Laurent Pinchart
2023-06-07 8:12 ` Jani Nikula
2023-06-06 11:30 ` [PATCH v9 0/8] drm: Remove usage of deprecated DRM_* macros Jani Nikula
2023-06-06 15:05 ` Laurent Pinchart
2023-06-06 17:29 ` Siddh Raman Pant
2023-06-06 17:49 ` Laurent Pinchart
2023-06-06 18:17 ` Siddh Raman Pant
2023-06-07 4:30 ` Laurent Pinchart
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=20230606144732.GG5197@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=code@siddh.me \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.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
all inboxes | Powered by JetHome®