[PATCH 1/3] drm/bridge: fsl-ldb: make use of driver_private

Dmitry Baryshkov dmitry.baryshkov at oss.qualcomm.com
Sat May 24 00:38:55 UTC 2025


On Thu, May 15, 2025 at 01:04:52AM +0200, Marco Felsch wrote:
> Hi Laurent,
> 
> On 25-05-15, Laurent Pinchart wrote:
> > Hi Marco,
> > 
> > Thank you for the patch.
> > 
> > On Thu, May 15, 2025 at 12:24:51AM +0200, Marco Felsch wrote:
> > > Make use of the drm_bridge::driver_private data instead of
> > > container_of() wrapper.
> > 
> > I suppose this is a personal preference, but I like usage of
> > container_of() better. In my opinion it conveys better that struct
> > fsl_ldb "unherits" from struct drm_bridge.
> 
> Yes, we can drop this patch if container_of() or to_fsl_ldb() is
> preferred. I just saw the driver_private field and why not making use of
> it since we do that a lot, same is true for container_of :)

container_of() generally is a more preferred form, because it provides
type safety. It doesn't perform blind casts. Using driver_data involves
using void pointer, which can be cast to any structure pointer. It is
easy to make hard-to-notice mistakes.

-- 
With best wishes
Dmitry


More information about the dri-devel mailing list