diff mbox series

Documentation: vkms: clarify devres managed refernce cleanup

Message ID 20230425080240.3582324-1-brpol@chromium.org (mailing list archive)
State New, archived
Headers show
Series Documentation: vkms: clarify devres managed refernce cleanup | expand

Commit Message

Brandon Ross Pollack April 25, 2023, 8:02 a.m. UTC
added documentation to drm_dev_unregister clarifying that devres managed
devices allocated with devm_drm_dev_alloc do not require calls to
drm_dev_put.

Signed-off-by: Brandon Pollack <brpol@chromium.org>

---

This is my first patch to any tree.  I've tried my best to read as many
kernel docs etc as possible (wip). This took me a moment to realize so I
figured it was as good a candidate as any for a first patch (at the very
least to make sure I have the whole patching process figured out).  I
hope to make more janitorial changes as I continue to learn leading up
to the work I hope to do.

We're hoping to add multiple display hotplug output support to VKMS for
testing purposes.  Some work has been done already, but we'll be taking
over moving forward.  Our intent is to remain involved and assist in
maintaining these changes.

Looking forward to your comments/advice (now and henceforth!)
---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Daniel Vetter April 27, 2023, 10:02 a.m. UTC | #1
On Tue, Apr 25, 2023 at 08:02:40AM +0000, Brandon Pollack wrote:
> added documentation to drm_dev_unregister clarifying that devres managed
> devices allocated with devm_drm_dev_alloc do not require calls to
> drm_dev_put.
> 
> Signed-off-by: Brandon Pollack <brpol@chromium.org>
> 
> ---
> 
> This is my first patch to any tree.  I've tried my best to read as many
> kernel docs etc as possible (wip). This took me a moment to realize so I
> figured it was as good a candidate as any for a first patch (at the very
> least to make sure I have the whole patching process figured out).  I
> hope to make more janitorial changes as I continue to learn leading up
> to the work I hope to do.
> 
> We're hoping to add multiple display hotplug output support to VKMS for
> testing purposes.  Some work has been done already, but we'll be taking
> over moving forward.  Our intent is to remain involved and assist in
> maintaining these changes.
> 
> Looking forward to your comments/advice (now and henceforth!)

Looking good!

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Since you're @chromium.org I'm assuming that one of the cros committers
will push this to drm-misc-next. If not please holler.
-Daniel

> ---
>  drivers/gpu/drm/drm_drv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index cee0cc522ed9..12687dd9e1ac 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
>   *
>   * Unregister the DRM device from the system. This does the reverse of
>   * drm_dev_register() but does not deallocate the device. The caller must call
> - * drm_dev_put() to drop their final reference.
> + * drm_dev_put() to drop their final reference, unless it is managed with devres
> + * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
> + * already an unwind action registered.
>   *
>   * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
>   * which can be called while there are still open users of @dev.
> -- 
> 2.40.0.634.g4ca3ef3211-goog
>
Brandon Ross Pollack April 28, 2023, 2:53 a.m. UTC | #2
On Thu, Apr 27, 2023 at 7:02 PM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Tue, Apr 25, 2023 at 08:02:40AM +0000, Brandon Pollack wrote:
> > added documentation to drm_dev_unregister clarifying that devres managed
> > devices allocated with devm_drm_dev_alloc do not require calls to
> > drm_dev_put.
> >
> > Signed-off-by: Brandon Pollack <brpol@chromium.org>
> >
> > ---
> >
> > This is my first patch to any tree.  I've tried my best to read as many
> > kernel docs etc as possible (wip). This took me a moment to realize so I
> > figured it was as good a candidate as any for a first patch (at the very
> > least to make sure I have the whole patching process figured out).  I
> > hope to make more janitorial changes as I continue to learn leading up
> > to the work I hope to do.
> >
> > We're hoping to add multiple display hotplug output support to VKMS for
> > testing purposes.  Some work has been done already, but we'll be taking
> > over moving forward.  Our intent is to remain involved and assist in
> > maintaining these changes.
> >
> > Looking forward to your comments/advice (now and henceforth!)
>
> Looking good!
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Since you're @chromium.org I'm assuming that one of the cros committers
> will push this to drm-misc-next. If not please holler.
> -Daniel

I'm actually working in relative isolation on this (I'm located in
Tokyo) so please go ahead.  I'll get in touch with some of those folks
soon :)

>
> > ---
> >  drivers/gpu/drm/drm_drv.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index cee0cc522ed9..12687dd9e1ac 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
> >   *
> >   * Unregister the DRM device from the system. This does the reverse of
> >   * drm_dev_register() but does not deallocate the device. The caller must call
> > - * drm_dev_put() to drop their final reference.
> > + * drm_dev_put() to drop their final reference, unless it is managed with devres
> > + * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
> > + * already an unwind action registered.
> >   *
> >   * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
> >   * which can be called while there are still open users of @dev.
> > --
> > 2.40.0.634.g4ca3ef3211-goog
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Brandon Ross Pollack May 8, 2023, 1:31 a.m. UTC | #3
Seems it might be best just to have you do this, Daniel.  Thanks for the
review :)

