Files
RedBear-OS/local/recipes/drivers
vasilito 638d78ee94 amdgpu: resolve idr_* conflict with linux-kpi via REDBEAR_AMDGPU_BUILD
The linux-kpi idr.h header and the amdgpu recipe's redox_glue.h
both define struct idr and the idr_init/alloc/remove/find/destroy
inline functions, but with different members and different argument
signatures. When the amdgpu build includes both headers in the same
translation unit (via -include linux/amdgpu_stubs.h and via
redox_glue.h), the compiler reports a redefinition of struct idr
and conflicting types for the idr_* inlines, blocking the build.

Resolve the conflict by gating the linux-kpi idr declarations on a
new REDBEAR_AMDGPU_BUILD preprocessor flag. The amdgpu recipe's
CFLAGS now defines REDBEAR_AMDGPU_BUILD, so the linux-kpi
declarations are suppressed and redox_glue.h's authoritative copies
take over. Every other consumer of linux-kpi (the redox-drm scheme
daemon, the Wi-Fi drivers) continues to see the generic stubs.

The IDA macros and struct ida in linux-kpi are kept outside the
gate because they are not part of the amdgpu surface and must
remain available to other drivers. A forward declaration of
struct idr is added at the top of the header so the
struct ida { struct idr *idr; } member compiles cleanly when the
IDR definitions are suppressed. The IDA macros are updated to
no-ops against a pointer-typed idr slot; the amdgpu build does
not exercise them and other consumers continue to treat them as
stubs.
2026-06-09 15:06:05 +03:00
..