diff mbox series

[v2,3/4] lib/rhashtable: Replace kernel.h with the necessary inclusions

Message ID 20211007095129.22037-4-andriy.shevchenko@linux.intel.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series kernel.h further split | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Andy Shevchenko Oct. 7, 2021, 9:51 a.m. UTC
When kernel.h is used in the headers it adds a lot into dependency hell,
especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/rhashtable.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Herbert Xu Oct. 7, 2021, 11:23 a.m. UTC | #1
On Thu, Oct 07, 2021 at 12:51:28PM +0300, Andy Shevchenko wrote:
> When kernel.h is used in the headers it adds a lot into dependency hell,
> especially when there are circular dependencies are involved.
> 
> Replace kernel.h inclusion with the list of what is really being used.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  lib/rhashtable.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index a422c7dd9126..01502cf77564 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -12,9 +12,13 @@
>   */
>  
>  #include <linux/atomic.h>
> +#include <linux/bit_spinlock.h>
>  #include <linux/container_of.h>
> -#include <linux/kernel.h>
> +#include <linux/err.h>
> +#include <linux/export.h>
>  #include <linux/init.h>
> +#include <linux/jhash.h>
> +#include <linux/lockdep.h>
>  #include <linux/log2.h>
>  #include <linux/sched.h>
>  #include <linux/rculist.h>

Nack.  I can see the benefits of splitting things out of kernel.h
but there is no reason to add crap to end users like rhashtable.c.

Thanks,
Andy Shevchenko Oct. 7, 2021, 11:44 a.m. UTC | #2
On Thu, Oct 07, 2021 at 07:23:28PM +0800, Herbert Xu wrote:
> On Thu, Oct 07, 2021 at 12:51:28PM +0300, Andy Shevchenko wrote:
> > When kernel.h is used in the headers it adds a lot into dependency hell,
> > especially when there are circular dependencies are involved.

> > Replace kernel.h inclusion with the list of what is really being used.

> Nack.  I can see the benefits of splitting things out of kernel.h
> but there is no reason to add crap to end users like rhashtable.c.

Crap is in the kernel.h. Could you elaborate how making a proper list
of the inclusions is a crap?
Herbert Xu Oct. 8, 2021, 2:18 a.m. UTC | #3
On Thu, Oct 07, 2021 at 02:44:41PM +0300, Andy Shevchenko wrote:
>
> Crap is in the kernel.h. Could you elaborate how making a proper list
> of the inclusions is a crap?

Unless you're planning on not including all those header files from
kernel.h, then adding them all to an end node like rhashtable.c is
just a waste of time.

You should be targetting other header files and not c files.

Thanks,
diff mbox series

Patch

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a422c7dd9126..01502cf77564 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -12,9 +12,13 @@ 
  */
 
 #include <linux/atomic.h>
+#include <linux/bit_spinlock.h>
 #include <linux/container_of.h>
-#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/export.h>
 #include <linux/init.h>
+#include <linux/jhash.h>
+#include <linux/lockdep.h>
 #include <linux/log2.h>
 #include <linux/sched.h>
 #include <linux/rculist.h>