OSDN Git Service

fm10k: use macro to avoid passing the array and size separately
authorJacob Keller <jacob.e.keller@intel.com>
Thu, 12 Apr 2018 18:15:57 +0000 (11:15 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 9 May 2018 16:02:39 +0000 (09:02 -0700)
commit36592d6ce8d38590894fb34329b0786386ee75bc
tree2277966956b4ac5ab81f772cb0cec730d4fe8f85
parentd63bb21a7e722fcaa6cc6a217f21fe25a9e2c89e
fm10k: use macro to avoid passing the array and size separately

Avoid potential bugs with fm10k_add_stat_strings and
fm10k_add_ethtool_stats by using a macro to calculate the ARRAY_SIZE
when passing. This helps ensure that the size is always correct.

Note that it assumes we only pass static const fm10k_stat arrays, and
that evaluation of the argument won't have side effects.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c