net: Execute net_init() automatically

User does not need to call net_init() as it is automatically
called when system is brought up.

Change-Id: I2cb10f4402088a0ca4feff226b65341f337194ea
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-05-09 14:31:12 +03:00
commit 33f56ce99b
3 changed files with 15 additions and 11 deletions

View file

@ -16,9 +16,12 @@
# limitations under the License.
#
config NET_YAIP_INIT_PRIO
config NET_INIT_PRIO
int
default 99
default 10
help
Network initialization priority level. This number tells how
early in the boot the network stack is initialized.
config NET_IPV6
bool "Enable IPv6"

View file

@ -26,6 +26,7 @@
#define DEBUG 1
#endif
#include <init.h>
#include <nanokernel.h>
#include <toolchain.h>
#include <sections.h>
@ -79,14 +80,16 @@ static int network_initialization(void)
return 0;
}
int net_init(void)
static int net_init(struct device *unused)
{
static uint8_t initialized;
static bool is_initialized;
if (initialized)
if (is_initialized)
return -EALREADY;
initialized = 1;
is_initialized = true;
NET_DBG("Priority %d", CONFIG_NET_INIT_PRIO);
net_nbuf_init();
@ -94,3 +97,5 @@ int net_init(void)
return network_initialization();
}
SYS_INIT(net_init, NANOKERNEL, CONFIG_NET_INIT_PRIO);

View file

@ -56,13 +56,11 @@ static inline void init_tx_queue(struct net_if *iface)
(nano_fiber_entry_t)net_if_tx_fiber, (int)iface, 0, 7, 0);
}
static int net_if_init(struct device *unused)
int net_if_init(void)
{
struct net_if_api *api;
struct net_if *iface;
ARG_UNUSED(unused);
for (iface = __net_if_start; iface != __net_if_end; iface++) {
api = (struct net_if_api *) iface->dev->driver_api;
@ -74,5 +72,3 @@ static int net_if_init(struct device *unused)
return 0;
}
SYS_INIT(net_if_init, NANOKERNEL, CONFIG_NET_YAIP_INIT_PRIO);