We have a single _always_inline_ instance in-tree, which lives in a
header file. Just make it a "static inline", which will practically do
the same thing and what we already have elsewhere in-tree.
While in there drop the CAPS from ALIGN_POWER2 - it's a function, so we
don't need the shouting.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
- KMOD_EXPORT
- TS_EXPORT
- _alignedptr_
- - _always_inline_
- _clang_suppress_alloc_
- _cleanup_
- _cleanup_free_
{
struct hash *hash;
- n_buckets = ALIGN_POWER2(n_buckets);
+ n_buckets = align_power2(n_buckets);
hash = calloc(1, sizeof(struct hash) + n_buckets * sizeof(struct hash_bucket));
if (hash == NULL)
return NULL;
#define _maybe_unused_ __attribute__((unused))
#define _must_check_ __attribute__((warn_unused_result))
#define _printf_format_(a, b) __attribute__((format(printf, a, b)))
-#define _always_inline_ __inline__ __attribute__((always_inline))
#define _sentinel_ __attribute__((sentinel))
#define _used_ __attribute__((used))
#define _retain_ __attribute__((retain))
__p->__v = (val); \
} while (0)
-static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u)
+static inline unsigned int align_power2(unsigned int u)
{
return 1 << ((sizeof(u) * 8) - __builtin_clz(u - 1));
}