qede: Decouple ethtool caps from qed
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Mon, 31 Oct 2016 05:14:24 +0000 (07:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Oct 2016 19:52:35 +0000 (15:52 -0400)
While the qed_lm_maps is closely tied with the QED_LM_* defines,
when iterating over the array use actual size instead of the qed
define to prevent future possible issues.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qede/qede_ethtool.c

index 327c614e76aab33a97aa70b4e709c7a75cd9dd6e..fe7e7b8650dde3992f74c44a937c6a7bdfbbf2a6 100644 (file)
@@ -320,7 +320,7 @@ static const struct qede_link_mode_mapping qed_lm_map[] = {
 {                                                              \
        int i;                                                  \
                                                                \
-       for (i = 0; i < QED_LM_COUNT; i++) {                    \
+       for (i = 0; i < ARRAY_SIZE(qed_lm_map); i++) {          \
                if ((caps) & (qed_lm_map[i].qed_link_mode))     \
                        __set_bit(qed_lm_map[i].ethtool_link_mode,\
                                  lk_ksettings->link_modes.name); \
@@ -331,7 +331,7 @@ static const struct qede_link_mode_mapping qed_lm_map[] = {
 {                                                              \
        int i;                                                  \
                                                                \
-       for (i = 0; i < QED_LM_COUNT; i++) {                    \
+       for (i = 0; i < ARRAY_SIZE(qed_lm_map); i++) {          \
                if (test_bit(qed_lm_map[i].ethtool_link_mode,   \
                             lk_ksettings->link_modes.name))    \
                        caps |= qed_lm_map[i].qed_link_mode;    \