All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] base/core.c: improve comment of the function device_find_child()
@ 2013-04-12 11:59 Federico Vaga
  2013-04-12 21:51 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Federico Vaga @ 2013-04-12 11:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Federico Vaga

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
---
 drivers/base/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 016312437..eb0c6ea 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1372,6 +1372,10 @@ int device_for_each_child(struct device *parent, void *data,
  * if it does.  If the callback returns non-zero and a reference to the
  * current device can be obtained, this function will return to the caller
  * and not iterate over any more devices.
+ *
+ * NOTE: internally, the function does get_device() on the retrieved child.
+ * It is duty of the caller performing a put_device() on the retrieved
+ * child device when the caller finishes to work on it.
  */
 struct device *device_find_child(struct device *parent, void *data,
 				 int (*match)(struct device *dev, void *data))
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] base/core.c: improve comment of the function device_find_child()
  2013-04-12 11:59 [PATCH] base/core.c: improve comment of the function device_find_child() Federico Vaga
@ 2013-04-12 21:51 ` Greg Kroah-Hartman
  2013-04-15  8:32   ` Federico Vaga
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2013-04-12 21:51 UTC (permalink / raw)
  To: Federico Vaga; +Cc: linux-kernel

On Fri, Apr 12, 2013 at 01:59:32PM +0200, Federico Vaga wrote:
> Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
> ---
>  drivers/base/core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 016312437..eb0c6ea 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1372,6 +1372,10 @@ int device_for_each_child(struct device *parent, void *data,
>   * if it does.  If the callback returns non-zero and a reference to the
>   * current device can be obtained, this function will return to the caller
>   * and not iterate over any more devices.
> + *
> + * NOTE: internally, the function does get_device() on the retrieved child.
> + * It is duty of the caller performing a put_device() on the retrieved
> + * child device when the caller finishes to work on it.
>   */

Why not just use the same wording that class_find_device() has, which is
simpler and easier to understand (IMHO)?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] base/core.c: improve comment of the function device_find_child()
  2013-04-12 21:51 ` Greg Kroah-Hartman
@ 2013-04-15  8:32   ` Federico Vaga
  0 siblings, 0 replies; 3+ messages in thread
From: Federico Vaga @ 2013-04-15  8:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

On Friday 12 April 2013 14:51:25 Greg Kroah-Hartman wrote:
> On Fri, Apr 12, 2013 at 01:59:32PM +0200, Federico Vaga wrote:
> > Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
> > ---
> > 
> >  drivers/base/core.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index 016312437..eb0c6ea 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -1372,6 +1372,10 @@ int device_for_each_child(struct device *parent,
> > void *data,> 
> >   * if it does.  If the callback returns non-zero and a reference to the
> >   * current device can be obtained, this function will return to the
> >   caller
> >   * and not iterate over any more devices.
> > 
> > + *
> > + * NOTE: internally, the function does get_device() on the retrieved
> > child. + * It is duty of the caller performing a put_device() on the
> > retrieved + * child device when the caller finishes to work on it.
> > 
> >   */
> 
> Why not just use the same wording that class_find_device() has, which is
> simpler and easier to understand (IMHO)?

Mh, yes. You are right. I'll send a new patch

-- 
Federico Vaga

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-15  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-12 11:59 [PATCH] base/core.c: improve comment of the function device_find_child() Federico Vaga
2013-04-12 21:51 ` Greg Kroah-Hartman
2013-04-15  8:32   ` Federico Vaga

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.