summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-08-10 11:58:32 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-08-10 11:58:32 +0200
commitd3073cdb94002354fe6e37e39557402ddfb30561 (patch)
tree3d50d531620fad14b262f0891937c5a2336b3c86
parent746e33bd6337b3abb7e2823f3b6afc83bf29b549 (diff)
downloadconnman-d3073cdb94002354fe6e37e39557402ddfb30561.tar.gz
connman-d3073cdb94002354fe6e37e39557402ddfb30561.tar.bz2
connman-d3073cdb94002354fe6e37e39557402ddfb30561.zip
Let the core handle the children unregister task
-rw-r--r--plugins/ethernet.c40
1 files changed, 1 insertions, 39 deletions
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index b9089409..0f248bca 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -38,9 +38,6 @@
static GStaticMutex ethernet_mutex = G_STATIC_MUTEX_INIT;
static GSList *ethernet_list = NULL;
-static GStaticMutex element_mutex = G_STATIC_MUTEX_INIT;
-static GSList *element_list = NULL;
-
static void create_element(struct connman_element *parent,
enum connman_element_type type)
{
@@ -54,42 +51,9 @@ static void create_element(struct connman_element *parent,
element->netdev.index = parent->netdev.index;
element->netdev.name = g_strdup(parent->netdev.name);
- g_static_mutex_lock(&element_mutex);
- element_list = g_slist_append(element_list, element);
- g_static_mutex_unlock(&element_mutex);
-
connman_element_register(element, parent);
}
-static void remove_elements(struct connman_element *parent)
-{
- GSList *list = element_list;
-
- DBG("parent %p name %s", parent, parent->name);
-
- g_static_mutex_lock(&element_mutex);
-
- while (list) {
- GSList *next = list->next;
- struct connman_element *element = list->data;
-
- if (element->netdev.index != parent->netdev.index) {
- list = next;
- continue;
- }
-
- element_list = g_slist_delete_link(element_list, list);
-
- connman_element_unregister(element);
-
- connman_element_unref(element);
-
- list = next;
- }
-
- g_static_mutex_unlock(&element_mutex);
-}
-
static void rtnl_link(struct nlmsghdr *hdr, const char *type)
{
GSList *list;
@@ -127,7 +91,7 @@ static void rtnl_link(struct nlmsghdr *hdr, const char *type)
} else {
DBG("carrier off");
- remove_elements(element);
+ connman_element_unregister_children(element);
}
}
@@ -327,8 +291,6 @@ static void ethernet_remove(struct connman_element *element)
iface_down(element);
- remove_elements(element);
-
g_static_mutex_lock(&ethernet_mutex);
ethernet_list = g_slist_remove(ethernet_list, element);
g_static_mutex_unlock(&ethernet_mutex);