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

From: Andy Shevchenko
Date: Tue Dec 19 2023 - 10:51:47 EST


On Mon, Dec 18, 2023 at 06:44:47PM +0000, 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
> 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 dependancy on REPEAT_BYTE explicit allows for later
> improvements in the lib/string.c inclusion list.

...

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

Expected is to get rid of kernel.h completely.
For instance, in arch/arm/include/asm/word-at-a-time.h case this
should become:

#include <linux/bitops.h>
#include <linux/wordpart.h>

(Briefly looking the same is for include/asm-generic/word-at-a-time.h)

And so on...

...

> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -39,13 +39,6 @@

> -/**
> - * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value
> - * @x: value to repeat
> - *
> - * NOTE: @x is not checked for > 0xff; larger values produce odd results.
> - */
> -#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))

Okay, we don't back include because we changing all the users at once.

...

> +++ b/include/linux/wordpart.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0 */

> +/*
> + * Copyright (C) 2023 Google LLC <tanzirh@xxxxxxxxxx>
> + */

Can be on a single line.

Is it? Personally I skip this from the split headers, but I'm not your lawyer.

--
With Best Regards,
Andy Shevchenko