2019-09-05 17:03:08

by zhong jiang

[permalink] [raw]
Subject: [PATCH 0/3] replace code with FIELD_SIZEOF

FIELD_SIZEOF() has implemented sizeof(). Hence use FIELD_SIZEOF
directly.

zhong jiang (3):
batman-adv: Use FIELD_SIZEOF directly
media: v4l2: Use FIELD_SIZEOF directly
IB/mlx5: Use FIELD_SIZEOF directly

drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
net/batman-adv/distributed-arp-table.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

--
1.7.12.4


2019-09-05 17:03:18

by zhong jiang

[permalink] [raw]
Subject: [PATCH 2/3] media: v4l2: Use FIELD_SIZEOF directly

It's more clear to use FIELD_SIZEOF instead of its implementation.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 51b9127..eebea91 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2637,7 +2637,7 @@ struct v4l2_ioctl_info {
/* Zero struct from after the field to the end */
#define INFO_FL_CLEAR(v4l2_struct, field) \
((offsetof(struct v4l2_struct, field) + \
- sizeof(((struct v4l2_struct *)0)->field)) << 16)
+ FIELD_SIZEOF(struct v4l2_struct, field)) << 16)
#define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16)

#define DEFINE_V4L_STUB_FUNC(_vidioc) \
--
1.7.12.4

2019-09-05 17:03:47

by zhong jiang

[permalink] [raw]
Subject: [PATCH 3/3] IB/mlx5: Use FIELD_SIZEOF directly

It's more clear to use FIELD_SIZEOF instead of its implementation.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index c3ea299..e5681f7 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -65,7 +65,7 @@
__LINE__, current->pid, ##arg)

#define field_avail(type, fld, sz) (offsetof(type, fld) + \
- sizeof(((type *)0)->fld) <= (sz))
+ FIELD_SIZEOF(type, fld) <= (sz))
#define MLX5_IB_DEFAULT_UIDX 0xffffff
#define MLX5_USER_ASSIGNED_UIDX_MASK __mlx5_mask(qpc, user_index)

--
1.7.12.4