diff mbox series

RDMA/uverbs: Use offsetofend instead of opencoding

Message ID 20190614001347.GA20629@ziepe.ca (mailing list archive)
State Mainlined
Commit d384742ed1afa925bb78fd50ff337538f202f19c
Headers show
Series RDMA/uverbs: Use offsetofend instead of opencoding | expand

Commit Message

Jason Gunthorpe June 14, 2019, 12:13 a.m. UTC
Discovered this was available already.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Doug Ledford June 21, 2019, 1:55 a.m. UTC | #1
On Fri, 2019-06-14 at 00:13 +0000, Jason Gunthorpe wrote:
> Discovered this was available already.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

Thanks, applied to for-next.
diff mbox series

Patch

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 5a3a1780ceea4d..059015c4515944 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3703,9 +3703,6 @@  static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
  * trailing driver_data flex array. In this case the size of the base struct
  * cannot be changed.
  */
-#define offsetof_after(_struct, _member)                                       \
-	(offsetof(_struct, _member) + sizeof(((_struct *)NULL)->_member))
-
 #define UAPI_DEF_WRITE_IO(req, resp)                                           \
 	.write.has_resp = 1 +                                                  \
 			  BUILD_BUG_ON_ZERO(offsetof(req, response) != 0) +    \
@@ -3736,11 +3733,11 @@  static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
  */
 #define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member)     \
 	.write.has_resp = 1,                                                   \
-	.write.req_size = offsetof_after(req, req_last_member),                \
-	.write.resp_size = offsetof_after(resp, resp_last_member)
+	.write.req_size = offsetofend(req, req_last_member),                   \
+	.write.resp_size = offsetofend(resp, resp_last_member)
 
 #define UAPI_DEF_WRITE_I_EX(req, req_last_member)                              \
-	.write.req_size = offsetof_after(req, req_last_member)
+	.write.req_size = offsetofend(req, req_last_member)
 
 const struct uapi_definition uverbs_def_write_intf[] = {
 	DECLARE_UVERBS_OBJECT(