include/*.h: uncrustify

This commit is contained in:
Marc Kleine-Budde 2024-06-04 15:36:22 +02:00
parent c2a913c44c
commit 98b95a9baf
5 changed files with 69 additions and 69 deletions

View File

@ -53,14 +53,14 @@
#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x))
#define WRITE_ONCE(x,v) \
do { \
barrier(); \
ACCESS_ONCE(x) = (v); \
barrier(); \
} while (0)
do { \
barrier(); \
ACCESS_ONCE(x) = (v); \
barrier(); \
} while (0)
#define READ_ONCE(x) \
({ \
({ \
__typeof(x) __var = ({ \
barrier(); \
ACCESS_ONCE(x); \
@ -77,21 +77,21 @@
#define sizeof_field(_s, _m) sizeof(((_s *)0)->_m)
#define container_of(ptr, type, member) \
({ \
({ \
__typeof(((type *)0)->member) *_p = (ptr); \
(type *)((char *)_p - offsetof(type, member)); \
})
#define struct_size(ptr, field, num) \
(offsetof(__typeof(*(ptr)), field) + sizeof((ptr)->field[0]) * (num))
(offsetof(__typeof(*(ptr)), field) + sizeof((ptr)->field[0]) * (num))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define DECLARE_FLEX_ARRAY(_t, _n) \
struct { \
struct { } __dummy_ ## _n; \
_t _n[0]; \
}
struct { \
struct { } __dummy_ ## _n; \
_t _n[0]; \
}
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))

View File

@ -41,7 +41,7 @@
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
struct list_head name = LIST_HEAD_INIT(name)
struct list_head {
struct list_head *next;
@ -129,69 +129,69 @@ list_del_init(struct list_head *entry)
#define list_entry(ptr, type, field) container_of(ptr, type, field)
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
list_entry((ptr)->next, type, member)
#define list_last_entry(ptr, type, member) \
list_entry((ptr)->prev, type, member)
list_entry((ptr)->prev, type, member)
#define list_first_entry_or_null(ptr, type, member) \
(!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
(!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
#define list_next_entry(ptr, member) \
list_entry(((ptr)->member.next), typeof(*(ptr)), member)
list_entry(((ptr)->member.next), typeof(*(ptr)), member)
#define list_safe_reset_next(ptr, n, member) \
(n) = list_next_entry(ptr, member)
(n) = list_next_entry(ptr, member)
#define list_prev_entry(ptr, member) \
list_entry(((ptr)->member.prev), typeof(*(ptr)), member)
list_entry(((ptr)->member.prev), typeof(*(ptr)), member)
#define list_for_each(p, head) \
for (p = (head)->next; p != (head); p = (p)->next)
for (p = (head)->next; p != (head); p = (p)->next)
#define list_for_each_safe(p, n, head) \
for (p = (head)->next, n = (p)->next; p != (head); p = n, n = (p)->next)
for (p = (head)->next, n = (p)->next; p != (head); p = n, n = (p)->next)
#define list_for_each_entry(p, h, field) \
for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.next, typeof(*p), field))
for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.next, typeof(*p), field))
#define list_for_each_entry_safe(p, n, h, field) \
for (p = list_entry((h)->next, typeof(*p), field), \
n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h); \
p = n, n = list_entry(n->field.next, typeof(*n), field))
for (p = list_entry((h)->next, typeof(*p), field), \
n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h); \
p = n, n = list_entry(n->field.next, typeof(*n), field))
#define list_for_each_entry_from(p, h, field) \
for ( ; &(p)->field != (h); \
p = list_entry((p)->field.next, typeof(*p), field))
for ( ; &(p)->field != (h); \
p = list_entry((p)->field.next, typeof(*p), field))
#define list_for_each_entry_continue(p, h, field) \
for (p = list_next_entry((p), field); &(p)->field != (h); \
p = list_next_entry((p), field))
for (p = list_next_entry((p), field); &(p)->field != (h); \
p = list_next_entry((p), field))
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry((pos)->member.next, typeof(*pos), member); \
&(pos)->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
for (n = list_entry((pos)->member.next, typeof(*pos), member); \
&(pos)->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
#define list_for_each_entry_reverse(p, h, field) \
for (p = list_entry((h)->prev, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.prev, typeof(*p), field))
for (p = list_entry((h)->prev, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.prev, typeof(*p), field))
#define list_for_each_entry_safe_reverse(p, n, h, field) \
for (p = list_entry((h)->prev, typeof(*p), field), \
n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \
p = n, n = list_entry(n->field.prev, typeof(*n), field))
for (p = list_entry((h)->prev, typeof(*p), field), \
n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \
p = n, n = list_entry(n->field.prev, typeof(*n), field))
#define list_for_each_entry_continue_reverse(p, h, field) \
for (p = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.prev, typeof(*p), field))
for (p = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \
p = list_entry((p)->field.prev, typeof(*p), field))
#define list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = (p)->prev)
#define list_for_each_entry_from_reverse(p, h, field) \
for (; &p->field != (h); \
p = list_prev_entry(p, field))
for (; &p->field != (h); \
p = list_prev_entry(p, field))
static inline void
list_add(struct list_head *new, struct list_head *head)
@ -303,10 +303,10 @@ struct hlist_node {
#define HLIST_HEAD(name) struct hlist_head name = HLIST_HEAD_INIT
#define INIT_HLIST_HEAD(head) (head)->first = NULL
#define INIT_HLIST_NODE(node) \
do { \
(node)->next = NULL; \
(node)->pprev = NULL; \
} while (0)
do { \
(node)->next = NULL; \
(node)->pprev = NULL; \
} while (0)
static inline int
hlist_unhashed(const struct hlist_node *h)
@ -449,32 +449,32 @@ list_add_tail_locked(struct list_head *entry, struct list_head *head)
#define hlist_entry(ptr, type, field) container_of(ptr, type, field)
#define hlist_for_each(p, head) \
for (p = (head)->first; p; p = (p)->next)
for (p = (head)->first; p; p = (p)->next)
#define hlist_for_each_safe(p, n, head) \
for (p = (head)->first; p && ({ n = (p)->next; 1; }); p = n)
for (p = (head)->first; p && ({ n = (p)->next; 1; }); p = n)
#define hlist_entry_safe(ptr, type, member) \
((ptr) ? hlist_entry(ptr, type, member) : NULL)
((ptr) ? hlist_entry(ptr, type, member) : NULL)
#define hlist_for_each_entry(pos, head, member) \
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
pos; \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
pos; \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
#define hlist_for_each_entry_continue(pos, member) \
for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member); \
(pos); \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member); \
(pos); \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
#define hlist_for_each_entry_from(pos, member) \
for (; (pos); \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
for (; (pos); \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
#define hlist_for_each_entry_safe(pos, n, head, member) \
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
(pos) && ({ n = (pos)->member.next; 1; }); \
pos = hlist_entry_safe(n, typeof(*(pos)), member))
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
(pos) && ({ n = (pos)->member.next; 1; }); \
pos = hlist_entry_safe(n, typeof(*(pos)), member))
extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv,
struct list_head *a, struct list_head *b));

View File

@ -40,11 +40,11 @@ THE SOFTWARE.
/* Define these here so they can be referenced in other files */
#define GS_CAN_EP0_BUF_SIZE \
max5(sizeof(struct gs_host_config), \
sizeof(struct gs_device_bittiming), \
sizeof(struct gs_device_mode), \
sizeof(struct gs_identify_mode), \
sizeof(struct gs_device_termination_state))
max5(sizeof(struct gs_host_config), \
sizeof(struct gs_device_bittiming), \
sizeof(struct gs_device_mode), \
sizeof(struct gs_identify_mode), \
sizeof(struct gs_device_termination_state))
#ifdef CONFIG_CANFD
#define CAN_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
#else

View File

@ -88,9 +88,9 @@ static inline void restore_irq(bool was_enabled)
*
*/
#define assert_basic(exp) \
if (exp) { \
} else \
assert_failed()
if (exp) { \
} else \
assert_failed()
/** halt / set core to debug state with BKPT.
*

View File

@ -23,7 +23,7 @@
* ENABLED: Z_IS_ENABLED2(_XXXX1)
* DISABLED Z_IS_ENABLED2(_XXXX)
*/
#define Z_IS_ENABLED1(config_macro) Z_IS_ENABLED2(_XXXX##config_macro)
#define Z_IS_ENABLED1(config_macro) Z_IS_ENABLED2(_XXXX ## config_macro)
/* Here's the core trick, we map "_XXXX1" to "_YYYY," (i.e. a string
* with a trailing comma), so it has the effect of making this a