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>