From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont <remi@remlab.net>
To: ofono@ofono.org
Subject: Re: [PATCH 3/3] Add: online and post_online methods to isimodem driver
Date: Tue, 25 May 2010 23:32:15 +0300 [thread overview]
Message-ID: <201005252332.15624.remi@remlab.net> (raw)
In-Reply-To: <1274819061.3755.381.camel@tucson.research.nokia.com>
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
Le mardi 25 mai 2010 23:24:21 Aki Niemi, vous avez écrit :
> > @@ -76,9 +81,33 @@ static void report_powered(struct isi_data *isi,
> > ofono_bool_t powered)
> >
> > ofono_modem_set_powered(isi->modem, isi->reported = powered);
> >
> > }
> >
> > -static void set_power_by_mtc_state(struct isi_data *isi, int state)
> > +static void report_online(struct isi_data *isi, uint8_t mtc_state)
> >
> > {
> >
> > - switch (isi->mtc_state = state) {
> > + ofono_modem_online_cb cb = isi->online_request.callback;
> > + struct ofono_error error = {
> > + (isi->online
> > + ? mtc_state == MTC_NORMAL
> > + : mtc_state != MTC_NORMAL)
> > + ? OFONO_ERROR_TYPE_NO_ERROR
> > + : OFONO_ERROR_TYPE_FAILURE,
> > + };
>
> I can't parse this.
This is an intricate way to compare two boolean values:
((!isi->online) == (mtc_state != MTC_NORMAL))
? OFONO_ERROR_TYPE_NO_ERROR
: OFONO_ERROR_TYPE_FAILURE;
i.e. if ISI online status equals to MTC state normal, then no error,
otherwise, error. C does not provide a *logical* XOR operator that would
simplify this.
--
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
next prev parent reply other threads:[~2010-05-25 20:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 14:25 [PATCH 1/3] Add: Online property to modem Pekka Pessi
2010-05-21 14:25 ` [PATCH 2/3] Add: test scripts online-modem and offline-modem Pekka Pessi
2010-05-21 14:25 ` [PATCH 3/3] Add: online and post_online methods to isimodem driver Pekka Pessi
2010-05-25 20:24 ` Aki Niemi
2010-05-25 20:32 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont [this message]
2010-05-25 20:51 ` Aki Niemi
2010-05-25 21:01 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-05-25 21:24 ` Aki Niemi
2010-05-25 13:48 ` [PATCH 1/3] Add: Online property to modem Aki Niemi
2010-05-25 14:01 ` Aki Niemi
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=201005252332.15624.remi@remlab.net \
--to=remi@remlab.net \
--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