Commit 15618b35 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: get the rid of vchiq_static_assert

Use static_assert from the kernel instead of opencode it.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1622735405-9980-6-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e63becb7
...@@ -139,7 +139,7 @@ static const char *const ioctl_names[] = { ...@@ -139,7 +139,7 @@ static const char *const ioctl_names[] = {
"CLOSE_DELIVERED" "CLOSE_DELIVERED"
}; };
vchiq_static_assert(ARRAY_SIZE(ioctl_names) == (VCHIQ_IOC_MAX + 1)); static_assert(ARRAY_SIZE(ioctl_names) == (VCHIQ_IOC_MAX + 1));
static enum vchiq_status static enum vchiq_status
vchiq_blocking_bulk_transfer(unsigned int handle, void *data, vchiq_blocking_bulk_transfer(unsigned int handle, void *data,
......
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
((unsigned short)msgid & 0xfff) ((unsigned short)msgid & 0xfff)
/* Ensure the fields are wide enough */ /* Ensure the fields are wide enough */
vchiq_static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX)) static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX))
== 0); == 0);
vchiq_static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0); static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0);
vchiq_static_assert((unsigned int)VCHIQ_PORT_MAX < static_assert((unsigned int)VCHIQ_PORT_MAX <
(unsigned int)VCHIQ_PORT_FREE); (unsigned int)VCHIQ_PORT_FREE);
#define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0) #define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0)
...@@ -123,8 +123,8 @@ enum { ...@@ -123,8 +123,8 @@ enum {
}; };
/* we require this for consistency between endpoints */ /* we require this for consistency between endpoints */
vchiq_static_assert(sizeof(struct vchiq_header) == 8); static_assert(sizeof(struct vchiq_header) == 8);
vchiq_static_assert(VCHIQ_VERSION >= VCHIQ_VERSION_MIN); static_assert(VCHIQ_VERSION >= VCHIQ_VERSION_MIN);
static inline void check_sizes(void) static inline void check_sizes(void)
{ {
......
...@@ -64,11 +64,6 @@ ...@@ -64,11 +64,6 @@
#define vchiq_loud_error(...) \ #define vchiq_loud_error(...) \
vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__) vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__)
#ifndef vchiq_static_assert
#define vchiq_static_assert(cond) __attribute__((unused)) \
extern int vchiq_static_assert[(cond) ? 1 : -1]
#endif
#define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1) #define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1)
#define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1) #define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1)
#define VCHIQ_SLOT_ZERO_SLOTS DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \ #define VCHIQ_SLOT_ZERO_SLOTS DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \
...@@ -82,7 +77,7 @@ ...@@ -82,7 +77,7 @@
typedef uint32_t BITSET_T; typedef uint32_t BITSET_T;
vchiq_static_assert((sizeof(BITSET_T) * 8) == 32); static_assert((sizeof(BITSET_T) * 8) == 32);
#define BITSET_SIZE(b) ((b + 31) >> 5) #define BITSET_SIZE(b) ((b + 31) >> 5)
#define BITSET_WORD(b) (b >> 5) #define BITSET_WORD(b) (b >> 5)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment