[PATCH 3/3] Add: online and post_online methods to isimodem driver
Rémi Denis-Courmont
remi at remlab.net
Tue May 25 13:32:15 PDT 2010
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
More information about the ofono
mailing list