Re-factor rilmodem initialization code to enable set online/offline
and to properly expose IMEI at all times ( even w/out SIM ).  This
also includes style cleanup of gril/gril.c.

This commit is based on code written by the following original
authors:

Original-Author: Jussi Kangas <jussi.kangas@tieto.com>
Original-Author: Miia Leinonen <miia.leinonen@oss.tieto.com>
Original-Author: Martti Piirainen <martti.piirainen@oss.tieto.com>
Original-Author: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
Fix for LP #1222106: ofono is picking the wrong APN settings in Ubuntu
Fix for LP #1231320: GPRS provisioning is broken for old (non-USIM) SIM cards in Ubuntu
rilmodem/call-volume: Fix parsing of SET_MUTE reply.

Based on commit '47ef2123723f347994e34a8e70c1183e38c3ce97' from
branch 'master' of https://github.com/nemomobile-packages/ofono.

Original-Author: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
Ensure that *netreg_data is always set in callback data (LP: 1234491).

ril_register_auto() correctly set cdb->user, whereas
ril_register_manual() did not.  As both shared the same callback
function, ril_register_cb(), and this function always expected
cdb->user to be non-NULL, calls to register_manual() could
cause a segfault.
Merge pull request #2 from tonyespy/power-control

Re-factor rilmodem initialization code to enable set online/offline
Merge pull request #5 from tonyespy/mute-fix

rilmodem/call-volume: Fix parsing of SET_MUTE reply.
Merge pull request #6 from tonyespy/netreg-crash-fix

Ensure that *netreg_data is always set in callback data (LP: 1234491).
Fix crash in ril_query_passwd_state() ( LP: 1231995 ).

A missing 'else' statement meant that if 'passwd_state'
was invalid, both CALLBACK_WITH_FAILURE *and* _WITH_SUCCESS
are called, which leads to failure as the "-1" passed to
the SUCCESS callback causes a segfault, as "-1" doesn't
map to valid enum, which is used to set a DBus string
property.
rilmodem: Fix GPRS attach/detach logic ( LP: 1234434 ).

When the primary context was shutdown, the active_ctx_cid was
being reset before rilmodem notified the core that the context
had been deactified.  This meant an invalid (-1) cid was passed
to the core, and thus the context wasn't being cleaned up properly,
which in turn could cause the attach code to quit responding to
subsequent attaches ( either from DBus requests, or DATA
registration changes.
Merge pull request #7 from tonyespy/sim-passwd-crash-fix

Fix crash in ril_query_passwd_state() ( LP: 1231995 ).
Merge pull request #3 from alfonsosanchezbeato/apn_settings

Fix for LP #1222106: ofono is picking the wrong APN settings in Ubuntu
Merge pull request #4 from alfonsosanchezbeato/mnc_length

Fix for LP #1231320: GPRS provisioning is broken for old (non-USIM) SIM cards in Ubuntu
rilmodem/gprs-context: re-factored code to make all context ids gints.

The rilmodem gprs-context code internally stored context ids
as guints, and used -1 to indicate IDLE/disconnected state.
As rild and the core ofono code only used gints, this led
to casting issues, and also was confused the code, as the
gprs_context_data struct also includes a status field which
more clearly be used to check state.
Merge pull request #8 from tonyespy/gprs-lp1234434

Gprs lp1234434