From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [RFC PATCH 2/4] modem: add EmergencyMode property
Date: Fri, 03 Dec 2010 13:19:58 -0600 [thread overview]
Message-ID: <4CF942DE.4010004@gmail.com> (raw)
In-Reply-To: <72f9600236cce58ec920ec3ad84b8cc34597c0ca.1290610393.git.Andras.Domokos@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 4185 bytes --]
Hi Andras,
<snip>
> +static void modem_change_online(struct ofono_modem *modem,
> + enum modem_state new_state)
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> + enum modem_state old_state = modem->modem_state;
> + ofono_bool_t new_online = new_state == MODEM_STATE_ONLINE;
> +
> + DBG("old state: %d, new state: %d", old_state, new_state);
> +
> + if (new_online == modem->online)
> + return;
You check for online not being equal here
> +
> + modem->modem_state = new_state;
> + modem->online = new_online;
> +
> + ofono_dbus_signal_property_changed(conn, modem->path,
> + OFONO_MODEM_INTERFACE, "Online",
> + DBUS_TYPE_BOOLEAN, &modem->online);
> +
> + notify_online_watches(modem);
> +}
> +
> +static void emergency_online_cb(const struct ofono_error *error, void *data)
> +{
> + struct ofono_modem *modem = data;
> +
> + DBG("modem: %p", modem);
> +
> + if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
> + modem->modem_state != MODEM_STATE_ONLINE)
And perform essentially the same check here... Seems wasteful
> + modem_change_online(modem, MODEM_STATE_ONLINE);
> +}
> +
> +static void emergency_offline_cb(const struct ofono_error *error, void *data)
> +{
> + struct ofono_modem *modem = data;
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = ofono_modem_get_path(modem);
> + gboolean state = FALSE;
> +
> + DBG("modem: %p", modem);
> +
> + if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
> + modem->modem_state == MODEM_STATE_ONLINE)
> + modem_change_online(modem, modem->modem_state_pre_emergency);
Same comment as above
> +
> + modem->emergency--;
> +
> + ofono_dbus_signal_property_changed(conn, path,
> + OFONO_MODEM_INTERFACE,
> + "Emergency",
> + DBUS_TYPE_BOOLEAN,
> + &state);
> +}
> +
> +void ofono_modem_inc_emergency(struct ofono_modem *modem)
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = ofono_modem_get_path(modem);
> + gboolean state = TRUE;
> +
> + DBG("modem: %p", modem);
> +
> + modem->emergency++;
> + if (modem->emergency > 1)
> + return;
> +
> + ofono_dbus_signal_property_changed(conn, path,
> + OFONO_MODEM_INTERFACE,
> + "Emergency",
> + DBUS_TYPE_BOOLEAN,
> + &state);
> +
> + modem->modem_state_pre_emergency = modem->modem_state;
> +
> + if (modem->modem_state == MODEM_STATE_ONLINE)
> + return;
So my only major concern left is here actually. If we activate an
emergency call and a set_property(Online, blah) is active, we get into
some funny race conditions. I mentioned these to Pekka on IRC. But
basically the worst one is if we have an Online=False operation pending.
In this case your call proceeds, but then gets terminated shortly
thereafter by the offline procedure ;)
> +
> + modem->driver->set_online(modem, TRUE, emergency_online_cb, modem);
> +}
> +
<snip>
> diff --git a/src/ofono.h b/src/ofono.h
> index d1a4bdc..11d939d 100644
> --- a/src/ofono.h
> +++ b/src/ofono.h
> @@ -58,6 +58,7 @@ DBusMessage *__ofono_error_not_attached(DBusMessage *msg);
> DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg);
> DBusMessage *__ofono_error_canceled(DBusMessage *msg);
> DBusMessage *__ofono_error_access_denied(DBusMessage *msg);
> +DBusMessage *__ofono_error_emergency_active(DBusMessage *msg);
Can you put this into a separate patch?
>
> void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply);
>
> @@ -185,6 +186,10 @@ unsigned int __ofono_modem_add_online_watch(struct ofono_modem *modem,
> void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
> unsigned int id);
>
> +ofono_bool_t ofono_modem_get_emergency(struct ofono_modem *modem);
> +void ofono_modem_inc_emergency(struct ofono_modem *modem);
> +void ofono_modem_dec_emergency(struct ofono_modem *modem);
> +
> #include <ofono/call-barring.h>
>
> gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
And please resubmit the entire series, seeing only patch 2/4 and patch
4/4 is quite confusing.
Regards,
-Denis
next prev parent reply other threads:[~2010-12-03 19:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 16:57 [PATCH 0/4] Emergency Calls (4th round) Andras Domokos
2010-11-15 16:57 ` [RFC PATCH 1/4] modem: add modem online-offline watch Andras Domokos
2010-11-22 15:58 ` Denis Kenzior
2010-11-15 16:57 ` [RFC PATCH 2/4] modem: add EmergencyMode property Andras Domokos
2010-11-23 8:46 ` Denis Kenzior
2010-11-24 15:42 ` Andras Domokos
2010-11-24 16:20 ` Andras Domokos
2010-12-03 19:19 ` Denis Kenzior [this message]
2010-12-07 16:33 ` Pekka Pessi
2010-12-08 10:55 ` Denis Kenzior
2010-11-15 16:58 ` [RFC PATCH 3/4] modem: move dial_request_cb function Andras Domokos
2010-11-15 16:58 ` [RFC PATCH 4/4] voicecall: add emergency call handling Andras Domokos
2010-11-23 9:00 ` Denis Kenzior
2010-11-24 16:09 ` Andras Domokos
2010-12-07 13:10 ` Aki Niemi
2010-11-24 16:26 ` Andras Domokos
-- strict thread matches above, loose matches on Subject: below --
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 2/4] modem: add EmergencyMode property Andras Domokos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CF942DE.4010004@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox