summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorMinjun Li <minjun.li@intel.com>2009-06-02 08:50:35 +0800
committerDenis Kenzior <denkenz@gmail.com>2009-06-02 21:36:20 -0500
commite387488f024eecde6de6081a29f551aab2ba118b (patch)
treefcb653288c81ea2d566fef66fd5db9e382cde11d /drivers/atmodem
parent2271bca98588698a9fadb422baaf1e78f9b18d6a (diff)
downloadofono-e387488f024eecde6de6081a29f551aab2ba118b.tar.bz2
Adding common unregister code in atmodem driver
Modem cleanup happens in two places: manager_free (ofono exit) and manager_destroy (manually removing a specific modem). Both need to unregister the entire set of registered interfaces. manager_destroy function did not unregister all interfaces. Fixed by adding a common function for both code paths.
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/atmodem.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/atmodem/atmodem.c b/drivers/atmodem/atmodem.c
index 2f1e4304..20b95a5f 100644
--- a/drivers/atmodem/atmodem.c
+++ b/drivers/atmodem/atmodem.c
@@ -90,6 +90,19 @@ static void at_destroy(struct at_data *at)
g_free(at);
}
+static void interface_exit(struct at_data *at)
+{
+ at_sms_exit(at->modem);
+ at_call_forwarding_exit(at->modem);
+ at_call_settings_exit(at->modem);
+ at_network_registration_exit(at->modem);
+ at_voicecall_exit(at->modem);
+ at_call_meter_exit(at->modem);
+ at_call_barring_exit(at->modem);
+ at_ussd_exit(at->modem);
+ at_sim_exit(at->modem);
+}
+
static void manager_free(gpointer user)
{
GSList *l;
@@ -102,15 +115,7 @@ static void manager_free(gpointer user)
for (l = g_sessions; l; l = l->next) {
struct at_data *at = l->data;
- at_sms_exit(at->modem);
- at_call_forwarding_exit(at->modem);
- at_call_settings_exit(at->modem);
- at_network_registration_exit(at->modem);
- at_voicecall_exit(at->modem);
- at_call_meter_exit(at->modem);
- at_call_barring_exit(at->modem);
- at_ussd_exit(at->modem);
- at_sim_exit(at->modem);
+ interface_exit(at);
ofono_modem_unregister(at->modem);
at_destroy(at);
@@ -421,8 +426,7 @@ static DBusMessage *manager_destroy(DBusConnection *conn, DBusMessage *msg,
if (strcmp(at->modem->path, path))
continue;
- at_network_registration_exit(at->modem);
- at_voicecall_exit(at->modem);
+ interface_exit(at);
ofono_modem_unregister(at->modem);
g_sessions = g_slist_remove(g_sessions, at);