Open Source Telephony
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH] emulator: force creation of atom at modem offline state
Date: Thu, 17 Feb 2011 18:23:29 +0100	[thread overview]
Message-ID: <1297963409-9798-1-git-send-email-frederic.danis@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

this allows to fix problem when atom created in online state
are destroyed when modem goes to offline state
---
 src/emulator.c |    3 ++-
 src/modem.c    |   14 ++++++++++++++
 src/ofono.h    |    5 +++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 5744903..101b33d 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -115,7 +115,8 @@ struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
 
 	em->type = type;
 
-	em->atom = __ofono_modem_add_atom(modem, atom_t, emulator_remove, em);
+	em->atom = __ofono_modem_add_atom_offline(modem, atom_t,
+							emulator_remove, em);
 
 	return em;
 }
diff --git a/src/modem.c b/src/modem.c
index 8567cac..bf8b0c0 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -189,6 +189,20 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
 	return atom;
 }
 
+struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
+					enum ofono_atom_type type,
+					void (*destruct)(struct ofono_atom *),
+					void *data)
+{
+	struct ofono_atom *atom;
+
+	atom = __ofono_modem_add_atom(modem, type, destruct, data);
+
+	atom->modem_state = MODEM_STATE_OFFLINE;
+
+	return atom;
+}
+
 void *__ofono_atom_get_data(struct ofono_atom *atom)
 {
 	return atom->data;
diff --git a/src/ofono.h b/src/ofono.h
index f52356e..9d13684 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -148,6 +148,11 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
 					void (*destruct)(struct ofono_atom *),
 					void *data);
 
+struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
+					enum ofono_atom_type type,
+					void (*destruct)(struct ofono_atom *),
+					void *data);
+
 struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem,
 						enum ofono_atom_type type);
 
-- 
1.7.1


             reply	other threads:[~2011-02-17 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17 17:23 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-02-17 17:26 ` [PATCH] emulator: force creation of atom at modem offline state Denis Kenzior

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=1297963409-9798-1-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.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