lkml.org 
[lkml]   [2021]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 16/20] linux/compiler.h, linux/array_size.h: Move __must_be_array() into <linux/array_size.h>
Date
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
drivers/gpu/drm/i915/i915_utils.h | 3 +++
drivers/net/can/usb/etas_es58x/es58x_core.h | 3 +++
include/linux/array_size.h | 6 +++++-
include/linux/compiler.h | 3 ---
include/linux/overflow.h | 3 +++
5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..f6fc1c72dfa7 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -25,6 +25,8 @@
#ifndef __I915_UTILS_H
#define __I915_UTILS_H

+
+#include <linux/array_size.h>
#include <linux/list.h>
#include <linux/overflow.h>
#include <linux/sched.h>
@@ -32,6 +34,7 @@
#include <linux/workqueue.h>
#include <linux/sched/clock.h>

+
struct drm_i915_private;
struct timer_list;

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h
index 826a15871573..a18f4215aeef 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.h
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.h
@@ -12,6 +12,8 @@
#ifndef __ES58X_COMMON_H__
#define __ES58X_COMMON_H__

+
+#include <linux/array_size.h>
#include <linux/types.h>
#include <linux/usb.h>
#include <linux/netdevice.h>
@@ -21,6 +23,7 @@
#include "es581_4.h"
#include "es58x_fd.h"

+
/* Driver constants */
#define ES58X_RX_URBS_MAX 5 /* Empirical value */
#define ES58X_TX_URBS_MAX 6 /* Empirical value */
diff --git a/include/linux/array_size.h b/include/linux/array_size.h
index cba90f2248ef..c2b4fddba564 100644
--- a/include/linux/array_size.h
+++ b/include/linux/array_size.h
@@ -2,9 +2,13 @@
#ifndef _LINUX_ARRAY_SIZE_H
#define _LINUX_ARRAY_SIZE_H

-#include <linux/compiler.h>
+#include <linux/must_be.h>
+#include <linux/same_type.h>


+/* &a[0] degrades to a pointer: a different type from an array */
+#define __must_be_array(a) __must_be(!__same_type((a), &(a)[0]))
+
/**
* ARRAY_SIZE - get the number of elements in array @a
* @a: array to be sized
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 64d99335874d..9286310d4a8b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -254,9 +254,6 @@ static inline void *offset_to_ptr(const int *off)

#endif /* __ASSEMBLY__ */

-/* &a[0] degrades to a pointer: a different type from an array */
-#define __must_be_array(a) __must_be(!__same_type((a), &(a)[0]))
-
/*
* This is needed in functions which generate the stack canary, see
* arch/x86/kernel/smpboot.c::start_secondary() for an example.
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 4669632bd72b..12c6f736bcd0 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -2,9 +2,12 @@
#ifndef __LINUX_OVERFLOW_H
#define __LINUX_OVERFLOW_H

+
+#include <linux/array_size.h>
#include <linux/compiler.h>
#include <linux/limits.h>

+
/*
* We need to compute the minimum and maximum values representable in a given
* type. These macros may also be useful elsewhere. It would seem more obvious
--
2.33.1
\
 
 \ /
  Last update: 2021-11-20 14:03    [W:0.352 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site