Remove unused code 61/124061/2
authorAbhishek Sansanwal <abhishek.s94@samsung.com>
Mon, 10 Apr 2017 05:40:10 +0000 (11:10 +0530)
committerAbhishek Sansanwal <abhishek.s94@samsung.com>
Mon, 10 Apr 2017 05:53:54 +0000 (11:23 +0530)
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
Change-Id: I6ad18e2829323e5ceb42084a37a5210682cd9143

include/wifi-power.h
src/wifi-power.c

index 66af3ef..598d290 100755 (executable)
@@ -26,23 +26,23 @@ extern "C" {
 
 #include "wifi.h"
 
-void           wifi_power_initialize(void);
-void           wifi_power_deinitialize(void);
+void wifi_power_initialize(void);
+void wifi_power_deinitialize(void);
 
-int                    wifi_power_on(void);
-int                    wifi_power_off(void);
+int wifi_power_on(void);
+int wifi_power_off(void);
 #if defined TIZEN_WEARABLE
-int                    wifi_power_on_wearable(gboolean device_picker_test);
+int wifi_power_on_wearable(gboolean device_picker_test);
 #endif
 
-int                    wifi_power_driver_and_supplicant(gboolean enable);
-void           wifi_power_disable_technology_state_by_only_connman_signal(void);
-void           wifi_power_recover_firmware(void);
+int wifi_power_driver_and_supplicant(gboolean enable);
+void wifi_power_disable_technology_state_by_only_connman_signal(void);
+void wifi_power_recover_firmware(void);
 
-gboolean       handle_load_driver(Wifi *wifi, GDBusMethodInvocation *context, gboolean device_picker_test);
-gboolean       handle_remove_driver(Wifi *wifi, GDBusMethodInvocation *context);
-gboolean       handle_load_p2p_driver(Wifi *wifi, GDBusMethodInvocation *context);
-gboolean       handle_remove_p2p_driver(Wifi *wifi, GDBusMethodInvocation *context);
+gboolean handle_load_driver(Wifi *wifi, GDBusMethodInvocation *context, gboolean device_picker_test);
+gboolean handle_remove_driver(Wifi *wifi, GDBusMethodInvocation *context);
+gboolean handle_load_p2p_driver(Wifi *wifi, GDBusMethodInvocation *context);
+gboolean handle_remove_p2p_driver(Wifi *wifi, GDBusMethodInvocation *context);
 
 void __netconfig_set_ether_macaddr();
 
index 9cb9af8..c13bac3 100755 (executable)
@@ -340,28 +340,6 @@ static void __netconfig_set_wifi_bssid(void)
        fclose(fp);
 }
 
-int netconfig_wifi_driver_and_supplicant(gboolean enable)
-{
-       /* There are 3 thumb rules for Wi-Fi power management
-        *   1. Do not make exposed API to control wpa_supplicant and driver directly.
-        *      It probably breaks ConnMan technology operation.
-        *
-        *   2. Do not remove driver and wpa_supplicant if ConnMan already enabled.
-        *      It breaks ConnMan technology operation.
-        *
-        *   3. Final the best rule: make it as simple as possible.
-        *      Simple code enables easy maintenance and reduces logical errors.
-        */
-       if (enable == TRUE)
-               return _load_driver_and_supplicant();
-       else {
-               if (connman_wifi_technology_state == TRUE)
-                       return -ENOSYS;
-
-               return _load_driver_and_supplicant();
-       }
-}
-
 void netconfig_wifi_disable_technology_state_by_only_connman_signal(void)
 {
        /* Important: it's only done by ConnMan technology signal update */
@@ -786,8 +764,23 @@ int wifi_power_on(void)
        wifi_tech_state_e tech_state;
 
        tech_state = wifi_state_get_technology_state();
-       if (tech_state >= NETCONFIG_WIFI_TECH_POWERED)
+       if (tech_state >= NETCONFIG_WIFI_TECH_POWERED) {
+               /* There can be a scenario where wifi is automatically *
+                * activated by connman if wifi was powered in last boot. *
+                * So we should update connman_wifi_technology_state variable *
+                * if it is found that wifi_tech_state variable is *
+                * NETCONFIG_WIFI_TECH_POWERED and connman_wifi_technology_state *
+                * variable is FALSE. Earlier connman_wifi_technology_state *
+                * variable was only updated when wifi was Powered on from *
+                * net-config resulting in variable not getting updated. *
+                * This caused wifi to not get deactivated after reboot if *
+                * last power state was activated */
+               ERR("Net-Config WiFi connman technology state %d",
+                               connman_wifi_technology_state);
+               if (connman_wifi_technology_state == FALSE)
+                       connman_wifi_technology_state = TRUE;
                return -EALREADY;
+       }
 
        if (__is_wifi_restricted() == TRUE)
                return -EPERM;