forked from sailfishos/ofono
Merge pull request #205 from monich/ril_oemraw_delayed_register
[rilmodem] Remove delayed register timer in ril_oemraw_remove
This commit is contained in:
@@ -38,14 +38,18 @@
|
|||||||
struct oem_raw_data {
|
struct oem_raw_data {
|
||||||
GRil *ril;
|
GRil *ril;
|
||||||
unsigned int vendor;
|
unsigned int vendor;
|
||||||
|
guint timer_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean ril_oemraw_delayed_register(gpointer user_data)
|
static gboolean ril_oemraw_delayed_register(gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_oem_raw *raw = user_data;
|
struct ofono_oem_raw *raw = user_data;
|
||||||
|
struct oem_raw_data *od = ofono_oem_raw_get_data(raw);
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
|
od->timer_id = 0;
|
||||||
|
|
||||||
ofono_oem_raw_dbus_register(raw);
|
ofono_oem_raw_dbus_register(raw);
|
||||||
return FALSE; /* This makes the timeout a single-shot */
|
return FALSE; /* This makes the timeout a single-shot */
|
||||||
}
|
}
|
||||||
@@ -64,7 +68,8 @@ static int ril_oemraw_probe(struct ofono_oem_raw *raw, unsigned int vendor,
|
|||||||
od->vendor = vendor;
|
od->vendor = vendor;
|
||||||
ofono_oem_raw_set_data(raw, od);
|
ofono_oem_raw_set_data(raw, od);
|
||||||
|
|
||||||
g_timeout_add_seconds(1, ril_oemraw_delayed_register, raw);
|
od->timer_id = g_timeout_add_seconds(1, ril_oemraw_delayed_register,
|
||||||
|
raw);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -79,6 +84,9 @@ static void ril_oemraw_remove(struct ofono_oem_raw *raw)
|
|||||||
|
|
||||||
ofono_oem_raw_set_data(raw, NULL);
|
ofono_oem_raw_set_data(raw, NULL);
|
||||||
|
|
||||||
|
if (od->timer_id)
|
||||||
|
g_source_remove(od->timer_id);
|
||||||
|
|
||||||
g_ril_unref(od->ril);
|
g_ril_unref(od->ril);
|
||||||
g_free(od);
|
g_free(od);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user