diff mbox series

drm/sun4i: Unbind components before releasing DRM and mem at master unbind

Message ID 20190419080235.24396-1-paul.kocialkowski@bootlin.com (mailing list archive)
State New, archived
Headers show
Series drm/sun4i: Unbind components before releasing DRM and mem at master unbind | expand

Commit Message

Paul Kocialkowski April 19, 2019, 8:02 a.m. UTC
Our components may still be using the DRM device driver (if only to
access our driver's private data), so make sure to unbind them before
the final drm_dev_put.

Also release our resserved memory adter unbind to match reverse
creation order.

Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Chen-Yu Tsai April 19, 2019, 4:02 p.m. UTC | #1
On Fri, Apr 19, 2019 at 1:03 AM Paul Kocialkowski
<paul.kocialkowski@bootlin.com> wrote:
>
> Our components may still be using the DRM device driver (if only to
> access our driver's private data), so make sure to unbind them before
> the final drm_dev_put.
>
> Also release our resserved memory adter unbind to match reverse

typos...

> creation order.
>
> Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 843b86661833..29258b404e54 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -149,10 +149,11 @@ static void sun4i_drv_unbind(struct device *dev)
>         drm_kms_helper_poll_fini(drm);
>         drm_atomic_helper_shutdown(drm);
>         drm_mode_config_cleanup(drm);
> -       of_reserved_mem_device_release(dev);
> -       drm_dev_put(drm);
>
>         component_unbind_all(dev, NULL);
> +       of_reserved_mem_device_release(dev);

You should probably mention this change in the commit log as well.

Otherwise,

Reviewed-by: Chen-Yu Tsai <wens@csie.org>

> +
> +       drm_dev_put(drm);
>  }
>
>  static const struct component_master_ops sun4i_drv_master_ops = {
> --
> 2.21.0
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Paul Kocialkowski April 19, 2019, 5:10 p.m. UTC | #2
Hi,

On Fri, 2019-04-19 at 09:02 -0700, Chen-Yu Tsai wrote:
> On Fri, Apr 19, 2019 at 1:03 AM Paul Kocialkowski
> <paul.kocialkowski@bootlin.com> wrote:
> > Our components may still be using the DRM device driver (if only to
> > access our driver's private data), so make sure to unbind them before
> > the final drm_dev_put.
> > 
> > Also release our resserved memory adter unbind to match reverse
> 
> typos...

I'll probably spin up a v2 to fix them, they annoy me as well.

> > creation order.
> > 
> > Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > ---
> >  drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > index 843b86661833..29258b404e54 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -149,10 +149,11 @@ static void sun4i_drv_unbind(struct device *dev)
> >         drm_kms_helper_poll_fini(drm);
> >         drm_atomic_helper_shutdown(drm);
> >         drm_mode_config_cleanup(drm);
> > -       of_reserved_mem_device_release(dev);
> > -       drm_dev_put(drm);
> > 
> >         component_unbind_all(dev, NULL);
> > +       of_reserved_mem_device_release(dev);
> 
> You should probably mention this change in the commit log as well.

That's what I meant with the line that has typos. Maybe I should make
it slightly more explicit as:

Also released our reserved memory after component unbind instead of
before to match reverse creation order.

What do you think?

> Otherwise,
> 
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>

Thanks for the review!

Cheers,

Paul

> > +
> > +       drm_dev_put(drm);
> >  }
> > 
> >  static const struct component_master_ops sun4i_drv_master_ops = {
> > --
> > 2.21.0
> > 
> > --
> > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
Paul Kocialkowski April 23, 2019, 5:06 p.m. UTC | #3
Hi,

Le vendredi 19 avril 2019 à 19:10 +0200, Paul Kocialkowski a écrit :
> Hi,
> 
> On Fri, 2019-04-19 at 09:02 -0700, Chen-Yu Tsai wrote:
> > On Fri, Apr 19, 2019 at 1:03 AM Paul Kocialkowski
> > <paul.kocialkowski@bootlin.com> wrote:
> > > Our components may still be using the DRM device driver (if only to
> > > access our driver's private data), so make sure to unbind them before
> > > the final drm_dev_put.
> > > 
> > > Also release our resserved memory adter unbind to match reverse
> > 
> > typos...
> 
> I'll probably spin up a v2 to fix them, they annoy me as well.
> 
> > > creation order.
> > > 
> > > Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
> > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > > ---
> > >  drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > index 843b86661833..29258b404e54 100644
> > > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > @@ -149,10 +149,11 @@ static void sun4i_drv_unbind(struct device *dev)
> > >         drm_kms_helper_poll_fini(drm);
> > >         drm_atomic_helper_shutdown(drm);
> > >         drm_mode_config_cleanup(drm);
> > > -       of_reserved_mem_device_release(dev);
> > > -       drm_dev_put(drm);
> > > 
> > >         component_unbind_all(dev, NULL);
> > > +       of_reserved_mem_device_release(dev);
> > 
> > You should probably mention this change in the commit log as well.
> 
> That's what I meant with the line that has typos. Maybe I should make
> it slightly more explicit as:
> 
> Also released our reserved memory after component unbind instead of
> before to match reverse creation order.
> 
> What do you think?
> 
> > Otherwise,
> > 
> > Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> 
> Thanks for the review!

Unless you have objections at this point, I'll send out the patch with
your Reviewed-by soon to get the patch out ASAP.

Cheers,

Paul

> Cheers,
> 
> Paul
> 
> > > +
> > > +       drm_dev_put(drm);
> > >  }
> > > 
> > >  static const struct component_master_ops sun4i_drv_master_ops = {
> > > --
> > > 2.21.0
> > > 
> > > --
> > > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
Chen-Yu Tsai April 23, 2019, 5:14 p.m. UTC | #4
On Tue, Apr 23, 2019 at 10:06 AM Paul Kocialkowski
<paul.kocialkowski@bootlin.com> wrote:
>
> Hi,
>
> Le vendredi 19 avril 2019 à 19:10 +0200, Paul Kocialkowski a écrit :
> > Hi,
> >
> > On Fri, 2019-04-19 at 09:02 -0700, Chen-Yu Tsai wrote:
> > > On Fri, Apr 19, 2019 at 1:03 AM Paul Kocialkowski
> > > <paul.kocialkowski@bootlin.com> wrote:
> > > > Our components may still be using the DRM device driver (if only to
> > > > access our driver's private data), so make sure to unbind them before
> > > > the final drm_dev_put.
> > > >
> > > > Also release our resserved memory adter unbind to match reverse
> > >
> > > typos...
> >
> > I'll probably spin up a v2 to fix them, they annoy me as well.
> >
> > > > creation order.
> > > >
> > > > Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
> > > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > > > ---
> > > >  drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > index 843b86661833..29258b404e54 100644
> > > > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > @@ -149,10 +149,11 @@ static void sun4i_drv_unbind(struct device *dev)
> > > >         drm_kms_helper_poll_fini(drm);
> > > >         drm_atomic_helper_shutdown(drm);
> > > >         drm_mode_config_cleanup(drm);
> > > > -       of_reserved_mem_device_release(dev);
> > > > -       drm_dev_put(drm);
> > > >
> > > >         component_unbind_all(dev, NULL);
> > > > +       of_reserved_mem_device_release(dev);
> > >
> > > You should probably mention this change in the commit log as well.
> >
> > That's what I meant with the line that has typos. Maybe I should make
> > it slightly more explicit as:
> >
> > Also released our reserved memory after component unbind instead of
> > before to match reverse creation order.
> >
> > What do you think?

Forgot to reply ...

Looking again, the original already made sense. I'm not sure what I
was doing ...

> > > Otherwise,
> > >
> > > Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> >
> > Thanks for the review!
>
> Unless you have objections at this point, I'll send out the patch with
> your Reviewed-by soon to get the patch out ASAP.

Works for me. Thanks!

ChenYu

> Cheers,
>
> Paul
>
> > Cheers,
> >
> > Paul
> >
> > > > +
> > > > +       drm_dev_put(drm);
> > > >  }
> > > >
> > > >  static const struct component_master_ops sun4i_drv_master_ops = {
> > > > --
> > > > 2.21.0
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > > > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Paul Kocialkowski April 23, 2019, 5:16 p.m. UTC | #5
Hi,

Le mardi 23 avril 2019 à 10:14 -0700, Chen-Yu Tsai a écrit :
> On Tue, Apr 23, 2019 at 10:06 AM Paul Kocialkowski
> <paul.kocialkowski@bootlin.com> wrote:
> > Hi,
> > 
> > Le vendredi 19 avril 2019 à 19:10 +0200, Paul Kocialkowski a écrit :
> > > Hi,
> > > 
> > > On Fri, 2019-04-19 at 09:02 -0700, Chen-Yu Tsai wrote:
> > > > On Fri, Apr 19, 2019 at 1:03 AM Paul Kocialkowski
> > > > <paul.kocialkowski@bootlin.com> wrote:
> > > > > Our components may still be using the DRM device driver (if only to
> > > > > access our driver's private data), so make sure to unbind them before
> > > > > the final drm_dev_put.
> > > > > 
> > > > > Also release our resserved memory adter unbind to match reverse
> > > > 
> > > > typos...
> > > 
> > > I'll probably spin up a v2 to fix them, they annoy me as well.
> > > 
> > > > > creation order.
> > > > > 
> > > > > Fixes: f5a9ed867c83 ("drm/sun4i: Fix component unbinding and component master deletion")
> > > > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > > > > ---
> > > > >  drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++--
> > > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > > index 843b86661833..29258b404e54 100644
> > > > > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > > > > @@ -149,10 +149,11 @@ static void sun4i_drv_unbind(struct device *dev)
> > > > >         drm_kms_helper_poll_fini(drm);
> > > > >         drm_atomic_helper_shutdown(drm);
> > > > >         drm_mode_config_cleanup(drm);
> > > > > -       of_reserved_mem_device_release(dev);
> > > > > -       drm_dev_put(drm);
> > > > > 
> > > > >         component_unbind_all(dev, NULL);
> > > > > +       of_reserved_mem_device_release(dev);
> > > > 
> > > > You should probably mention this change in the commit log as well.
> > > 
> > > That's what I meant with the line that has typos. Maybe I should make
> > > it slightly more explicit as:
> > > 
> > > Also released our reserved memory after component unbind instead of
> > > before to match reverse creation order.
> > > 
> > > What do you think?
> 
> Forgot to reply ...
> 
> Looking again, the original already made sense. I'm not sure what I
> was doing ...

I like the improved description better anyway so I'll go with that :)

> > > > Otherwise,
> > > > 
> > > > Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> > > 
> > > Thanks for the review!
> > 
> > Unless you have objections at this point, I'll send out the patch with
> > your Reviewed-by soon to get the patch out ASAP.
> 
> Works for me. Thanks!

Great, thanks!

Cheers,

Paul

> ChenYu
> 
> > Cheers,
> > 
> > Paul
> > 
> > > Cheers,
> > > 
> > > Paul
> > > 
> > > > > +
> > > > > +       drm_dev_put(drm);
> > > > >  }
> > > > > 
> > > > >  static const struct component_master_ops sun4i_drv_master_ops = {
> > > > > --
> > > > > 2.21.0
> > > > > 
> > > > > --
> > > > > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > > > > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > > > > For more options, visit https://groups.google.com/d/optout.
> > 
> > --
> > You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 843b86661833..29258b404e54 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -149,10 +149,11 @@  static void sun4i_drv_unbind(struct device *dev)
 	drm_kms_helper_poll_fini(drm);
 	drm_atomic_helper_shutdown(drm);
 	drm_mode_config_cleanup(drm);
-	of_reserved_mem_device_release(dev);
-	drm_dev_put(drm);
 
 	component_unbind_all(dev, NULL);
+	of_reserved_mem_device_release(dev);
+
+	drm_dev_put(drm);
 }
 
 static const struct component_master_ops sun4i_drv_master_ops = {