Skip to content
Permalink
Browse files

net: slip: fix compilation without NET_L2_ETHERNET

For example it should be possible to compile and use the SLIP module
with NET_L2_DUMMY. This required the following changes:

* Fix a typo in the initializer for struct dummy_api
* Only define eth_capabilities if CONFIG_NET_L2_ETHERNET is defined to
  silence a -Wunused-function compiler warning
* Unconditionally include net/dummy.h

Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
  • Loading branch information...
nmeum authored and jukkar committed Apr 24, 2019
1 parent 7a824d8 commit 9ecf292397b39c8fa36fd099e605ee8682b6b47a
Showing with 5 additions and 3 deletions.
  1. +5 −3 drivers/net/slip.c
@@ -30,8 +30,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <net/net_pkt.h>
#include <net/net_if.h>
#include <net/net_core.h>
#include <net/dummy.h>
#include <console/uart_pipe.h>
#include <net/ethernet.h>

#define SLIP_END 0300
#define SLIP_ESC 0333
@@ -394,7 +394,9 @@ static void slip_iface_init(struct net_if *iface)
struct slip_context *slip = net_if_get_device(iface)->driver_data;
struct net_linkaddr *ll_addr;

#if defined(CONFIG_NET_L2_ETHERNET)
ethernet_init(iface);
#endif

#if defined(CONFIG_NET_LLDP)
net_lldp_set_lldpdu(iface);
@@ -430,6 +432,7 @@ static void slip_iface_init(struct net_if *iface)

static struct slip_context slip_context_data;

#if defined(CONFIG_SLIP_TAP)
static enum ethernet_hw_caps eth_capabilities(struct device *dev)
{
ARG_UNUSED(dev);
@@ -441,7 +444,6 @@ static enum ethernet_hw_caps eth_capabilities(struct device *dev)
;
}

#if defined(CONFIG_SLIP_TAP) && defined(CONFIG_NET_L2_ETHERNET)
static const struct ethernet_api slip_if_api = {
.iface_api.init = slip_iface_init,

@@ -459,7 +461,7 @@ ETH_NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, &slip_context_data,
#else

static const struct dummy_api slip_if_api = {
.iface_init.init = slip_iface_init,
.iface_api.init = slip_iface_init,

.send = slip_send,
};

0 comments on commit 9ecf292

Please sign in to comment.
You can’t perform that action at this time.