mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] staging : android : sync : get_unused_fd
@ 2014-09-27  8:52 Heinrich Schuchardt
  2014-09-29 18:03 ` Yann Droneaud
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2014-09-27  8:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Colin Cross
  Cc: John Stultz, Daniel Vetter, Sumit Semwal, Masanari Iida,
	Daeseok Youn, Maarten Lankhorst, Heinrich Schuchardt, devel,
	linux-kernel, Yann Droneaud

sync.h recommends to use get_unused_fd which does not set
O_CLOEXEC while the rest of the android tree uses
get_unused_fd_flags and sets O_CLOEXEC.

The patch adjust the comment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/staging/android/sync.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 66b0f43..a21b79f 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence);
  * @fence:	fence to install
  * @fd:		file descriptor in which to install the fence
  *
- * Installs @fence into @fd.  @fd's should be acquired through get_unused_fd().
+ * Installs @fence into @fd.  @fd's should be acquired through
+ * get_unused_fd_flags(O_CLOEXEC).
  */
 void sync_fence_install(struct sync_fence *fence, int fd);
 
-- 
2.1.0


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

* Re: [PATCH 1/1] staging : android : sync : get_unused_fd
  2014-09-27  8:52 [PATCH 1/1] staging : android : sync : get_unused_fd Heinrich Schuchardt
@ 2014-09-29 18:03 ` Yann Droneaud
  2014-09-29 21:19   ` Aw: " Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Yann Droneaud @ 2014-09-29 18:03 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Greg Kroah-Hartman, Colin Cross, John Stultz, Daniel Vetter,
	Sumit Semwal, Masanari Iida, Daeseok Youn, Maarten Lankhorst,
	devel, linux-kernel, Yann Droneaud

Hi,

Le samedi 27 septembre 2014 à 10:52 +0200, Heinrich Schuchardt a écrit :
> sync.h recommends to use get_unused_fd which does not set
> O_CLOEXEC while the rest of the android tree uses
> get_unused_fd_flags and sets O_CLOEXEC.
> 
> The patch adjust the comment.
> 

I'd like to add this patch to my patchset which try to remove
get_unused_fd() in favor of get_unused_fd_flags():

http://lkml.kernel.org/r/cover.1411562410.git.ydroneaud@opteya.com

But having O_CLOEXEC is welcome but not strictly needed,
so I think the patch should be reworked to not require O_CLOEXEC.

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/staging/android/sync.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
> index 66b0f43..a21b79f 100644
> --- a/drivers/staging/android/sync.h
> +++ b/drivers/staging/android/sync.h
> @@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence);
>   * @fence:	fence to install
>   * @fd:		file descriptor in which to install the fence
>   *
> - * Installs @fence into @fd.  @fd's should be acquired through get_unused_fd().
> + * Installs @fence into @fd.  @fd's should be acquired through
> + * get_unused_fd_flags(O_CLOEXEC).

I think it will be better to have something like:

    get_unused_fd_flags(flags), with flags either provided by userspace
    or set to O_CLOEXEC.


>   */
>  void sync_fence_install(struct sync_fence *fence, int fd);
>  

Regards.

-- 
Yann Droneaud
OPTEYA



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

* Aw: Re: [PATCH 1/1] staging : android : sync : get_unused_fd
  2014-09-29 18:03 ` Yann Droneaud
@ 2014-09-29 21:19   ` Heinrich Schuchardt
  2014-09-30 17:15     ` Yann Droneaud
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2014-09-29 21:19 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: Greg Kroah-Hartman, Colin Cross, John Stultz, Daniel Vetter,
	Sumit Semwal, Masanari Iida, Daeseok Youn, Maarten Lankhorst,
	devel, linux-kernel, Yann Droneaud


> Gesendet: Montag, 29. September 2014 um 20:03 Uhr
> Von: "Yann Droneaud" <ydroneaud@opteya.com>
> An: "Heinrich Schuchardt" <xypron.glpk@gmx.de>
> Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Colin Cross" <ccross@android.com>, "John Stultz" <john.stultz@linaro.org>, "Daniel Vetter" <daniel@ffwll.ch>, "Sumit Semwal" <sumit.semwal@linaro.org>, "Masanari Iida" <standby24x7@gmail.com>, "Daeseok Youn" <daeseok.youn@gmail.com>, "Maarten Lankhorst" <maarten.lankhorst@canonical.com>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, "Yann Droneaud" <ydroneaud@opteya.com>
> Betreff: Re: [PATCH 1/1] staging : android : sync : get_unused_fd
>
> Hi,
> 
> Le samedi 27 septembre 2014 à 10:52 +0200, Heinrich Schuchardt a écrit :
> > sync.h recommends to use get_unused_fd which does not set
> > O_CLOEXEC while the rest of the android tree uses
> > get_unused_fd_flags and sets O_CLOEXEC.
> > 
> > The patch adjust the comment.
> > 
> 
> I'd like to add this patch to my patchset which try to remove
> get_unused_fd() in favor of get_unused_fd_flags():
> 
> http://lkml.kernel.org/r/cover.1411562410.git.ydroneaud@opteya.com
> 
> But having O_CLOEXEC is welcome but not strictly needed,
> so I think the patch should be reworked to not require O_CLOEXEC.

All calls to get_unused_fd_flags() in directory drivers/staging/android
use O_CLOEXEC. That is why I guess it is correct to put it into the
sync.h comment too.

Your patch set inspired me to look for further usages of get_unused_fd().
But I think the patch below is valid even if get_unused_fd() should not
be removed from the kernel.

Best regards

Heinrich 

