technology: Remove the global device hash
authorAlok Barsode <alok.barsode@linux.intel.com>
Wed, 24 Aug 2011 13:44:12 +0000 (16:44 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 25 Aug 2011 09:14:21 +0000 (11:14 +0200)
There is a device list per technology. Hence removing the global
device hash.

src/technology.c

index 849d72a..eee4981 100644 (file)
@@ -32,7 +32,6 @@
 
 static DBusConnection *connection;
 
-static GHashTable *device_table;
 static GSList *technology_list = NULL;
 
 struct connman_rfkill {
@@ -614,13 +613,6 @@ void __connman_technology_remove_interface(enum connman_service_type type,
        technology_put(technology);
 }
 
-static void unregister_technology(gpointer data)
-{
-       struct connman_technology *technology = data;
-
-       technology_put(technology);
-}
-
 int __connman_technology_add_device(struct connman_device *device)
 {
        struct connman_technology *technology;
@@ -635,8 +627,6 @@ int __connman_technology_add_device(struct connman_device *device)
        if (technology == NULL)
                return -ENXIO;
 
-       g_hash_table_insert(device_table, device, technology);
-
        if (g_atomic_int_get(&technology->blocked))
                goto done;
 
@@ -662,7 +652,7 @@ int __connman_technology_remove_device(struct connman_device *device)
        type = __connman_device_get_service_type(device);
        __connman_notifier_unregister(type);
 
-       technology = g_hash_table_lookup(device_table, device);
+       technology = technology_find(type);
        if (technology == NULL)
                return -ENXIO;
 
@@ -673,8 +663,6 @@ int __connman_technology_remove_device(struct connman_device *device)
                state_changed(technology);
        }
 
-       g_hash_table_remove(device_table, device);
-
        return 0;
 }
 
@@ -1025,9 +1013,6 @@ int __connman_technology_init(void)
 
        connection = connman_dbus_get_connection();
 
-       device_table = g_hash_table_new_full(g_direct_hash, g_direct_equal,
-                                               NULL, unregister_technology);
-
        return 0;
 }
 
@@ -1035,7 +1020,5 @@ void __connman_technology_cleanup(void)
 {
        DBG("");
 
-       g_hash_table_destroy(device_table);
-
        dbus_connection_unref(connection);
 }