diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2010-08-03 16:03:33 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-08-03 17:32:09 +0200 |
commit | 15c81eff4ae3862dce1b14de4d666ecde2359b7b (patch) | |
tree | 4cb8039ea6e7f131668f8efb24d0db9fa851d861 /src | |
parent | db65803292a9f87f15ec5ab704e2d294f5225c79 (diff) | |
download | connman-15c81eff4ae3862dce1b14de4d666ecde2359b7b.tar.gz connman-15c81eff4ae3862dce1b14de4d666ecde2359b7b.tar.bz2 connman-15c81eff4ae3862dce1b14de4d666ecde2359b7b.zip |
Toggle the powered_pending device flag only if driver op succeeds
Diffstat (limited to 'src')
-rw-r--r-- | src/device.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 33ee896e..e3d4d04e 100644 --- a/src/device.c +++ b/src/device.c @@ -206,12 +206,14 @@ int __connman_device_enable(struct connman_device *device) if (device->powered_pending == TRUE) return -EALREADY; - device->powered_pending = TRUE; - err = device->driver->enable(device); - if (err < 0) + if (err < 0) { + if (err == -EINPROGRESS) + device->powered_pending = TRUE; return err; + } + device->powered_pending = TRUE; device->powered = TRUE; __connman_technology_enable_device(device); @@ -234,8 +236,6 @@ int __connman_device_disable(struct connman_device *device) if (device->powered_pending == FALSE) return -EALREADY; - device->powered_pending = FALSE; - device->reconnect = FALSE; clear_scan_trigger(device); @@ -243,9 +243,13 @@ int __connman_device_disable(struct connman_device *device) g_hash_table_remove_all(device->networks); err = device->driver->disable(device); - if (err < 0) + if (err < 0) { + if (err == -EINPROGRESS) + device->powered_pending = FALSE; return err; + } + device->powered_pending = FALSE; device->powered = FALSE; __connman_technology_disable_device(device); |