提交 030ed68b 编写于 作者: J Julia Lawall 提交者: Jeff Garzik

replace code with FIELD_SIZEOF

Signed-off-by: NJulia Lawall <julia@diku.dk>
Signed-off-by: NAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 9dde447a
...@@ -50,7 +50,7 @@ struct e1000_stats { ...@@ -50,7 +50,7 @@ struct e1000_stats {
int stat_offset; int stat_offset;
}; };
#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \ #define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
offsetof(struct e1000_adapter, m) offsetof(struct e1000_adapter, m)
static const struct e1000_stats e1000_gstrings_stats[] = { static const struct e1000_stats e1000_gstrings_stats[] = {
{ "rx_packets", E1000_STAT(stats.gprc) }, { "rx_packets", E1000_STAT(stats.gprc) },
......
...@@ -43,7 +43,7 @@ struct igb_stats { ...@@ -43,7 +43,7 @@ struct igb_stats {
int stat_offset; int stat_offset;
}; };
#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \ #define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
offsetof(struct igb_adapter, m) offsetof(struct igb_adapter, m)
static const struct igb_stats igb_gstrings_stats[] = { static const struct igb_stats igb_gstrings_stats[] = {
{ "rx_packets", IGB_STAT(stats.gprc) }, { "rx_packets", IGB_STAT(stats.gprc) },
......
...@@ -49,7 +49,7 @@ struct ixgb_stats { ...@@ -49,7 +49,7 @@ struct ixgb_stats {
int stat_offset; int stat_offset;
}; };
#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \ #define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
offsetof(struct ixgb_adapter, m) offsetof(struct ixgb_adapter, m)
static struct ixgb_stats ixgb_gstrings_stats[] = { static struct ixgb_stats ixgb_gstrings_stats[] = {
{"rx_packets", IXGB_STAT(net_stats.rx_packets)}, {"rx_packets", IXGB_STAT(net_stats.rx_packets)},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册