On Fri, Apr 28, 2023 at 11:53 AM Brandon Ross Pollack <brpol@chromium.org>
wrote:

> On Thu, Apr 27, 2023 at 7:02 PM Daniel Vetter <daniel@ffwll.ch> wrote:
> >
> > On Tue, Apr 25, 2023 at 08:02:40AM +0000, Brandon Pollack wrote:
> > > added documentation to drm_dev_unregister clarifying that devres
> managed
> > > devices allocated with devm_drm_dev_alloc do not require calls to
> > > drm_dev_put.
> > >
> > > Signed-off-by: Brandon Pollack <brpol@chromium.org>
> > >
> > > ---
> > >
> > > This is my first patch to any tree.  I've tried my best to read as many
> > > kernel docs etc as possible (wip). This took me a moment to realize so
> I
> > > figured it was as good a candidate as any for a first patch (at the
> very
> > > least to make sure I have the whole patching process figured out).  I
> > > hope to make more janitorial changes as I continue to learn leading up
> > > to the work I hope to do.
> > >
> > > We're hoping to add multiple display hotplug output support to VKMS for
> > > testing purposes.  Some work has been done already, but we'll be taking
> > > over moving forward.  Our intent is to remain involved and assist in
> > > maintaining these changes.
> > >
> > > Looking forward to your comments/advice (now and henceforth!)
> >
> > Looking good!
> >
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >
> > Since you're @chromium.org I'm assuming that one of the cros committers
> > will push this to drm-misc-next. If not please holler.
> > -Daniel
>
> I'm actually working in relative isolation on this (I'm located in
> Tokyo) so please go ahead.  I'll get in touch with some of those folks
> soon :)
>
> >
> > > ---
> > >  drivers/gpu/drm/drm_drv.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > > index cee0cc522ed9..12687dd9e1ac 100644
> > > --- a/drivers/gpu/drm/drm_drv.c
> > > +++ b/drivers/gpu/drm/drm_drv.c
> > > @@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
> > >   *
> > >   * Unregister the DRM device from the system. This does the reverse of
> > >   * drm_dev_register() but does not deallocate the device. The caller
> must call
> > > - * drm_dev_put() to drop their final reference.
> > > + * drm_dev_put() to drop their final reference, unless it is managed
> with devres
> > > + * (as devices allocated with devm_drm_dev_alloc() are), in which
> case there is
> > > + * already an unwind action registered.
> > >   *
> > >   * A special form of unregistering for hotpluggable devices is
> drm_dev_unplug(),
> > >   * which can be called while there are still open users of @dev.
> > > --
> > > 2.40.0.634.g4ca3ef3211-goog
> > >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
>
Sean Paul May 8, 2023, 3:59 p.m. UTC | #4
On Thu, Apr 27, 2023 at 12:02:18PM +0200, Daniel Vetter wrote:
> On Tue, Apr 25, 2023 at 08:02:40AM +0000, Brandon Pollack wrote:
> > added documentation to drm_dev_unregister clarifying that devres managed
> > devices allocated with devm_drm_dev_alloc do not require calls to
> > drm_dev_put.
> > 
> > Signed-off-by: Brandon Pollack <brpol@chromium.org>
> > 
> > ---
> > 
> > This is my first patch to any tree.  I've tried my best to read as many
> > kernel docs etc as possible (wip). This took me a moment to realize so I
> > figured it was as good a candidate as any for a first patch (at the very
> > least to make sure I have the whole patching process figured out).  I
> > hope to make more janitorial changes as I continue to learn leading up
> > to the work I hope to do.
> > 
> > We're hoping to add multiple display hotplug output support to VKMS for
> > testing purposes.  Some work has been done already, but we'll be taking
> > over moving forward.  Our intent is to remain involved and assist in
> > maintaining these changes.
> > 
> > Looking forward to your comments/advice (now and henceforth!)
> 
> Looking good!
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Since you're @chromium.org I'm assuming that one of the cros committers
> will push this to drm-misc-next. If not please holler.

Applied to drm-misc-next, thank you for the review.

Sean


> -Daniel
> 
> > ---
> >  drivers/gpu/drm/drm_drv.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index cee0cc522ed9..12687dd9e1ac 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
> >   *
> >   * Unregister the DRM device from the system. This does the reverse of
> >   * drm_dev_register() but does not deallocate the device. The caller must call
> > - * drm_dev_put() to drop their final reference.
> > + * drm_dev_put() to drop their final reference, unless it is managed with devres
> > + * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
> > + * already an unwind action registered.
> >   *
> >   * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
> >   * which can be called while there are still open users of @dev.
> > -- 
> > 2.40.0.634.g4ca3ef3211-goog
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index cee0cc522ed9..12687dd9e1ac 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -969,7 +969,9 @@  EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller must call
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed with devres
+ * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
  * which can be called while there are still open users of @dev.