mirror of git://git.sysmocom.de/ofono
ublox: use common close_devices when modem disabled
Just reshuffling the code a bit and the 'disable' path can use the close_devices() helper to finish up. This also prevents a bug should the CFUN command fail to disable the modem whereby the 'aux' device remains open but the 'modem' device has already been closed.
This commit is contained in:
parent
4bf7671881
commit
0b3c640971
|
@ -269,15 +269,15 @@ static int ublox_enable(struct ofono_modem *modem)
|
||||||
static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
|
static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
struct ublox_data *data = ofono_modem_get_data(modem);
|
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
g_at_chat_unref(data->aux);
|
if (!ok) {
|
||||||
data->aux = NULL;
|
ofono_error("Failed to disable modem");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ok)
|
close_devices(modem);
|
||||||
ofono_modem_set_powered(modem, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ublox_disable(struct ofono_modem *modem)
|
static int ublox_disable(struct ofono_modem *modem)
|
||||||
|
@ -288,8 +288,6 @@ static int ublox_disable(struct ofono_modem *modem)
|
||||||
|
|
||||||
g_at_chat_cancel_all(data->modem);
|
g_at_chat_cancel_all(data->modem);
|
||||||
g_at_chat_unregister_all(data->modem);
|
g_at_chat_unregister_all(data->modem);
|
||||||
g_at_chat_unref(data->modem);
|
|
||||||
data->modem = NULL;
|
|
||||||
|
|
||||||
g_at_chat_cancel_all(data->aux);
|
g_at_chat_cancel_all(data->aux);
|
||||||
g_at_chat_unregister_all(data->aux);
|
g_at_chat_unregister_all(data->aux);
|
||||||
|
|
Loading…
Reference in New Issue