wifi: Stop scanning when disabling wifi
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 15 Jun 2012 11:13:42 +0000 (14:13 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 18 Jun 2012 07:57:19 +0000 (10:57 +0300)
Move wifi scan stopping from wifi remove to wifi disable since
only wifi disable is called when the wifi technology is disabled.
Removing a wifi device will first disable it and then continue
with the removal procedure.

plugins/wifi.c

index 3f9afad..0b69471 100644 (file)
@@ -237,12 +237,6 @@ static void wifi_remove(struct connman_device *device)
        if (wifi == NULL)
                return;
 
-       stop_autoscan(device);
-
-       /* In case of a user scan, device is still referenced */
-       if (connman_device_get_scanning(device) == TRUE)
-               connman_device_unref(wifi->device);
-
        iface_list = g_list_remove(iface_list, wifi);
 
        remove_networks(device, wifi);
@@ -637,6 +631,14 @@ static int wifi_disable(struct connman_device *device)
        if (wifi->pending_network != NULL)
                wifi->pending_network = NULL;
 
+       stop_autoscan(device);
+
+       /* In case of a user scan, device is still referenced */
+       if (connman_device_get_scanning(device) == TRUE) {
+               connman_device_set_scanning(device, FALSE);
+               connman_device_unref(wifi->device);
+       }
+
        remove_networks(device, wifi);
 
        ret = g_supplicant_interface_remove(wifi->interface, NULL, NULL);