Re: [PATCH v4 1/2] kernel.h: removed REPEAT_BYTE from kernel.h

From: Andy Shevchenko
Date: Tue Dec 19 2023 - 16:48:37 EST


On Tue, Dec 19, 2023 at 8:10 PM Tanzir Hasan <tanzirh@xxxxxxxxxx> wrote:
>
> This patch creates wordpart.h and includes it in asm/word-at-a-time.h
> for the all architectures. WORD_AT_A_TIME_CONSTANTS depends on kernel.h

for all

("all" doesn't go with article)

> because of REPEAT_BYTE. Moving this to another header and including it
> where necessary allows us to not include the bloated kernel.h. Making
> this implicit dependency on REPEAT_BYTE explicit allows for later
> improvements in the lib/string.c inclusion list.

...

> --- a/arch/arm/include/asm/word-at-a-time.h
> +++ b/arch/arm/include/asm/word-at-a-time.h

> -#include <linux/kernel.h>
> +#include <linux/wordpart.h>

No, please, read what I told you carefully.

...

> --- a/arch/x86/include/asm/word-at-a-time.h
> +++ b/arch/x86/include/asm/word-at-a-time.h
> @@ -3,6 +3,7 @@
> #define _ASM_WORD_AT_A_TIME_H
>
> #include <linux/kernel.h>

No, the macros used in this file doesn't require (after your patch)
the kernel.h, these are in particular in asm/asm.h and
asm/extable_fixup_types.h. I haven't looked at this closely to find a
common header that kinda guarantees those two to be included.
Otherwise we can use them directly.

> +#include <linux/wordpart.h>

...

> #include <linux/init.h>
> #include <linux/export.h>
> -#include <linux/kernel.h>
> +#include <linux/wordpart.h>

Try to keep it more or less ordered. At list with given context it
goes either after the slab.h or below (after those starting with 'f').

> #include <linux/slab.h>
> #include <linux/fs.h>
> #include <linux/filelock.h>

...

> --- a/include/asm-generic/word-at-a-time.h
> +++ b/include/asm-generic/word-at-a-time.h
> @@ -2,7 +2,7 @@
> #ifndef _ASM_WORD_AT_A_TIME_H
> #define _ASM_WORD_AT_A_TIME_H
>
> -#include <linux/kernel.h>
> +#include <linux/wordpart.h>
> #include <asm/byteorder.h>

Same as in the above remark, read what I said in the previous round of reviews.

--
With Best Regards,
Andy Shevchenko