From 83bb4442330f035bd68ec5d2f5b87bfef1c1a4ab Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Wed, 4 Jul 2018 08:50:29 +0300 Subject: RDMA/uverbs: Remove UA_FLAGS This bit of boilerplate isn't really necessary, we can use bitfields instead of a flags enum and the macros can then individually initialize them through the __VA_ARGS__ like everything else. Signed-off-by: Jason Gunthorpe Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/uverbs_ioctl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/infiniband/core/uverbs_ioctl.c') diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/core/uverbs_ioctl.c index 62f7382e8513..cb6109036129 100644 --- a/drivers/infiniband/core/uverbs_ioctl.c +++ b/drivers/infiniband/core/uverbs_ioctl.c @@ -98,14 +98,14 @@ static int uverbs_process_attr(struct ib_uverbs_file *ufile, * non-zero content, making ABI compat/discovery simpler. */ if (uattr->len > val_spec->u.ptr.len && - val_spec->flags & UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO && + val_spec->min_sz_or_zero && !uverbs_is_attr_cleared(uattr, val_spec->u.ptr.len)) return -EOPNOTSUPP; /* fall through */ case UVERBS_ATTR_TYPE_PTR_OUT: if (uattr->len < val_spec->u.ptr.min_len || - (!(val_spec->flags & UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO) && + (!val_spec->min_sz_or_zero && uattr->len > val_spec->u.ptr.len)) return -EINVAL; @@ -116,8 +116,7 @@ static int uverbs_process_attr(struct ib_uverbs_file *ufile, e->ptr_attr.len = uattr->len; e->ptr_attr.flags = uattr->flags; - if (val_spec->flags & UVERBS_ATTR_SPEC_F_ALLOC_AND_COPY && - !uverbs_attr_ptr_is_inline(e)) { + if (val_spec->alloc_and_copy && !uverbs_attr_ptr_is_inline(e)) { void *p; p = kvmalloc(uattr->len, GFP_KERNEL); @@ -220,8 +219,7 @@ static int uverbs_finalize_attrs(struct uverbs_attr_bundle *attrs_bundle, if (!ret) ret = current_ret; } else if (spec->type == UVERBS_ATTR_TYPE_PTR_IN && - spec->flags & - UVERBS_ATTR_SPEC_F_ALLOC_AND_COPY && + spec->alloc_and_copy && !uverbs_attr_ptr_is_inline(attr)) { kvfree(attr->ptr_attr.ptr); } -- cgit v1.2.3-59-g8ed1b