> 
> > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > ---
> >  drivers/staging/android/sync.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
> > index 66b0f43..a21b79f 100644
> > --- a/drivers/staging/android/sync.h
> > +++ b/drivers/staging/android/sync.h
> > @@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence);
> >   * @fence:	fence to install
> >   * @fd:		file descriptor in which to install the fence
> >   *
> > - * Installs @fence into @fd.  @fd's should be acquired through get_unused_fd().
> > + * Installs @fence into @fd.  @fd's should be acquired through
> > + * get_unused_fd_flags(O_CLOEXEC).
> 
> I think it will be better to have something like:
> 
>     get_unused_fd_flags(flags), with flags either provided by userspace
>     or set to O_CLOEXEC.
> 
> 
> >   */
> >  void sync_fence_install(struct sync_fence *fence, int fd);
> >  
> 
> Regards.
> 
> -- 
> Yann Droneaud
> OPTEYA
> 
> 
>

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

* Re: Aw: Re: [PATCH 1/1] staging : android : sync : get_unused_fd
  2014-09-29 21:19   ` Aw: " Heinrich Schuchardt
@ 2014-09-30 17:15     ` Yann Droneaud
  0 siblings, 0 replies; 4+ messages in thread
From: Yann Droneaud @ 2014-09-30 17:15 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Greg Kroah-Hartman, Erik Gilling, Colin Cross, John Stultz,
	Daniel Vetter, Sumit Semwal, Masanari Iida, Daeseok Youn,
	Maarten Lankhorst, devel, linux-kernel, Yann Droneaud

Hi,

Le lundi 29 septembre 2014 à 23:19 +0200, Heinrich Schuchardt a écrit :
> > Gesendet: Montag, 29. September 2014 um 20:03 Uhr
> > Von: "Yann Droneaud" <ydroneaud@opteya.com>
> > An: "Heinrich Schuchardt" <xypron.glpk@gmx.de>
> > Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Colin Cross" <ccross@android.com>, "John Stultz" <john.stultz@linaro.org>, "Daniel Vetter" <daniel@ffwll.ch>, "Sumit Semwal" <sumit.semwal@linaro.org>, "Masanari Iida" <standby24x7@gmail.com>, "Daeseok Youn" <daeseok.youn@gmail.com>, "Maarten Lankhorst" <maarten.lankhorst@canonical.com>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, "Yann Droneaud" <ydroneaud@opteya.com>
> > Betreff: Re: [PATCH 1/1] staging : android : sync : get_unused_fd
> >
> > Hi,
> > 
> > Le samedi 27 septembre 2014 à 10:52 +0200, Heinrich Schuchardt a écrit :
> > > sync.h recommends to use get_unused_fd which does not set
> > > O_CLOEXEC while the rest of the android tree uses
> > > get_unused_fd_flags and sets O_CLOEXEC.
> > > 
> > > The patch adjust the comment.
> > > 
> > 
> > I'd like to add this patch to my patchset which try to remove
> > get_unused_fd() in favor of get_unused_fd_flags():
> > 
> > http://lkml.kernel.org/r/cover.1411562410.git.ydroneaud@opteya.com
> > 
> > But having O_CLOEXEC is welcome but not strictly needed,
> > so I think the patch should be reworked to not require O_CLOEXEC.
> 
> All calls to get_unused_fd_flags() in directory drivers/staging/android
> use O_CLOEXEC. That is why I guess it is correct to put it into the
> sync.h comment too.
> 

They use O_CLOEXEC because I've suggested it should be a good thing to
do it if possible, and Erik Gilling suggested it would be possible.

So please add a mention to commit 9c6cd3b39048 ('android/sync: use 
get_unused_fd_flags(O_CLOEXEC) instead o get_unused_fd()') and commit 
45acea57335e ('android/sw_sync: use get_unused_fd_flags(O_CLOEXEC) 
instead of get_unused_fd()').

> Your patch set inspired me to look for further usages of get_unused_fd().

I haven't grep through the source nor the documentation, so I failed to
notice this comment. I'm glad you've found it and going to fix it.

> But I think the patch below is valid even if get_unused_fd() should not
> be removed from the kernel.
> 

Getting a file descriptor with get_unused_fd_flags(O_CLOEXEC) is not
required to use sync_fence_install(): O_CLOEXEC is only one of the two
values having a meaning for get_unused_fd_flags(), and
sync_fence_install() doesn't care about it.

So I still prefer you use an alternate wording for the comment, so that
it match the behavor of sync_fence_install() and provide advice
regarding O_CLOEXEC usage.

Regards.


> Best regards
> 
> Heinrich 
> 
> > 
> > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > > ---
> > >  drivers/staging/android/sync.h | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
> > > index 66b0f43..a21b79f 100644
> > > --- a/drivers/staging/android/sync.h
> > > +++ b/drivers/staging/android/sync.h
> > > @@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence);
> > >   * @fence:	fence to install
> > >   * @fd:		file descriptor in which to install the fence
> > >   *
> > > - * Installs @fence into @fd.  @fd's should be acquired through get_unused_fd().
> > > + * Installs @fence into @fd.  @fd's should be acquired through
> > > + * get_unused_fd_flags(O_CLOEXEC).
> > 
> > I think it will be better to have something like:
> > 
> >     get_unused_fd_flags(flags), with flags either provided by userspace
> >     or set to O_CLOEXEC.
> > 
> > 
> > >   */
> > >  void sync_fence_install(struct sync_fence *fence, int fd);
> > >  

-- 
Yann Droneaud
OPTEYA



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

end of thread, other threads:[~2014-09-30 19:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-27  8:52 [PATCH 1/1] staging : android : sync : get_unused_fd Heinrich Schuchardt
2014-09-29 18:03 ` Yann Droneaud
2014-09-29 21:19   ` Aw: " Heinrich Schuchardt
2014-09-30 17:15     ` Yann Droneaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®