2014-06-27 20:33:32

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH 1/1] drivers/base/dma-buf.c: replace dma_buf_uninit_debugfs by debugfs_remove_recursive

null test before debugfs_remove_recursive is not needed so one line function
dma_buf_uninit_debugfs can be removed.

This patch calls debugfs_remove_recursive under CONFIG_DEBUG_FS

Cc: Sumit Semwal <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: [email protected]
Signed-off-by: Fabian Frederick <[email protected]>
---

This is untested.

drivers/base/dma-buf.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
index 840c7fa..184c0cb 100644
--- a/drivers/base/dma-buf.c
+++ b/drivers/base/dma-buf.c
@@ -701,12 +701,6 @@ static int dma_buf_init_debugfs(void)
return err;
}

-static void dma_buf_uninit_debugfs(void)
-{
- if (dma_buf_debugfs_dir)
- debugfs_remove_recursive(dma_buf_debugfs_dir);
-}
-
int dma_buf_debugfs_create_file(const char *name,
int (*write)(struct seq_file *))
{
@@ -722,9 +716,6 @@ static inline int dma_buf_init_debugfs(void)
{
return 0;
}
-static inline void dma_buf_uninit_debugfs(void)
-{
-}
#endif

static int __init dma_buf_init(void)
@@ -738,6 +729,8 @@ subsys_initcall(dma_buf_init);

static void __exit dma_buf_deinit(void)
{
- dma_buf_uninit_debugfs();
+#ifdef CONFIG_DEBUG_FS
+ debugfs_remove_recursive(dma_buf_debugfs_dir);
+#endif
}
__exitcall(dma_buf_deinit);
--
1.8.4.5


2014-07-10 00:30:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/1] drivers/base/dma-buf.c: replace dma_buf_uninit_debugfs by debugfs_remove_recursive

On Fri, Jun 27, 2014 at 10:32:10PM +0200, Fabian Frederick wrote:
> null test before debugfs_remove_recursive is not needed so one line function
> dma_buf_uninit_debugfs can be removed.
>
> This patch calls debugfs_remove_recursive under CONFIG_DEBUG_FS
>
> Cc: Sumit Semwal <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: [email protected]
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
>
> This is untested.
>
> drivers/base/dma-buf.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
> index 840c7fa..184c0cb 100644
> --- a/drivers/base/dma-buf.c
> +++ b/drivers/base/dma-buf.c
> @@ -701,12 +701,6 @@ static int dma_buf_init_debugfs(void)
> return err;
> }
>
> -static void dma_buf_uninit_debugfs(void)
> -{
> - if (dma_buf_debugfs_dir)
> - debugfs_remove_recursive(dma_buf_debugfs_dir);
> -}
> -
> int dma_buf_debugfs_create_file(const char *name,
> int (*write)(struct seq_file *))
> {
> @@ -722,9 +716,6 @@ static inline int dma_buf_init_debugfs(void)
> {
> return 0;
> }
> -static inline void dma_buf_uninit_debugfs(void)
> -{
> -}
> #endif
>
> static int __init dma_buf_init(void)
> @@ -738,6 +729,8 @@ subsys_initcall(dma_buf_init);
>
> static void __exit dma_buf_deinit(void)
> {
> - dma_buf_uninit_debugfs();
> +#ifdef CONFIG_DEBUG_FS
> + debugfs_remove_recursive(dma_buf_debugfs_dir);
> +#endif

That ifdef should not be needed at all, right? No ifdefs should be
needed for debugfs code, if it is written correctly :)

thanks,

greg k-h

2014-07-12 12:26:42

by Fabian Frédérick

[permalink] [raw]
Subject: Re: [PATCH 1/1] drivers/base/dma-buf.c: replace dma_buf_uninit_debugfs by debugfs_remove_recursive



> On 10 July 2014 at 02:34 Greg Kroah-Hartman <[email protected]>
> wrote:
>
>
> On Fri, Jun 27, 2014 at 10:32:10PM +0200, Fabian Frederick wrote:
> > null test before debugfs_remove_recursive is not needed so one line function
> > dma_buf_uninit_debugfs can be removed.
> >
> > This patch calls debugfs_remove_recursive under CONFIG_DEBUG_FS
> >
> > Cc: Sumit Semwal <[email protected]>
> > Cc: Greg Kroah-Hartman <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Fabian Frederick <[email protected]>
> > ---
> >
> > This is untested.
> >
> >  drivers/base/dma-buf.c | 13 +++----------
> >  1 file changed, 3 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
> > index 840c7fa..184c0cb 100644
> > --- a/drivers/base/dma-buf.c
> > +++ b/drivers/base/dma-buf.c
> > @@ -701,12 +701,6 @@ static int dma_buf_init_debugfs(void)
> >     return err;
> >  }
> > 
> > -static void dma_buf_uninit_debugfs(void)
> > -{
> > -   if (dma_buf_debugfs_dir)
> > -           debugfs_remove_recursive(dma_buf_debugfs_dir);
> > -}
> > -
> >  int dma_buf_debugfs_create_file(const char *name,
> >                             int (*write)(struct seq_file *))
> >  {
> > @@ -722,9 +716,6 @@ static inline int dma_buf_init_debugfs(void)
> >  {
> >     return 0;
> >  }
> > -static inline void dma_buf_uninit_debugfs(void)
> > -{
> > -}
> >  #endif
> > 
> >  static int __init dma_buf_init(void)
> > @@ -738,6 +729,8 @@ subsys_initcall(dma_buf_init);
> > 
> >  static void __exit dma_buf_deinit(void)
> >  {
> > -   dma_buf_uninit_debugfs();
> > +#ifdef CONFIG_DEBUG_FS
> > +   debugfs_remove_recursive(dma_buf_debugfs_dir);
> > +#endif
>
> That ifdef should not be needed at all, right?  No ifdefs should be
> needed for debugfs code, if it is written correctly :)
>

Hello Greg,

        Current dma_buf_init_debugfs and dma_buf_init_uninit_debugfs and
related functions in drivers/base/dma-buf.c are only defined
under #ifdef CONFIG_DEBUG_FS ; reason for that #ifdef in the patch.
I'll send you a fixed version.

Thanks,
Fabian

> thanks,
>
> greg k-h