Skip to content

Commit f85de66

Browse files
nikita-youshdavem330
authored andcommitted
net: fec: fix compile with CONFIG_M5272
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 <nikita.yoush@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d14584d commit f85de66

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,8 @@ static const struct fec_stat {
23132313
{ "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK },
23142314
};
23152315

2316+
#define FEC_STATS_SIZE (ARRAY_SIZE(fec_stats) * sizeof(u64))
2317+
23162318
static void fec_enet_update_ethtool_stats(struct net_device *dev)
23172319
{
23182320
struct fec_enet_private *fep = netdev_priv(dev);
@@ -2330,7 +2332,7 @@ static void fec_enet_get_ethtool_stats(struct net_device *dev,
23302332
if (netif_running(dev))
23312333
fec_enet_update_ethtool_stats(dev);
23322334

2333-
memcpy(data, fep->ethtool_stats, ARRAY_SIZE(fec_stats) * sizeof(u64));
2335+
memcpy(data, fep->ethtool_stats, FEC_STATS_SIZE);
23342336
}
23352337

23362338
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)
23552357
return -EOPNOTSUPP;
23562358
}
23572359
}
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+
}
23582366
#endif /* !defined(CONFIG_M5272) */
23592367

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

32943302
/* Init network device */
32953303
ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) +
3296-
ARRAY_SIZE(fec_stats) * sizeof(u64),
3297-
num_tx_qs, num_rx_qs);
3304+
FEC_STATS_SIZE, num_tx_qs, num_rx_qs);
32983305
if (!ndev)
32993306
return -ENOMEM;
33003307

0 commit comments

Comments
 (0)