Fixed incorrect comparision and memory leaks
[platform/core/connectivity/net-config.git] / src / wifi-firmware.c
index ec5c72e..d9a41f9 100755 (executable)
 #include "netsupplicant.h"
 #include "wifi-firmware.h"
 #include "network-statistics.h"
-#if defined WLAN_CHECK_POWERSAVE
-#include "wifi-powersave.h"
-#endif
 
 #define WLAN_DRIVER_SCRIPT                     "/usr/bin/wlan.sh"
 #define WLAN_IFACE_NAME                                "wlan0"
 
-#if defined(TIZEN_TV)
-#define WLAN_P2P_IFACE_NAME                    "p2p0"
-#else /* defined(TIZEN_TV) */
-#define WLAN_P2P_IFACE_NAME                    "wlan0"
-#endif /* defined(TIZEN_TV) */
+#define WLAN_P2P_IFACE_NAME_TV                 "p2p0"
+#define WLAN_P2P_IFACE_NAME_COMMON                     "wlan0"
+#define WLAN_P2P_IFACE_NAME ((TIZEN_TV) ? (WLAN_P2P_IFACE_NAME_TV) : (WLAN_P2P_IFACE_NAME_COMMON))
 
 static int __netconfig_sta_firmware_start(void)
 {
@@ -234,17 +229,9 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable)
                if (current_driver == NETCONFIG_WIFI_OFF) {
                        return -EALREADY;
                } else if (current_driver == alias) {
-#if defined WLAN_CHECK_POWERSAVE
-                       if (type == NETCONFIG_WIFI_STA && netconfig_wifi_is_powersave_mode() == TRUE) {
-                               netconfig_interface_down(WIFI_IFNAME);
-                               return -EALREADY;
-                       }
-#endif
 
 #if defined WLAN_CONCURRENT_MODE
-#if defined TIZEN_TELEPHONY_ENABLE
                        netconfig_vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
-#endif
                        if (flight_mode == 0 && type == NETCONFIG_WIFI_STA &&
                                        netconfig_is_wifi_direct_on() == TRUE) {
                                netconfig_interface_down(WIFI_IFNAME);
@@ -272,13 +259,6 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable)
 
        if (current_driver > NETCONFIG_WIFI_OFF) {
                if (current_driver == alias) {
-#if defined WLAN_CHECK_POWERSAVE
-                       if (type == NETCONFIG_WIFI_STA && netconfig_wifi_is_powersave_mode() == TRUE) {
-                               netconfig_interface_up(WIFI_IFNAME);
-
-                               return -EALREADY;
-                       }
-#endif
 
 #if defined WLAN_CONCURRENT_MODE
                        if (type == NETCONFIG_WIFI_STA)