RE: [PATCH V3 2/4] net-next: mediatek: add support for MT7623 ethernet

From: David Laight
Date: Fri Mar 04 2016 - 05:53:26 EST


From: John Crispin
> Sent: 03 March 2016 20:03
...
> +/* ugly macro hack to make sure hw_stats and ethtool strings are consistent */
> +#define MTK_STAT_REG_DECLARE \
> + _FE(tx_bytes) \
> + _FE(tx_packets) \
> + _FE(tx_skip) \
> + _FE(tx_collisions) \
> + _FE(rx_bytes) \
> + _FE(rx_packets) \
> + _FE(rx_overflow) \
> + _FE(rx_fcs_errors) \
> + _FE(rx_short_errors) \
> + _FE(rx_long_errors) \
> + _FE(rx_checksum_errors) \
> + _FE(rx_flow_control_packets)

Much better is to replace the first line with:
#define MTK_STAT_REG__DECLARE(_FE)
then the calling code can do:
#define XX(x) #x,
const char *names = {MTK_STAT_REG_DECLARE(XX)};
#undef XX

David