Skip to content

Commit

Permalink
drivers: eth: stellaris: Properly ifdef stats handling
Browse files Browse the repository at this point in the history
Ethernet stats should be added/handles only if
CONFIG_NET_STATISTICS_ETHERNET is defined.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
  • Loading branch information
pfalcon authored and andrewboie committed Mar 1, 2019
1 parent 7f5cee5 commit fd7c443
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/ethernet/eth_stellaris.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,12 @@ static void eth_stellaris_init(struct net_if *iface)
dev_conf->config_func(dev);
}

#if defined(CONFIG_NET_STATISTICS_ETHERNET)
static struct net_stats_eth *eth_stellaris_stats(struct device *dev)
{
return &(DEV_DATA(dev)->stats);
}
#endif

static int eth_stellaris_dev_init(struct device *dev)
{
Expand Down Expand Up @@ -346,8 +348,10 @@ struct eth_stellaris_runtime eth_data = {

static const struct ethernet_api eth_stellaris_apis = {
.iface_api.init = eth_stellaris_init,
.get_stats = eth_stellaris_stats,
.send = eth_stellaris_send,
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
.get_stats = eth_stellaris_stats,
#endif
};

NET_DEVICE_INIT(eth_stellaris, DT_ETH_DRV_NAME,
Expand Down

0 comments on commit fd7c443

Please sign in to comment.