2013-11-28 17:16:39

by Cristian Stoica

[permalink] [raw]
Subject: [PATCH] crypto: remove unnecessary includes

Signed-off-by: Cristian Stoica <[email protected]>
---
crypto/authenc.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/crypto/authenc.c b/crypto/authenc.c
index 1875e70..7d4bfaa 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -17,11 +17,8 @@
#include <crypto/scatterwalk.h>
#include <linux/err.h>
#include <linux/init.h>
-#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/rtnetlink.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>

typedef u8 *(*authenc_ahash_t)(struct aead_request *req, unsigned int flags);

--
1.7.11.7


2013-11-29 02:07:02

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: remove unnecessary includes

On Thu, Nov 28, 2013 at 07:16:27PM +0200, Cristian Stoica wrote:
> Signed-off-by: Cristian Stoica <[email protected]>
> ---
> crypto/authenc.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/crypto/authenc.c b/crypto/authenc.c
> index 1875e70..7d4bfaa 100644
> --- a/crypto/authenc.c
> +++ b/crypto/authenc.c
> @@ -17,11 +17,8 @@
> #include <crypto/scatterwalk.h>
> #include <linux/err.h>
> #include <linux/init.h>
> -#include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/rtnetlink.h>
> -#include <linux/slab.h>
> -#include <linux/spinlock.h>
>
> typedef u8 *(*authenc_ahash_t)(struct aead_request *req, unsigned int flags);

Why are these includes unnecessary?
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2013-11-29 08:49:46

by Cristian Stoica

[permalink] [raw]
Subject: RE: [PATCH] crypto: remove unnecessary includes

>From what I could see there is nothing from those includes that is used inside authenc.c.
The build passes without them.

Cristian S.

> > diff --git a/crypto/authenc.c b/crypto/authenc.c
> > index 1875e70..7d4bfaa 100644
> > --- a/crypto/authenc.c
> > +++ b/crypto/authenc.c
> > @@ -17,11 +17,8 @@
> > #include <crypto/scatterwalk.h>
> > #include <linux/err.h>
> > #include <linux/init.h>
> > -#include <linux/kernel.h>
> > #include <linux/module.h>
> > #include <linux/rtnetlink.h>
> > -#include <linux/slab.h>
> > -#include <linux/spinlock.h>
> >
> > typedef u8 *(*authenc_ahash_t)(struct aead_request *req, unsigned int
> flags);
>
> Why are these includes unnecessary?
> --
> Email: Herbert Xu <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2013-11-29 11:34:38

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: remove unnecessary includes

On Fri, Nov 29, 2013 at 08:49:42AM +0000, Cristian Stoica wrote:
> >From what I could see there is nothing from those includes that is used inside authenc.c.
> The build passes without them.

Just because it compiles it doesn't meant that the files you
removed are unnecessary.

The only file that is really unnecessary here is spinlock.h.

Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2013-11-29 12:07:12

by Cristian Stoica

[permalink] [raw]
Subject: RE: [PATCH] crypto: remove unnecessary includes

> On Fri, Nov 29, 2013 at 08:49:42AM +0000, Cristian Stoica wrote:
> > >From what I could see there is nothing from those includes that is
> used inside authenc.c.
> > The build passes without them.
>
> Just because it compiles it doesn't meant that the files you
> removed are unnecessary.
>
> The only file that is really unnecessary here is spinlock.h.
>
[]
OK then, but let's reverse the question. In a construct similar to authenc.c, what would be the purpose of slab.h and kernel.h?
(That leads to the next question which is - what is the purpose of those files in authenc.c?)

Thanks,
Cristian S.

2013-12-05 08:15:01

by Cristian Stoica

[permalink] [raw]
Subject: RE: [PATCH] crypto: remove unnecessary includes

Hi Herbert,

Your original response was terse and left me more puzzled. Do you have a sensible explanation why some includes should be kept in the source even they serve no purpose during the build?

Thanks,

Cristian S.



> > Just because it compiles it doesn't meant that the files you
> > removed are unnecessary.
> >
> > The only file that is really unnecessary here is spinlock.h.
> >
> []
> OK then, but let's reverse the question. In a construct similar to
> authenc.c, what would be the purpose of slab.h and kernel.h?
> (That leads to the next question which is - what is the purpose of those
> files in authenc.c?)

2013-12-05 08:22:27

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: remove unnecessary includes

On Thu, Dec 05, 2013 at 08:14:55AM +0000, Cristian Stoica wrote:
> Hi Herbert,
>
> Your original response was terse and left me more puzzled. Do you have a sensible explanation why some includes should be kept in the source even they serve no purpose during the build?

If you can't work out why authenc.c needs slab.h I don't think
you should be submitting patches removing unnecessary header
files.

Cheers,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2013-12-05 09:10:35

by Cristian Stoica

[permalink] [raw]
Subject: RE: [PATCH] crypto: remove unnecessary includes

> If you can't work out why authenc.c needs slab.h I don't think
> you should be submitting patches removing unnecessary header
> files.

[]
You left out "kernel.h".

I really hoped this would not be your answer.

Yes, I'm an ignorant and yes, I ask questions. But if all you got is this type of answer, then maybe, just maybe, you should reconsider your ivory tower position.
The point is, if it's such a simple and obvious explanation, you should have said it instead of making me feel small. If it is not, then you should fix the pool of missing comments in crypto API (or should I read the obvious code instead?).
Even Linus pointed your mistakes when it was the case - or you never make mistakes?

You tried but your answer doesn't raise to the level of "kernel-locking.tmpl" one (and yes, I do get the "why" there).
For anyone else who cares, please lift me up from my ignorance.

Cristian S.