All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Siddh Raman Pant <code@siddh.me>
Cc: thomas zimmermann <tzimmermann@suse.de>,
	sam ravnborg <sam@ravnborg.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v7 1/7] drm/print: Fix and add support for NULL as first argument in drm_* macros
Date: Mon, 27 Feb 2023 18:02:25 +0200	[thread overview]
Message-ID: <878rgj14ha.fsf@intel.com> (raw)
In-Reply-To: <18693900367.2ce71ba5548919.6872574648582795181@siddh.me>

On Mon, 27 Feb 2023, Siddh Raman Pant <code@siddh.me> wrote:
> On Mon, 27 Feb 2023 15:13:21 +0530, Jani Nikula wrote:
>> First of all, that's two distinct changes in one patch. The subject says
>> one thing, but it's really two.
>
> Sorry, my bad.
>
>> But the main question is, do we *really* want to let callers pass either
>> struct drm_device * or struct device *? It will be type safe with
>> generics, but if it's okay to use either, people *will* use either. The
>> call sites will end up being a mixture of both. You can't control it. It
>> will be very tedious if you ever want to revert that decision.
>> 
>> Do we want to promote a style where you can pass either? To me, in C
>> context, it seems awfully sloppy and confusing rather than convenient.
>> 
>> I'd argue the struct mipi_dsi_host stuff should use dev_* calls
>> directly, as it's more of a special case, rather than allow struct
>> device * in drm_* logging macros.
>
> I agree. I thought direct dev_* calls would not be ideal, as there is a
> TODO to move away from that, and also incorrectly expected to have more
> such dev ptr problems. But on a second thought, you are correct.
>
> Should I post a new patch, with using __drm_dev_ptr instead and
> removing the __get_dev_ptr generic macro, and using dev_* in
> drm_mipi_dsi.c as `dev_err(dev, "*ERROR* [drm] <msg>", ...);`?

I think commit 1040e424353f ("drm: mipi-dsi: Convert logging to drm_*
functions.") and any similar ones should just be reverted. It worked by
accident. You're supposed to pass struct drm_device * to the drm_*
logging functions, and that passes struct mipi_dsi_host *.

BR,
Jani.



>
>> BR,
>> Jani.
>
> Thanks,
> Siddh

-- 
Jani Nikula, Intel Open Source Graphics Center

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.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>,
	jim cromie <jim.cromie@gmail.com>,
	sam ravnborg <sam@ravnborg.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v7 1/7] drm/print: Fix and add support for NULL as first argument in drm_* macros
Date: Mon, 27 Feb 2023 18:02:25 +0200	[thread overview]
Message-ID: <878rgj14ha.fsf@intel.com> (raw)
In-Reply-To: <18693900367.2ce71ba5548919.6872574648582795181@siddh.me>

On Mon, 27 Feb 2023, Siddh Raman Pant <code@siddh.me> wrote:
> On Mon, 27 Feb 2023 15:13:21 +0530, Jani Nikula wrote:
>> First of all, that's two distinct changes in one patch. The subject says
>> one thing, but it's really two.
>
> Sorry, my bad.
>
>> But the main question is, do we *really* want to let callers pass either
>> struct drm_device * or struct device *? It will be type safe with
>> generics, but if it's okay to use either, people *will* use either. The
>> call sites will end up being a mixture of both. You can't control it. It
>> will be very tedious if you ever want to revert that decision.
>> 
>> Do we want to promote a style where you can pass either? To me, in C
>> context, it seems awfully sloppy and confusing rather than convenient.
>> 
>> I'd argue the struct mipi_dsi_host stuff should use dev_* calls
>> directly, as it's more of a special case, rather than allow struct
>> device * in drm_* logging macros.
>
> I agree. I thought direct dev_* calls would not be ideal, as there is a
> TODO to move away from that, and also incorrectly expected to have more
> such dev ptr problems. But on a second thought, you are correct.
>
> Should I post a new patch, with using __drm_dev_ptr instead and
> removing the __get_dev_ptr generic macro, and using dev_* in
> drm_mipi_dsi.c as `dev_err(dev, "*ERROR* [drm] <msg>", ...);`?

I think commit 1040e424353f ("drm: mipi-dsi: Convert logging to drm_*
functions.") and any similar ones should just be reverted. It worked by
accident. You're supposed to pass struct drm_device * to the drm_*
logging functions, and that passes struct mipi_dsi_host *.

BR,
Jani.



>
>> BR,
>> Jani.
>
> Thanks,
> Siddh

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-02-27 16:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26  7:21 [PATCH v7 0/7] drm: Remove usage of deprecated DRM_* macros Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 1/7] drm/print: Fix and add support for NULL as first argument in drm_* macros Siddh Raman Pant
2023-02-27  9:43   ` Jani Nikula
2023-02-27 15:48     ` Siddh Raman Pant
2023-02-27 15:48       ` Siddh Raman Pant
2023-02-27 16:02       ` Jani Nikula [this message]
2023-02-27 16:02         ` Jani Nikula
2023-02-26  7:21 ` [PATCH v7 2/7] drm: Remove usage of deprecated DRM_INFO Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 3/7] drm: Remove usage of deprecated DRM_NOTE Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 4/7] drm: Remove usage of deprecated DRM_ERROR Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 5/7] drm: Remove usage of deprecated DRM_DEBUG Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 6/7] drm: Remove usage of deprecated DRM_DEBUG_DRIVER Siddh Raman Pant
2023-02-26  7:21 ` [PATCH v7 7/7] drm: Remove usage of deprecated DRM_DEBUG_KMS Siddh Raman Pant

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=878rgj14ha.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=code@siddh.me \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.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.