From: Guillaume Lucas Date: Thu, 26 Apr 2012 07:56:01 +0000 (+0200) Subject: n_gsm: return EAGAIN only when state is OPENING for the write X-Git-Tag: 2.1b_release~841 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cbb0c9c04b611aa90e07999ff18deb5e67b0ec9;p=kernel%2Fkernel-mfld-blackbay.git 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 Change-Id: Ie4ffbaa382f50523c4163aceed26af0e57bab92f Reviewed-on: http://android.intel.com:8080/46341 Reviewed-by: Lucas, Guillaume Reviewed-by: Roulliere, Pierre Reviewed-by: Fremaux, Pascal Reviewed-by: Monroy, German Reviewed-by: Predon, Frederic Reviewed-by: Lebsir, SamiX Tested-by: Lebsir, SamiX Reviewed-by: buildbot Tested-by: buildbot --- diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 38a4dde..1641e5c 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3054,9 +3054,12 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, struct gsm_dlci *dlci = tty->driver_data; int sent; - if (dlci->state != DLCI_OPEN) + if (dlci->state == DLCI_OPENING) return -EAGAIN; + if (dlci->state != DLCI_OPEN) + return -ENXIO; + /* Stuff the bytes into the fifo queue */ sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock); /* Need to kick the channel */