9 Commits

Author SHA1 Message Date
Emil Velikov
bffe1a7800 Remove _always_inline_ attribute
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>
2025-07-08 07:17:14 -05:00
Emil Velikov
52e20d50a6 libkmod: add TODO for module hashkey handling
We currently "leak" the hashkey handling in a few places. As result we
ignore the name passed to kmod_module_new().

Add a TODO entry and silence the unused parameter compiler warning.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-11 07:54:40 -05:00
Emil Velikov
5610688ec0 shared: properly __attribute__ all macros
Handful of the attributes were missing the trailing double underscore.
Thus they were not picked by our git grep combo and ultimately missing
from .clang-format.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-11 07:54:40 -05:00
Emil Velikov
20e91b3a6b shared/macro: avoid nesting macros where possible
Always try to use the attribute notation, so that we can reliably
collect all the macros in our .clang-format.

In the process, we can remove some (no longer used) macros.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-11 07:54:40 -05:00
Emil Velikov
32008fc497 clang-format: update attribute macros
Use the command to update the attribute macros list. Seemingly we've
updated the list manually, which meant that a) some symbols were not
annotated the expected way and b) some macros were not picked up.

First we start with auto-generating the list, the other issues will be
handled as follow-ups.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-11 07:54:40 -05:00
Lucas De Marchi
0c5a7fba4d clang-format: Add new attribute macros
Commits 44855d7 ("shared/macro: Add _alignedptr_") and d7e7c4c
("shared/macro: Add macros for more attributes") added the macros, but
forgot to add them to the clang-format configuration.

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-01-06 09:16:36 -06:00
Tobias Stoeckmann
39e6f0e237 libkmod: Unify READV usages
Do not assign variables which are not even used, but merely exist for
the READV macro to work.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/187
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-18 14:00:27 -05:00
Lucas De Marchi
5fed5baea8 clang-format: Override settings
- Define our own foreach macros
- Add defines for attributes. This also needs the minimum clang-format
  version to be raised so it has the AttributeMacros setting.
- Redefine a few settings related to max number of columns and
  penalties for breaking lines

v2
 - [Emil] update attributes list

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/118
2024-09-08 23:39:19 -05:00
Lucas De Marchi
e7d8503b87 clang-format: Import from kernel
Import .clang-format from Linux kernel as of v6.11-rc6.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/118
2024-09-08 23:39:19 -05:00