device: Combine multiple if statements into one block of code
[framework/connectivity/connman.git] / src / device.c
index e433991..d06bffd 100644 (file)
@@ -247,12 +247,7 @@ int __connman_device_disable(struct connman_device *device)
        }
 
        err = device->driver->disable(device);
-       if (err == 0) {
-               connman_device_set_powered(device, FALSE);
-               goto done;
-       }
-
-       if (err == -EALREADY) {
+       if (err == 0 || err == -EALREADY) {
                connman_device_set_powered(device, FALSE);
                goto done;
        }
@@ -598,13 +593,12 @@ int connman_device_set_powered(struct connman_device *device,
 
        type = __connman_device_get_service_type(device);
 
-       if (device->powered == TRUE)
-               __connman_technology_enabled(type);
-       else
+       if (device->powered == FALSE) {
                __connman_technology_disabled(type);
-
-       if (powered == FALSE)
                return 0;
+       }
+
+       __connman_technology_enabled(type);
 
        connman_device_set_disconnected(device, FALSE);
        device->scanning = FALSE;
@@ -1102,7 +1096,8 @@ int __connman_device_request_scan(enum connman_service_type type)
 
 int __connman_device_request_hidden_scan(struct connman_device *device,
                                const char *ssid, unsigned int ssid_len,
-                               const char *identity, const char *passphrase)
+                               const char *identity, const char *passphrase,
+                               void *user_data)
 {
        DBG("device %p", device);
 
@@ -1114,7 +1109,7 @@ int __connman_device_request_hidden_scan(struct connman_device *device,
                return -EALREADY;
 
        return device->driver->scan_hidden(device, ssid, ssid_len,
-                                       identity, passphrase);
+                                       identity, passphrase, user_data);
 }
 
 connman_bool_t __connman_device_isfiltered(const char *devname)