Skip to content

Commit

Permalink
fixup! netdev: add netdev_register() to keep track if netdev IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jul 28, 2020
1 parent 4b6224c commit c2b7d79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ ifneq (,$(filter gnrc_mac,$(USEMODULE)))
endif
endif

# Don't register netdevs if there is only a single one of them
ifeq (,$(filter gnrc_netif_single,$(USEMODULE)))
USEMODULE += netdev_register
endif

ifneq (,$(filter gnrc_gomach,$(USEMODULE)))
USEMODULE += gnrc_netif
USEMODULE += gnrc_nettype_gomach
Expand Down
10 changes: 5 additions & 5 deletions drivers/include/net/netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ struct netdev {
#ifdef MODULE_L2FILTER
l2filter_t filter[CONFIG_L2FILTER_LISTSIZE]; /**< link layer address filters */
#endif
#if !IS_ACTIVE(GNRC_NETIF_SINGLE)
#ifdef MODULE_NETDEV_REGISTER
netdev_type_t type; /**< driver type used for netdev */
uint8_t index; /**< instance number of the device */
#endif
Expand All @@ -321,13 +321,13 @@ struct netdev {
*/
static inline void netdev_register(struct netdev *dev, netdev_type_t type, uint8_t index)
{
#if IS_ACTIVE(GNRC_NETIF_SINGLE)
#ifdef MODULE_NETDEV_REGISTER
dev->type = type;
dev->index = index;
#else
(void) dev;
(void) type;
(void) index;
#else
dev->type = type;
dev->index = index;
#endif
}

Expand Down
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ PSEUDOMODULES += mpu_noexec_ram
PSEUDOMODULES += nanocoap_%
PSEUDOMODULES += netdev_default
PSEUDOMODULES += netdev_ieee802154_%
PSEUDOMODULES += netdev_register
PSEUDOMODULES += netstats
PSEUDOMODULES += netstats_l2
PSEUDOMODULES += netstats_ipv6
Expand Down

0 comments on commit c2b7d79

Please sign in to comment.