Skip to content

Commit

Permalink
net: fec: fix compile with CONFIG_M5272
Browse files Browse the repository at this point in the history
Commit 80cca77 ("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: 80cca77 ("net: fec: cache statistics while device is down")
Signed-off-by: Nikita Yushchenko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
nikita-yoush authored and davem330 committed Dec 6, 2016
1 parent d14584d commit f85de66
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,8 @@ static const struct fec_stat {
{ "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK },
};

#define FEC_STATS_SIZE (ARRAY_SIZE(fec_stats) * sizeof(u64))

static void fec_enet_update_ethtool_stats(struct net_device *dev)
{
struct fec_enet_private *fep = netdev_priv(dev);
Expand All @@ -2330,7 +2332,7 @@ static void fec_enet_get_ethtool_stats(struct net_device *dev,
if (netif_running(dev))
fec_enet_update_ethtool_stats(dev);

memcpy(data, fep->ethtool_stats, ARRAY_SIZE(fec_stats) * sizeof(u64));
memcpy(data, fep->ethtool_stats, FEC_STATS_SIZE);
}

static void fec_enet_get_strings(struct net_device *netdev,
Expand All @@ -2355,6 +2357,12 @@ static int fec_enet_get_sset_count(struct net_device *dev, int sset)
return -EOPNOTSUPP;
}
}

#else /* !defined(CONFIG_M5272) */
#define FEC_STATS_SIZE 0
static inline void fec_enet_update_ethtool_stats(struct net_device *dev)
{
}
#endif /* !defined(CONFIG_M5272) */

static int fec_enet_nway_reset(struct net_device *dev)
Expand Down Expand Up @@ -3293,8 +3301,7 @@ fec_probe(struct platform_device *pdev)

/* Init network device */
ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) +
ARRAY_SIZE(fec_stats) * sizeof(u64),
num_tx_qs, num_rx_qs);
FEC_STATS_SIZE, num_tx_qs, num_rx_qs);
if (!ndev)
return -ENOMEM;

Expand Down

0 comments on commit f85de66

Please sign in to comment.