linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] replace code with FIELD_SIZEOF
@ 2019-09-05 12:51 zhong jiang
  2019-09-05 12:51 ` [PATCH 1/3] batman-adv: Use FIELD_SIZEOF directly zhong jiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: zhong jiang @ 2019-09-05 12:51 UTC (permalink / raw)
  To: davem, mareklindner, mchehab, leon
  Cc: dledford, sakari.ailus, a, sw, linux-kernel, linux-media, zhongjiang

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] batman-adv: Use FIELD_SIZEOF directly
  2019-09-05 12:51 [PATCH 0/3] replace code with FIELD_SIZEOF zhong jiang
@ 2019-09-05 12:51 ` zhong jiang
  2019-09-05 12:51 ` [PATCH 2/3] media: v4l2: " zhong jiang
  2019-09-05 12:51 ` [PATCH 3/3] IB/mlx5: " zhong jiang
  2 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2019-09-05 12:51 UTC (permalink / raw)
  To: davem, mareklindner, mchehab, leon
  Cc: dledford, sakari.ailus, a, sw, linux-kernel, linux-media, zhongjiang

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

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 net/batman-adv/distributed-arp-table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index b0af3a1..c79fdf8 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -91,8 +91,8 @@ struct batadv_dhcp_packet {
 	__u8 options[0];
 };
 
-#define BATADV_DHCP_YIADDR_LEN sizeof(((struct batadv_dhcp_packet *)0)->yiaddr)
-#define BATADV_DHCP_CHADDR_LEN sizeof(((struct batadv_dhcp_packet *)0)->chaddr)
+#define BATADV_DHCP_YIADDR_LEN FIELD_SIZEOF(struct batadv_dhcp_packet, yiaddr)
+#define BATADV_DHCP_CHADDR_LEN FIELD_SIZEOF(struct batadv_dhcp_packet, chaddr)
 
 static void batadv_dat_purge(struct work_struct *work);
 
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] media: v4l2: Use FIELD_SIZEOF directly
  2019-09-05 12:51 [PATCH 0/3] replace code with FIELD_SIZEOF zhong jiang
  2019-09-05 12:51 ` [PATCH 1/3] batman-adv: Use FIELD_SIZEOF directly zhong jiang
@ 2019-09-05 12:51 ` zhong jiang
  2019-09-05 13:53   ` Sakari Ailus
  2019-09-05 12:51 ` [PATCH 3/3] IB/mlx5: " zhong jiang
  2 siblings, 1 reply; 5+ messages in thread
From: zhong jiang @ 2019-09-05 12:51 UTC (permalink / raw)
  To: davem, mareklindner, mchehab, leon
  Cc: dledford, sakari.ailus, a, sw, linux-kernel, linux-media, zhongjiang

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

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] IB/mlx5: Use FIELD_SIZEOF directly
  2019-09-05 12:51 [PATCH 0/3] replace code with FIELD_SIZEOF zhong jiang
  2019-09-05 12:51 ` [PATCH 1/3] batman-adv: Use FIELD_SIZEOF directly zhong jiang
  2019-09-05 12:51 ` [PATCH 2/3] media: v4l2: " zhong jiang
@ 2019-09-05 12:51 ` zhong jiang
  2 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2019-09-05 12:51 UTC (permalink / raw)
  To: davem, mareklindner, mchehab, leon
  Cc: dledford, sakari.ailus, a, sw, linux-kernel, linux-media, zhongjiang

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

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] media: v4l2: Use FIELD_SIZEOF directly
  2019-09-05 12:51 ` [PATCH 2/3] media: v4l2: " zhong jiang
@ 2019-09-05 13:53   ` Sakari Ailus
  0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2019-09-05 13:53 UTC (permalink / raw)
  To: zhong jiang
  Cc: davem, mareklindner, mchehab, leon, dledford, a, sw,
	linux-kernel, linux-media

On Thu, Sep 05, 2019 at 08:51:35PM +0800, zhong jiang wrote:
> It's more clear  to use FIELD_SIZEOF instead of its implementation.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-05 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 12:51 [PATCH 0/3] replace code with FIELD_SIZEOF zhong jiang
2019-09-05 12:51 ` [PATCH 1/3] batman-adv: Use FIELD_SIZEOF directly zhong jiang
2019-09-05 12:51 ` [PATCH 2/3] media: v4l2: " zhong jiang
2019-09-05 13:53   ` Sakari Ailus
2019-09-05 12:51 ` [PATCH 3/3] IB/mlx5: " zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).