public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH v1 1/1] kernel.h: Drop inclusion in bitmap.h
Date: Sat, 27 Mar 2021 14:32:14 -0700	[thread overview]
Message-ID: <20210327213214.GA133098@yury-ThinkPad> (raw)
In-Reply-To: <20210326170347.37441-1-andriy.shevchenko@linux.intel.com>

On Fri, Mar 26, 2021 at 07:03:47PM +0200, Andy Shevchenko wrote:
> The bitmap.h header is used in a lot of code around the kernel.
> Besides that it includes kernel.h which sometimes makes a loop.
> 
> Break the loop by introducing align.h, including it in kernel.h
> and bitmap.h followed by replacing kernel.h with limits.h.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Can you give an example of such dependency?

Nevertheless,

Acked-by: Yury Norov <yury.norov@gmail.com>

> ---
>  include/linux/align.h  | 15 +++++++++++++++
>  include/linux/bitmap.h |  3 ++-
>  include/linux/kernel.h |  9 +--------
>  3 files changed, 18 insertions(+), 9 deletions(-)
>  create mode 100644 include/linux/align.h
> 
> diff --git a/include/linux/align.h b/include/linux/align.h
> new file mode 100644
> index 000000000000..2b4acec7b95a
> --- /dev/null
> +++ b/include/linux/align.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_ALIGN_H
> +#define _LINUX_ALIGN_H
> +
> +#include <linux/const.h>
> +
> +/* @a is a power of 2 value */
> +#define ALIGN(x, a)		__ALIGN_KERNEL((x), (a))
> +#define ALIGN_DOWN(x, a)	__ALIGN_KERNEL((x) - ((a) - 1), (a))
> +#define __ALIGN_MASK(x, mask)	__ALIGN_KERNEL_MASK((x), (mask))
> +#define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
> +#define PTR_ALIGN_DOWN(p, a)	((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
> +#define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
> +
> +#endif	/* _LINUX_ALIGN_H */
> diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
> index 70a932470b2d..6cbcd9d9edd2 100644
> --- a/include/linux/bitmap.h
> +++ b/include/linux/bitmap.h
> @@ -4,10 +4,11 @@
>  
>  #ifndef __ASSEMBLY__
>  
> +#include <linux/align.h>
>  #include <linux/types.h>
>  #include <linux/bitops.h>
> +#include <linux/limits.h>
>  #include <linux/string.h>
> -#include <linux/kernel.h>
>  
>  /*
>   * bitmaps provide bit arrays that consume one or more unsigned
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 5b7ed6dc99ac..09035ac67d4b 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_KERNEL_H
>  
>  #include <stdarg.h>
> +#include <linux/align.h>
>  #include <linux/limits.h>
>  #include <linux/linkage.h>
>  #include <linux/stddef.h>
> @@ -30,14 +31,6 @@
>   */
>  #define REPEAT_BYTE(x)	((~0ul / 0xff) * (x))
>  
> -/* @a is a power of 2 value */
> -#define ALIGN(x, a)		__ALIGN_KERNEL((x), (a))
> -#define ALIGN_DOWN(x, a)	__ALIGN_KERNEL((x) - ((a) - 1), (a))
> -#define __ALIGN_MASK(x, mask)	__ALIGN_KERNEL_MASK((x), (mask))
> -#define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
> -#define PTR_ALIGN_DOWN(p, a)	((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
> -#define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
> -
>  /* generic data direction definitions */
>  #define READ			0
>  #define WRITE			1
> -- 
> 2.30.2

  reply	other threads:[~2021-03-27 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 17:03 [PATCH v1 1/1] kernel.h: Drop inclusion in bitmap.h Andy Shevchenko
2021-03-27 21:32 ` Yury Norov [this message]
2021-03-27 22:18 ` Al Viro
2021-03-27 22:38   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210327213214.GA133098@yury-ThinkPad \
    --to=yury.norov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox