device/netdev: init scan in netdev instead of device

Commit 1057d8aa74 changed the device interface creation logic
from being unconditional inside netdev.c to instead use NETDEV_WATCH_*
events.  However, this broke the assumption that the device interface
was created before all others.  The effect is that the scan_wdev_add
might no longer be called prior to station interface being created.  Fix
this by moving scan_wdev_add/remove calls to netdev.c instead.

Fixes: 1057d8aa74 ("device: Move device creation from netdev.c to event watch")
This commit is contained in:
Denis Kenzior 2019-12-06 10:11:51 -06:00
parent d2556a48b7
commit 738184d491
2 changed files with 4 additions and 4 deletions

View File

@ -322,8 +322,6 @@ static struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
l_info("Unable to register %s interface",
L_DBUS_INTERFACE_PROPERTIES);
scan_wdev_add(netdev_get_wdev_id(device->netdev));
/*
* register for AP roam transition watch
*/
@ -345,8 +343,6 @@ static void device_free(struct device *device)
{
l_debug("");
scan_wdev_remove(netdev_get_wdev_id(device->netdev));
netdev_frame_watch_remove(device->netdev, device->ap_roam_watch);
wiphy_state_watch_remove(device->wiphy, device->wiphy_rfkill_watch);

View File

@ -626,6 +626,8 @@ static void netdev_free(void *data)
WATCHLIST_NOTIFY(&netdev_watches, netdev_watch_func_t,
netdev, NETDEV_WATCH_EVENT_DEL);
scan_wdev_remove(netdev->wdev_id);
watchlist_destroy(&netdev->frame_watches);
watchlist_destroy(&netdev->station_watches);
@ -4204,6 +4206,8 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,
l_debug("Interface %i initialized", netdev->index);
scan_wdev_add(netdev->wdev_id);
WATCHLIST_NOTIFY(&netdev_watches, netdev_watch_func_t,
netdev, NETDEV_WATCH_EVENT_NEW);
netdev->events_ready = true;