diff options
author | Nikita Yushchenko <nikita.yoush@cogentembedded.com> | 2016-12-06 01:26:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-06 11:40:15 -0500 |
commit | f85de6666347c974cdf97b1026180995d912d7d0 (patch) | |
tree | 305017a75980f4196fb79aef6f4e15b43c1defd7 | |
parent | d14584d91976c42c7178164665c4959495740939 (diff) |
net: fec: fix compile with CONFIG_M5272
Commit 80cca775cdc4 ("net: fec: cache statistics while device is down")
introduced unconditional statistics-related actions.
However, when driver is compiled with CONFIG_M5272, staticsics-related
definitions do not exist, which results into build errors.
Fix that by adding explicit handling of !defined(CONFIG_M5272) case.
Fixes: 80cca775cdc4 ("net: fec: cache statistics while device is down")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 5f77caa59534..12aef1b15356 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -2313,6 +2313,8 @@ static const struct fec_stat { | |||
2313 | { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK }, | 2313 | { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK }, |
2314 | }; | 2314 | }; |
2315 | 2315 | ||
2316 | #define FEC_STATS_SIZE (ARRAY_SIZE(fec_stats) * sizeof(u64)) | ||
2317 | |||
2316 | static void fec_enet_update_ethtool_stats(struct net_device *dev) | 2318 | static void fec_enet_update_ethtool_stats(struct net_device *dev) |
2317 | { | 2319 | { |
2318 | struct fec_enet_private *fep = netdev_priv(dev); | 2320 | struct fec_enet_private *fep = netdev_priv(dev); |
@@ -2330,7 +2332,7 @@ static void fec_enet_get_ethtool_stats(struct net_device *dev, | |||
2330 | if (netif_running(dev)) | 2332 | if (netif_running(dev)) |
2331 | fec_enet_update_ethtool_stats(dev); | 2333 | fec_enet_update_ethtool_stats(dev); |
2332 | 2334 | ||
2333 | memcpy(data, fep->ethtool_stats, ARRAY_SIZE(fec_stats) * sizeof(u64)); | 2335 | memcpy(data, fep->ethtool_stats, FEC_STATS_SIZE); |
2334 | } | 2336 | } |
2335 | 2337 | ||
2336 | static void fec_enet_get_strings(struct net_device *netdev, | 2338 | static void fec_enet_get_strings(struct net_device *netdev, |
@@ -2355,6 +2357,12 @@ static int fec_enet_get_sset_count(struct net_device *dev, int sset) | |||
2355 | return -EOPNOTSUPP; | 2357 | return -EOPNOTSUPP; |
2356 | } | 2358 | } |
2357 | } | 2359 | } |
2360 | |||
2361 | #else /* !defined(CONFIG_M5272) */ | ||
2362 | #define FEC_STATS_SIZE 0 | ||
2363 | static inline void fec_enet_update_ethtool_stats(struct net_device *dev) | ||
2364 | { | ||
2365 | } | ||
2358 | #endif /* !defined(CONFIG_M5272) */ | 2366 | #endif /* !defined(CONFIG_M5272) */ |
2359 | 2367 | ||
2360 | static int fec_enet_nway_reset(struct net_device *dev) | 2368 | static int fec_enet_nway_reset(struct net_device *dev) |
@@ -3293,8 +3301,7 @@ fec_probe(struct platform_device *pdev) | |||
3293 | 3301 | ||
3294 | /* Init network device */ | 3302 | /* Init network device */ |
3295 | ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) + | 3303 | ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) + |
3296 | ARRAY_SIZE(fec_stats) * sizeof(u64), | 3304 | FEC_STATS_SIZE, num_tx_qs, num_rx_qs); |
3297 | num_tx_qs, num_rx_qs); | ||
3298 | if (!ndev) | 3305 | if (!ndev) |
3299 | return -ENOMEM; | 3306 | return -ENOMEM; |
3300 | 3307 | ||