From: Marcel Holtmann Date: Sun, 10 Aug 2008 09:58:32 +0000 (+0200) Subject: Let the core handle the children unregister task X-Git-Tag: 0.1~249 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3073cdb94002354fe6e37e39557402ddfb30561;p=platform%2Fupstream%2Fconnman.git Let the core handle the children unregister task --- diff --git a/plugins/ethernet.c b/plugins/ethernet.c index b908940..0f248bc 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(ðernet_mutex); ethernet_list = g_slist_remove(ethernet_list, element); g_static_mutex_unlock(ðernet_mutex);