[PATCH 1/2] drm: exynos: Perform initialization/cleanup at probe/remove time

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Dec 17 22:12:40 UTC 2016


Hello Inki,

On Saturday 17 Dec 2016 09:33:31 Inki Dae wrote:
> HI,
> 
> Thanks for patch. Reasonable to me and go to misc excepting below one thing.
> Please check my comment.
> 
> 2016-12-14 4:34 GMT+09:00 Laurent Pinchart:
> > From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > 
> > The drm driver .load() operation is prone to race conditions as it
> > initializes the driver after registering the device nodes. Its usage is
> > deprecated, inline it in the probe function and call drm_dev_alloc() and
> > drm_dev_register() explicitly.
> > 
> > For consistency inline the .unload() handler in the remove function as
> > well.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > ---
> > 
> >  drivers/gpu/drm/exynos/exynos_dp.c       |   1 -
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c  |   1 -
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c  | 245 ++++++++++++-------------
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c  |   1 -
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c |   1 -
> >  drivers/gpu/drm/exynos/exynos_hdmi.c     |   1 -
> >  6 files changed, 127 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp.c
> > b/drivers/gpu/drm/exynos/exynos_dp.c index 528229faffe4..b839f065f4b3
> > 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp.c
> > @@ -102,7 +102,6 @@ static int exynos_dp_bridge_attach(struct
> > analogix_dp_plat_data *plat_data,> 
> >         struct drm_encoder *encoder = &dp->encoder;
> >         int ret;
> > 
> > -       drm_connector_register(connector);
> 
> You removed above function from encoder and connector drivers.Is
> removing this required?
> And is this related to this patch? If not so, it seems this change
> should go to another patch with the reason to remove this function
> call.

When using the .load() callback, driver initialization is performed from 
drm_dev_register() after the DRM device gets registered with sysfs. With this 
patch driver initialization is moved before drm_dev_register(), and 
registering connectors manually would then trigger a WARN due to the sysfs 
parent not being registered yet.

The connectors are registered by the DRM core (drm_modeset_register_all() 
called from drm_dev_register()), so there's no need to register them manually 
after drm_dev_register(), we can just drop that code.

-- 
Regards,

Laurent Pinchart


More information about the dri-devel mailing list