[PATCH v7 1/7] drm/print: Fix and add support for NULL as first argument in drm_* macros
Jani Nikula
jani.nikula at linux.intel.com
Mon Feb 27 16:02:25 UTC 2023
On Mon, 27 Feb 2023, Siddh Raman Pant <code at 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
More information about the dri-devel
mailing list