diff mbox series

[v2,net-next,1/2] indirect_call_wrapper: extend indirect wrapper to support up to 4 calls

Message ID 20200623164232.175846-1-brianvv@google.com
State Accepted
Delegated to: David Miller
Headers show
Series [v2,net-next,1/2] indirect_call_wrapper: extend indirect wrapper to support up to 4 calls | expand

Commit Message

Brian Vazquez June 23, 2020, 4:42 p.m. UTC
There are many places where 2 annotations are not enough. This patch
adds INDIRECT_CALL_3 and INDIRECT_CALL_4 to cover such cases.

Signed-off-by: Brian Vazquez <brianvv@google.com>
---
 include/linux/indirect_call_wrapper.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Paolo Abeni June 23, 2020, 5:50 p.m. UTC | #1
On Tue, 2020-06-23 at 09:42 -0700, Brian Vazquez wrote:
> There are many places where 2 annotations are not enough. This patch
> adds INDIRECT_CALL_3 and INDIRECT_CALL_4 to cover such cases.
> 
> Signed-off-by: Brian Vazquez <brianvv@google.com>
> ---
>  include/linux/indirect_call_wrapper.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/indirect_call_wrapper.h b/include/linux/indirect_call_wrapper.h
> index 00d7e8e919c6..54c02c84906a 100644
> --- a/include/linux/indirect_call_wrapper.h
> +++ b/include/linux/indirect_call_wrapper.h
> @@ -23,6 +23,16 @@
>  		likely(f == f2) ? f2(__VA_ARGS__) :			\
>  				  INDIRECT_CALL_1(f, f1, __VA_ARGS__);	\
>  	})
> +#define INDIRECT_CALL_3(f, f3, f2, f1, ...)					\
> +	({									\
> +		likely(f == f3) ? f3(__VA_ARGS__) :				\
> +				  INDIRECT_CALL_2(f, f2, f1, __VA_ARGS__);	\
> +	})
> +#define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...)					\
> +	({									\
> +		likely(f == f4) ? f4(__VA_ARGS__) :				\
> +				  INDIRECT_CALL_3(f, f3, f2, f1, __VA_ARGS__);	\
> +	})
>  
>  #define INDIRECT_CALLABLE_DECLARE(f)	f
>  #define INDIRECT_CALLABLE_SCOPE
> @@ -30,6 +40,8 @@
>  #else
>  #define INDIRECT_CALL_1(f, f1, ...) f(__VA_ARGS__)
>  #define INDIRECT_CALL_2(f, f2, f1, ...) f(__VA_ARGS__)
> +#define INDIRECT_CALL_3(f, f3, f2, f1, ...) f(__VA_ARGS__)
> +#define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...) f(__VA_ARGS__)
>  #define INDIRECT_CALLABLE_DECLARE(f)
>  #define INDIRECT_CALLABLE_SCOPE		static
>  #endif

Acked-by: Paolo Abeni <pabeni@redhat.com>
David Miller June 23, 2020, 10:11 p.m. UTC | #2
From: Brian Vazquez <brianvv@google.com>
Date: Tue, 23 Jun 2020 09:42:31 -0700

> There are many places where 2 annotations are not enough. This patch
> adds INDIRECT_CALL_3 and INDIRECT_CALL_4 to cover such cases.
> 
> Signed-off-by: Brian Vazquez <brianvv@google.com>

Applied.
diff mbox series

Patch

diff --git a/include/linux/indirect_call_wrapper.h b/include/linux/indirect_call_wrapper.h
index 00d7e8e919c6..54c02c84906a 100644
--- a/include/linux/indirect_call_wrapper.h
+++ b/include/linux/indirect_call_wrapper.h
@@ -23,6 +23,16 @@ 
 		likely(f == f2) ? f2(__VA_ARGS__) :			\
 				  INDIRECT_CALL_1(f, f1, __VA_ARGS__);	\
 	})
+#define INDIRECT_CALL_3(f, f3, f2, f1, ...)					\
+	({									\
+		likely(f == f3) ? f3(__VA_ARGS__) :				\
+				  INDIRECT_CALL_2(f, f2, f1, __VA_ARGS__);	\
+	})
+#define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...)					\
+	({									\
+		likely(f == f4) ? f4(__VA_ARGS__) :				\
+				  INDIRECT_CALL_3(f, f3, f2, f1, __VA_ARGS__);	\
+	})
 
 #define INDIRECT_CALLABLE_DECLARE(f)	f
 #define INDIRECT_CALLABLE_SCOPE
@@ -30,6 +40,8 @@ 
 #else
 #define INDIRECT_CALL_1(f, f1, ...) f(__VA_ARGS__)
 #define INDIRECT_CALL_2(f, f2, f1, ...) f(__VA_ARGS__)
+#define INDIRECT_CALL_3(f, f3, f2, f1, ...) f(__VA_ARGS__)
+#define INDIRECT_CALL_4(f, f4, f3, f2, f1, ...) f(__VA_ARGS__)
 #define INDIRECT_CALLABLE_DECLARE(f)
 #define INDIRECT_CALLABLE_SCOPE		static
 #endif