Message ID | 20190828145945.15904-1-ayan.halder@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] drm/komeda: Reordered the komeda's de-init functions | expand |
On Wed, Aug 28, 2019 at 03:00:19PM +0000, Ayan Halder wrote: > From: Ayan Halder <Ayan.Halder@arm.com> > > The de-init routine should be doing the following in order:- > 1. Unregister the drm device > 2. Shut down the crtcs - failing to do this might cause a connector leakage > See the 'commit 109c4d18e574 ("drm/arm/malidp: Ensure that the crtcs are > shutdown before removing any encoder/connector")' > 3. Disable the interrupts > 4. Unbind the components > 5. Free up DRM mode_config info > > Changes from v1:- > 1. Re-ordered the header files inclusion > 2. Rebased on top of the latest drm-misc-fixes > > Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com> > Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com> Looks good to me. Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com> > --- > .../gpu/drm/arm/display/komeda/komeda_kms.c | 23 ++++++++++++------- > 1 file changed, 15 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > index 1f0e3f4e8d74..69d9e26c60c8 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > @@ -14,8 +14,8 @@ > #include <drm/drm_gem_cma_helper.h> > #include <drm/drm_gem_framebuffer_helper.h> > #include <drm/drm_irq.h> > -#include <drm/drm_vblank.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_vblank.h> > > #include "komeda_dev.h" > #include "komeda_framebuffer.h" > @@ -306,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > komeda_kms_irq_handler, IRQF_SHARED, > drm->driver->name, drm); > if (err) > - goto cleanup_mode_config; > + goto free_component_binding; > > err = mdev->funcs->enable_irq(mdev); > if (err) > - goto cleanup_mode_config; > + goto free_component_binding; > > drm->irq_enabled = true; > > @@ -318,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > > err = drm_dev_register(drm, 0); > if (err) > - goto cleanup_mode_config; > + goto free_interrupts; > > return kms; > > -cleanup_mode_config: > +free_interrupts: > drm_kms_helper_poll_fini(drm); > drm->irq_enabled = false; > + mdev->funcs->disable_irq(mdev); > +free_component_binding: > + component_unbind_all(mdev->dev, drm); > +cleanup_mode_config: > drm_mode_config_cleanup(drm); > komeda_kms_cleanup_private_objs(kms); > + drm->dev_private = NULL; > + drm_dev_put(drm); > free_kms: > kfree(kms); > return ERR_PTR(err); > @@ -337,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) > struct drm_device *drm = &kms->base; > struct komeda_dev *mdev = drm->dev_private; > > - drm->irq_enabled = false; > - mdev->funcs->disable_irq(mdev); > drm_dev_unregister(drm); > drm_kms_helper_poll_fini(drm); > + drm_atomic_helper_shutdown(drm); > + drm->irq_enabled = false; > + mdev->funcs->disable_irq(mdev); > component_unbind_all(mdev->dev, drm); > - komeda_kms_cleanup_private_objs(kms); > drm_mode_config_cleanup(drm); > + komeda_kms_cleanup_private_objs(kms); > drm->dev_private = NULL; > drm_dev_put(drm); > } > -- > 2.21.0
On Wed, Aug 28, 2019 at 03:58:12PM +0000, james qian wang (Arm Technology China) wrote: > On Wed, Aug 28, 2019 at 03:00:19PM +0000, Ayan Halder wrote: > > From: Ayan Halder <Ayan.Halder@arm.com> > > > > The de-init routine should be doing the following in order:- > > 1. Unregister the drm device > > 2. Shut down the crtcs - failing to do this might cause a connector leakage > > See the 'commit 109c4d18e574 ("drm/arm/malidp: Ensure that the crtcs are > > shutdown before removing any encoder/connector")' > > 3. Disable the interrupts > > 4. Unbind the components > > 5. Free up DRM mode_config info > > > > Changes from v1:- > > 1. Re-ordered the header files inclusion > > 2. Rebased on top of the latest drm-misc-fixes > > > > Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com> > > Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com> > > Looks good to me. > > Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com> > Pushed to drm-misc-fixes - 6978bce054247e4cfccdf689ce263e076499f905 > > --- > > .../gpu/drm/arm/display/komeda/komeda_kms.c | 23 ++++++++++++------- > > 1 file changed, 15 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > index 1f0e3f4e8d74..69d9e26c60c8 100644 > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c > > @@ -14,8 +14,8 @@ > > #include <drm/drm_gem_cma_helper.h> > > #include <drm/drm_gem_framebuffer_helper.h> > > #include <drm/drm_irq.h> > > -#include <drm/drm_vblank.h> > > #include <drm/drm_probe_helper.h> > > +#include <drm/drm_vblank.h> > > > > #include "komeda_dev.h" > > #include "komeda_framebuffer.h" > > @@ -306,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > > komeda_kms_irq_handler, IRQF_SHARED, > > drm->driver->name, drm); > > if (err) > > - goto cleanup_mode_config; > > + goto free_component_binding; > > > > err = mdev->funcs->enable_irq(mdev); > > if (err) > > - goto cleanup_mode_config; > > + goto free_component_binding; > > > > drm->irq_enabled = true; > > > > @@ -318,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) > > > > err = drm_dev_register(drm, 0); > > if (err) > > - goto cleanup_mode_config; > > + goto free_interrupts; > > > > return kms; > > > > -cleanup_mode_config: > > +free_interrupts: > > drm_kms_helper_poll_fini(drm); > > drm->irq_enabled = false; > > + mdev->funcs->disable_irq(mdev); > > +free_component_binding: > > + component_unbind_all(mdev->dev, drm); > > +cleanup_mode_config: > > drm_mode_config_cleanup(drm); > > komeda_kms_cleanup_private_objs(kms); > > + drm->dev_private = NULL; > > + drm_dev_put(drm); > > free_kms: > > kfree(kms); > > return ERR_PTR(err); > > @@ -337,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) > > struct drm_device *drm = &kms->base; > > struct komeda_dev *mdev = drm->dev_private; > > > > - drm->irq_enabled = false; > > - mdev->funcs->disable_irq(mdev); > > drm_dev_unregister(drm); > > drm_kms_helper_poll_fini(drm); > > + drm_atomic_helper_shutdown(drm); > > + drm->irq_enabled = false; > > + mdev->funcs->disable_irq(mdev); > > component_unbind_all(mdev->dev, drm); > > - komeda_kms_cleanup_private_objs(kms); > > drm_mode_config_cleanup(drm); > > + komeda_kms_cleanup_private_objs(kms); > > drm->dev_private = NULL; > > drm_dev_put(drm); > > } > > -- > > 2.21.0
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 1f0e3f4e8d74..69d9e26c60c8 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -14,8 +14,8 @@ #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_irq.h> -#include <drm/drm_vblank.h> #include <drm/drm_probe_helper.h> +#include <drm/drm_vblank.h> #include "komeda_dev.h" #include "komeda_framebuffer.h" @@ -306,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) komeda_kms_irq_handler, IRQF_SHARED, drm->driver->name, drm); if (err) - goto cleanup_mode_config; + goto free_component_binding; err = mdev->funcs->enable_irq(mdev); if (err) - goto cleanup_mode_config; + goto free_component_binding; drm->irq_enabled = true; @@ -318,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) err = drm_dev_register(drm, 0); if (err) - goto cleanup_mode_config; + goto free_interrupts; return kms; -cleanup_mode_config: +free_interrupts: drm_kms_helper_poll_fini(drm); drm->irq_enabled = false; + mdev->funcs->disable_irq(mdev); +free_component_binding: + component_unbind_all(mdev->dev, drm); +cleanup_mode_config: drm_mode_config_cleanup(drm); komeda_kms_cleanup_private_objs(kms); + drm->dev_private = NULL; + drm_dev_put(drm); free_kms: kfree(kms); return ERR_PTR(err); @@ -337,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) struct drm_device *drm = &kms->base; struct komeda_dev *mdev = drm->dev_private; - drm->irq_enabled = false; - mdev->funcs->disable_irq(mdev); drm_dev_unregister(drm); drm_kms_helper_poll_fini(drm); + drm_atomic_helper_shutdown(drm); + drm->irq_enabled = false; + mdev->funcs->disable_irq(mdev); component_unbind_all(mdev->dev, drm); - komeda_kms_cleanup_private_objs(kms); drm_mode_config_cleanup(drm); + komeda_kms_cleanup_private_objs(kms); drm->dev_private = NULL; drm_dev_put(drm); }