technology: Rename __connman_technology_[enable|disable]_device
authorAlok Barsode <alok.barsode@nokia.com>
Wed, 16 Feb 2011 09:03:30 +0000 (11:03 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 16 Feb 2011 14:07:02 +0000 (15:07 +0100)
src/connman.h
src/device.c
src/technology.c

index b2e87a6..f6521eb 100644 (file)
@@ -315,8 +315,8 @@ void __connman_technology_list(DBusMessageIter *iter, void *user_data);
 
 int __connman_technology_add_device(struct connman_device *device);
 int __connman_technology_remove_device(struct connman_device *device);
-int __connman_technology_enable_device(struct connman_device *device);
-int __connman_technology_disable_device(struct connman_device *device);
+int __connman_technology_enable(enum connman_service_type type);
+int __connman_technology_disable(enum connman_service_type type);
 int __connman_technology_add_rfkill(unsigned int index,
                                        enum connman_service_type type,
                                                connman_bool_t softblock,
index 4f8643b..07c427d 100644 (file)
@@ -188,6 +188,7 @@ enum connman_service_type __connman_device_get_service_type(struct connman_devic
 int __connman_device_enable(struct connman_device *device)
 {
        int err;
+       enum connman_service_type type;
 
        DBG("device %p %d", device, device->blocked);
 
@@ -220,7 +221,8 @@ int __connman_device_enable(struct connman_device *device)
        if (__connman_profile_get_offlinemode() == TRUE)
                __connman_profile_set_offlinemode(FALSE, FALSE);
 
-       __connman_technology_enable_device(device);
+       type = __connman_device_get_service_type(device);
+       __connman_technology_enable(type);
 
        return 0;
 }
@@ -228,6 +230,7 @@ int __connman_device_enable(struct connman_device *device)
 int __connman_device_disable(struct connman_device *device)
 {
        int err;
+       enum connman_service_type type;
 
        DBG("device %p", device);
 
@@ -258,7 +261,8 @@ int __connman_device_disable(struct connman_device *device)
        device->powered_pending = FALSE;
        device->powered = FALSE;
 
-       __connman_technology_disable_device(device);
+       type = __connman_device_get_service_type(device);
+       __connman_technology_disable(type);
 
        return 0;
 }
@@ -636,6 +640,7 @@ int connman_device_set_powered(struct connman_device *device,
                                                connman_bool_t powered)
 {
        int err;
+       enum connman_service_type type;
 
        DBG("driver %p powered %d", device, powered);
 
@@ -655,10 +660,12 @@ int connman_device_set_powered(struct connman_device *device,
        device->powered = powered;
        device->powered_pending = powered;
 
+       type = __connman_device_get_service_type(device);
+
        if (device->powered == TRUE)
-               __connman_technology_enable_device(device);
+               __connman_technology_enable(type);
        else
-               __connman_technology_disable_device(device);
+               __connman_technology_disable(type);
 
        if (device->offlinemode == TRUE && powered == TRUE)
                return connman_device_set_powered(device, FALSE);
index aa6fde0..dc8b845 100644 (file)
@@ -674,21 +674,17 @@ int __connman_technology_remove_device(struct connman_device *device)
        return 0;
 }
 
-int __connman_technology_enable_device(struct connman_device *device)
+int __connman_technology_enable(enum connman_service_type type)
 {
        struct connman_technology *technology;
-       enum connman_service_type type;
-
-       DBG("device %p", device);
 
-       technology = g_hash_table_lookup(device_table, device);
+       technology = technology_find(type);
        if (technology == NULL)
                return -ENXIO;
 
        if (g_atomic_int_get(&technology->blocked))
                return -ERFKILL;
 
-       type = __connman_device_get_service_type(device);
        __connman_notifier_enable(type);
 
        if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
@@ -699,22 +695,18 @@ int __connman_technology_enable_device(struct connman_device *device)
        return 0;
 }
 
-int __connman_technology_disable_device(struct connman_device *device)
+int __connman_technology_disable(enum connman_service_type type)
 {
        struct connman_technology *technology;
-       enum connman_service_type type;
        GSList *list;
 
-       DBG("device %p", device);
-
-       type = __connman_device_get_service_type(device);
-       __connman_notifier_disable(type);
-
-       technology = g_hash_table_lookup(device_table, device);
+       technology = technology_find(type);
        if (technology == NULL)
                return -ENXIO;
 
        if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
+               __connman_notifier_disable(type);
+
                technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE;
                state_changed(technology);
        }