net: ti: Use FIELD_SIZEOF directly instead of reimplementing its function
authorzhong jiang <zhongjiang@huawei.com>
Wed, 19 Sep 2018 11:32:14 +0000 (19:32 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Sep 2018 03:58:05 +0000 (20:58 -0700)
FIELD_SIZEOF is defined as a macro to calculate the specified value. Therefore,
We prefer to use the macro rather than calculating its value.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 832bce07c38519fff846f650dc32a0ea2056b735..16dcbf36f8cc4bf5c6a2e6e34ea17367c1a6d035 100644 (file)
@@ -484,13 +484,13 @@ enum {
 };
 
 #define CPSW_STAT(m)           CPSW_STATS,                             \
-                               sizeof(((struct cpsw_hw_stats *)0)->m), \
+                               FIELD_SIZEOF(struct cpsw_hw_stats, m), \
                                offsetof(struct cpsw_hw_stats, m)
 #define CPDMA_RX_STAT(m)       CPDMA_RX_STATS,                            \
-                               sizeof(((struct cpdma_chan_stats *)0)->m), \
+                               FIELD_SIZEOF(struct cpdma_chan_stats, m), \
                                offsetof(struct cpdma_chan_stats, m)
 #define CPDMA_TX_STAT(m)       CPDMA_TX_STATS,                            \
-                               sizeof(((struct cpdma_chan_stats *)0)->m), \
+                               FIELD_SIZEOF(struct cpdma_chan_stats, m), \
                                offsetof(struct cpdma_chan_stats, m)
 
 static const struct cpsw_stats cpsw_gstrings_stats[] = {