Non-Linux systems (e.g. FreeBSD) ship drm_mode.h but don't have
Linux headers. This causes build failures [1].

Guard Linux-specific header #include behind Linux checks (kernel
and user-space). The macros depending on these headers are not
usable, but this at least unblocks libdrm upgrades. A future
patch may re-implement the required macros.

[1]: 
https://gitlab.freedesktop.org/mesa/libdrm/-/merge_requests/462#note_3473512

Signed-off-by: Simon Ser <[email protected]>
Fixes: 4c684596cde4 ("drm: Add CRTC background color property")
Cc: Cristian Ciocaltea <[email protected]>
Cc: Matt Roper <[email protected]>
Cc: NĂ­colas F. R. A. Prado <[email protected]>
Cc: Daniel Stone <[email protected]>
---
 include/uapi/drm/drm_mode.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index ed1a660a3dfd..b0e3d8c4df9f 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -10,8 +10,10 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
+#if defined(__KERNEL__) || defined(__linux__)
 #include <linux/bits.h>
 #include <linux/const.h>
+#endif
 
 #include "drm.h"
 
-- 
2.56.0


Reply via email to