[PATCH v7 1/7] drm/print: Fix and add support for NULL as first argument in drm_* macros
Siddh Raman Pant
code at siddh.me
Mon Feb 27 15:48:54 UTC 2023
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>", ...);`?
> BR,
> Jani.
Thanks,
Siddh
More information about the dri-devel
mailing list