refcount: trim headers
diff mbox series

Message ID 20180313193410.GA12260@avx2
State New, archived
Headers show
Series
  • refcount: trim headers
Related show

Commit Message

Alexey Dobriyan March 13, 2018, 7:34 p.m. UTC
kernel.h is not needed, but compiler.h is.

mutex.h is not needed only a forward declaration.

spinlock.h is not needed, spinlock_types.h is enough.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/linux/refcount.h |    7 ++++---
 lib/refcount.c           |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Ingo Molnar March 31, 2018, 8:36 a.m. UTC | #1
* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> kernel.h is not needed, but compiler.h is.
> 
> mutex.h is not needed only a forward declaration.
> 
> spinlock.h is not needed, spinlock_types.h is enough.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  include/linux/refcount.h |    7 ++++---
>  lib/refcount.c           |    2 ++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> --- a/include/linux/refcount.h
> +++ b/include/linux/refcount.h
> @@ -3,9 +3,10 @@
>  #define _LINUX_REFCOUNT_H
>  
>  #include <linux/atomic.h>
> -#include <linux/mutex.h>
> -#include <linux/spinlock.h>
> -#include <linux/kernel.h>
> +#include <linux/compiler.h>
> +#include <linux/spinlock_types.h>
> +
> +struct mutex;
>  
>  /**
>   * struct refcount_t - variant of atomic_t specialized for reference counts
> --- a/lib/refcount.c
> +++ b/lib/refcount.c
> @@ -35,7 +35,9 @@
>   *
>   */
>  
> +#include <linux/mutex.h>
>  #include <linux/refcount.h>
> +#include <linux/spinlock.h>
>  #include <linux/bug.h>

Doesn't build on x86-64 defconfig...

Thanks,

	Ingo
Alexey Dobriyan March 31, 2018, 1:39 p.m. UTC | #2
On Sat, Mar 31, 2018 at 10:36:32AM +0200, Ingo Molnar wrote:
> > --- a/include/linux/refcount.h
> > +++ b/include/linux/refcount.h
> >  #include <linux/atomic.h>
> > -#include <linux/mutex.h>
> > -#include <linux/spinlock.h>
> > -#include <linux/kernel.h>
> > +#include <linux/compiler.h>
> > +#include <linux/spinlock_types.h>
> > +
> > +struct mutex;

> Doesn't build on x86-64 defconfig...

Yeah, it doesn't :-(
Is this going to go through -tip?
Or I'll build test over both trees.
Ingo Molnar March 31, 2018, 6:46 p.m. UTC | #3
* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Sat, Mar 31, 2018 at 10:36:32AM +0200, Ingo Molnar wrote:
> > > --- a/include/linux/refcount.h
> > > +++ b/include/linux/refcount.h
> > >  #include <linux/atomic.h>
> > > -#include <linux/mutex.h>
> > > -#include <linux/spinlock.h>
> > > -#include <linux/kernel.h>
> > > +#include <linux/compiler.h>
> > > +#include <linux/spinlock_types.h>
> > > +
> > > +struct mutex;
> 
> > Doesn't build on x86-64 defconfig...
> 
> Yeah, it doesn't :-(
> Is this going to go through -tip?
> Or I'll build test over both trees.

Yeah, refcount changes go through the locking tree, so testing it against -tip 
would be useful.

Thanks,

	Ingo

Patch
diff mbox series

--- a/include/linux/refcount.h
+++ b/include/linux/refcount.h
@@ -3,9 +3,10 @@ 
 #define _LINUX_REFCOUNT_H
 
 #include <linux/atomic.h>
-#include <linux/mutex.h>
-#include <linux/spinlock.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/spinlock_types.h>
+
+struct mutex;
 
 /**
  * struct refcount_t - variant of atomic_t specialized for reference counts
--- a/lib/refcount.c
+++ b/lib/refcount.c
@@ -35,7 +35,9 @@ 
  *
  */
 
+#include <linux/mutex.h>
 #include <linux/refcount.h>
+#include <linux/spinlock.h>
 #include <linux/bug.h>
 
 #ifdef CONFIG_REFCOUNT_FULL