On Mon, Jul 02, 2018 at 02:34:30PM +0300, Yishai Hadas wrote: > On 6/26/2018 1:12 AM, Jason Gunthorpe wrote: > >From: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > > > >Instead of the large set of indirecting macros, define the few needed > >macros to directly instantiate the struct uverbs_method_def and associated > >attributes list. > > > >This is small amount of code duplication but the readability is far > >better. > > > >Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > >- DECLARE_UVERBS_METHOD(UVERBS_METHOD(id), id, NULL, ##__VA_ARGS__) > >+/* Create a standard destroy method using the default handler. The handle_attr > >+ * argument must be the attribute specifying the handle to destroy, the > >+ * default handler does not support any other attributes. > >+ */ > >+#define DECLARE_UVERBS_NAMED_METHOD_DESTROY(_method_id, _handle_attr) \ > >+ static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \ > >+ _method_id)[] = { _handle_attr }; \ > >+ static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \ > >+ .id = _method_id, \ > >+ .handler = uverbs_destroy_def_handler, \ > >+ .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \ > >+ .attrs = &UVERBS_METHOD_ATTRS(_method_id), \ > >+ } > > To enable drivers using this new standard macro, I would add the below code > to this patch. Something like this should be sent along with hunks to make all destroy call sites (eg in devx.c) use this new macro. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html