Skip to contentSkip to conversation

cobalt/rtdm: Avoid macro code duplication

PATCH New Jan Kiszka 1 participant 1 message Sep 6, 2019

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 cobalt/rtdm: Avoid macro code duplication

From: Jan Kiszka <[email protected]>

---
 kernel/cobalt/rtdm/fd.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
kernel/cobalt/rtdm/fd.c +4 -7
index d965aafef2..8a87e22643 100644
@@ -84,19 +84,16 @@ static struct rtdm_fd *fetch_fd(struct cobalt_ppd *p, int ufd)
 		(__handler) = (typeof(__handler))eadv;			\
 	while (0)
 
-/* Calling this handler should beget EADV if not implemented. */
-#define assign_invalid_default_handler(__handler)			\
-	do								\
-		if ((__handler) == NULL)				\
-			(__handler) = (typeof(__handler))eadv;		\
-	while (0)
-
 #define __assign_default_handler(__handler, __placeholder)		\
 	do								\
 		if ((__handler) == NULL)				\
 			(__handler) = (typeof(__handler))__placeholder;	\
 	while (0)
 
+/* Calling this handler should beget EADV if not implemented. */
+#define assign_invalid_default_handler(__handler)			\
+	__assign_default_handler(__handler, eadv)
+
 /* Calling this handler should beget ENOSYS if not implemented. */
 #define assign_default_handler(__handler)				\
 	__assign_default_handler(__handler, enosys)
Signature · 1 line
2.16.4