summaryrefslogtreecommitdiff
path: root/include/rdma/uverbs_named_ioctl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/uverbs_named_ioctl.h')
-rw-r--r--include/rdma/uverbs_named_ioctl.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/include/rdma/uverbs_named_ioctl.h b/include/rdma/uverbs_named_ioctl.h
index 2eb1767042af..b3b21733cc55 100644
--- a/include/rdma/uverbs_named_ioctl.h
+++ b/include/rdma/uverbs_named_ioctl.h
@@ -97,22 +97,14 @@
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
}
-/* Used by drivers to declare a complete parsing tree for a single method that
- * differs only in having additional driver specific attributes.
+/* Used by drivers to declare a complete parsing tree for new methods
*/
-#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
- static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
- _method_id)[] = { __VA_ARGS__ }; \
- static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
- .id = _method_id, \
- .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
- .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
- }; \
+#define ADD_UVERBS_METHODS(_name, _object_id, ...) \
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
- _object_id)[] = { &UVERBS_METHOD(_method_id) }; \
+ _object_id)[] = { __VA_ARGS__ }; \
static const struct uverbs_object_def _name##_struct = { \
.id = _object_id, \
- .num_methods = 1, \
+ .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
}; \
static const struct uverbs_object_def *const _name##_ptrs[] = { \
@@ -123,4 +115,17 @@
.objects = &_name##_ptrs, \
}
+/* Used by drivers to declare a complete parsing tree for a single method that
+ * differs only in having additional driver specific attributes.
+ */
+#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
+ static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
+ _method_id)[] = { __VA_ARGS__ }; \
+ static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
+ .id = _method_id, \
+ .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
+ .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
+ }; \
+ ADD_UVERBS_METHODS(_name, _object_id, &UVERBS_METHOD(_method_id))
+
#endif