All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panthor: use defines for sync flags
@ 2024-10-29  9:46 Erik Faye-Lund
  2024-10-29 10:15 ` Liviu Dudau
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Erik Faye-Lund @ 2024-10-29  9:46 UTC (permalink / raw)
  To: dri-devel
  Cc: Boris Brezillon, Steven Price, Liviu Dudau, Robin Murphy,
	Mihail Atanassov, kernel, Erik Faye-Lund

Enums are always signed, and assigning 1u << 31 to it invokes
implementation defined behavior. It's not a great idea to depend on this
in the UAPI, and it turns out no other UAPI does either.

So let's do what other UAPI does, and use defines instead. This way we
won't get unexpected issues if compiling user-space with a compiler with
a different implementation-defined behavior here.
---
 include/uapi/drm/panthor_drm.h | 44 +++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index 87c9cb555dd1d..a2e348f901376 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -209,27 +209,39 @@ struct drm_panthor_obj_array {
 	{ .stride = sizeof((ptr)[0]), .count = (cnt), .array = (__u64)(uintptr_t)(ptr) }
 
 /**
- * enum drm_panthor_sync_op_flags - Synchronization operation flags.
+ * DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK
+ *
+ * Synchronization handle type mask.
  */
-enum drm_panthor_sync_op_flags {
-	/** @DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK: Synchronization handle type mask. */
-	DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK = 0xff,
+#define DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK              0xff
 
-	/** @DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_SYNCOBJ: Synchronization object type. */
-	DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_SYNCOBJ = 0,
+/**
+ * DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_SYNCOBJ
+ *
+ * Synchronization object type.
+ */
+#define DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_SYNCOBJ           0
 
-	/**
-	 * @DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ: Timeline synchronization
-	 * object type.
-	 */
-	DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ = 1,
+/**
+ * DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ
+ *
+ * Timeline synchronization object type.
+ */
+#define DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ  1
 
-	/** @DRM_PANTHOR_SYNC_OP_WAIT: Wait operation. */
-	DRM_PANTHOR_SYNC_OP_WAIT = 0 << 31,
+/**
+ * DRM_PANTHOR_SYNC_OP_WAIT
+ *
+ * Wait operation.
+ */
+#define DRM_PANTHOR_SYNC_OP_WAIT    (0 << 31)
 
-	/** @DRM_PANTHOR_SYNC_OP_SIGNAL: Signal operation. */
-	DRM_PANTHOR_SYNC_OP_SIGNAL = (int)(1u << 31),
-};
+/**
+ * DRM_PANTHOR_SYNC_OP_SIGNAL
+ *
+ * Signal operation.
+ */
+#define DRM_PANTHOR_SYNC_OP_SIGNAL  (1u << 31)
 
 /**
  * struct drm_panthor_sync_op - Synchronization operation.
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-29 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  9:46 [PATCH] drm/panthor: use defines for sync flags Erik Faye-Lund
2024-10-29 10:15 ` Liviu Dudau
2024-10-29 11:22   ` Erik Faye-Lund
2024-10-29 12:35 ` Mihail Atanassov
2024-10-29 13:01 ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.