n_gsm: return EAGAIN only when state is OPENING for the write
authorGuillaume Lucas <guillaume.lucas@intel.com>
Thu, 26 Apr 2012 07:56:01 +0000 (09:56 +0200)
committerbuildbot <buildbot@intel.com>
Sat, 5 May 2012 12:50:19 +0000 (05:50 -0700)
commit0cbb0c9c04b611aa90e07999ff18deb5e67b0ec9
treeefd98057dd8e9ba8268fa68e00f01b6ab0f05f10
parentc6a161647fdb86e8d61ae904bc4afee6f0563a10
n_gsm: return EAGAIN only when state is OPENING for the write

BZ: 33649

With the current code the write operation will returns the EAGAIN
error if the DLCi state is not DLCI_OPEN. This was done to avoid
write before the end of the open who is asynchonous at MUX level.

Due to this change, in some the RRIL can receive this error if a
modem self reset occured at the same time. Because the DLCi will
be closed internally by the MUX but this is not yet seen at RRIL
level. This is an issue because, in this case, the RRIL will
generate an APIMR issue (instead to a MRESET issue).

This patch update the write function to:
  - returns the EAGAIN error when the state is DLCI_OPENING
  - returns the ENXIO error if the channel is not open
Signed-off-by: Guillaume Lucas <guillaume.lucas@intel.com>
Change-Id: Ie4ffbaa382f50523c4163aceed26af0e57bab92f
Reviewed-on: http://android.intel.com:8080/46341
Reviewed-by: Lucas, Guillaume <guillaume.lucas@intel.com>
Reviewed-by: Roulliere, Pierre <pierre.roulliere@intel.com>
Reviewed-by: Fremaux, Pascal <pascal.fremaux@intel.com>
Reviewed-by: Monroy, German <german.monroy@intel.com>
Reviewed-by: Predon, Frederic <frederic.predon@intel.com>
Reviewed-by: Lebsir, SamiX <samix.lebsir@intel.com>
Tested-by: Lebsir, SamiX <samix.lebsir@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/tty/n_gsm.c