linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PATCH] TTY/serial driver fixes for .39
@ 2011-04-22 23:07 Greg KH
  2011-04-22 23:11 ` [PATCH 1/3] parport_pc.c: correctly release the requested region for the IT887x Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2011-04-22 23:07 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, linux-serial

Here are some small tty/serial fixes for the .39 tree.

It also includes a parport patch, as it seems relevant to the serial
drivers (resource conflict) and there's not a parport maintainer tree
anywhere that I know of.

Please pull from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/ tty-linus

All of these patches have been in the -mm and -next trees for a while.

Patches will be sent to the linux-serial mailing list, if anyone wants
to see them.

thanks,

greg k-h

------------

 drivers/parport/parport_pc.c |    8 +++-----
 drivers/tty/n_gsm.c          |    8 ++++++--
 drivers/tty/serial/imx.c     |    3 ++-
 3 files changed, 11 insertions(+), 8 deletions(-)

---------------

Mikhail Kshevetskiy (1):
      tty/n_gsm: fix bug in CRC calculation for gsm1 mode

Niels de Vos (1):
      parport_pc.c: correctly release the requested region for the IT887x

Uwe Kleine-König (1):
      serial/imx: read cts state only after acking cts change irq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] parport_pc.c: correctly release the requested region for the IT887x
  2011-04-22 23:07 [GIT PATCH] TTY/serial driver fixes for .39 Greg KH
@ 2011-04-22 23:11 ` Greg Kroah-Hartman
  2011-04-22 23:11   ` [PATCH 2/3] serial/imx: read cts state only after acking cts change irq Greg Kroah-Hartman
  2011-04-22 23:11   ` [PATCH 3/3] tty/n_gsm: fix bug in CRC calculation for gsm1 mode Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2011-04-22 23:11 UTC (permalink / raw)
  To: linux-serial; +Cc: Niels de Vos, Greg Kroah-Hartman

From: Niels de Vos <ndevos@redhat.com>

Replace release_resource() by release_region() and also fix the
inconsistency in the size of the requested/released region.

The size of the resource should be 32, not 0x8 like it was corrected in
commit e7c310c36e5fdf1b83a459e5db167bfbd86137db already.

CC: linux-serial@vger.kernel.org
Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/parport/parport_pc.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index a3755ff..bc8ce48 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
 					 const struct parport_pc_via_data *via)
 {
 	short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
-	struct resource *base_res;
 	u32 ite8872set;
 	u32 ite8872_lpt, ite8872_lpthi;
 	u8 ite8872_irq, type;
@@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
 
 	/* make sure which one chip */
 	for (i = 0; i < 5; i++) {
-		base_res = request_region(inta_addr[i], 32, "it887x");
-		if (base_res) {
+		if (request_region(inta_addr[i], 32, "it887x")) {
 			int test;
 			pci_write_config_dword(pdev, 0x60,
 						0xe5000000 | inta_addr[i]);
@@ -2571,7 +2569,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
 			test = inb(inta_addr[i]);
 			if (test != 0xff)
 				break;
-			release_region(inta_addr[i], 0x8);
+			release_region(inta_addr[i], 32);
 		}
 	}
 	if (i >= 5) {
@@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
 	/*
 	 * Release the resource so that parport_pc_probe_port can get it.
 	 */
-	release_resource(base_res);
+	release_region(inta_addr[i], 32);
 	if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
 				   irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
 		printk(KERN_INFO
-- 
1.7.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] serial/imx: read cts state only after acking cts change irq
  2011-04-22 23:11 ` [PATCH 1/3] parport_pc.c: correctly release the requested region for the IT887x Greg Kroah-Hartman
@ 2011-04-22 23:11   ` Greg Kroah-Hartman
  2011-04-22 23:11   ` [PATCH 3/3] tty/n_gsm: fix bug in CRC calculation for gsm1 mode Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2011-04-22 23:11 UTC (permalink / raw)
  To: linux-serial; +Cc: stable, Greg Kroah-Hartman, Uwe Kleine-König

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

If cts changes between reading the level at the cts input (USR1_RTSS)
and acking the irq (USR1_RTSD) the last edge doesn't generate an irq and
uart_handle_cts_change is called with a outdated value for cts.

The race was introduced by commit

	ceca629 ([ARM] 2971/1: i.MX uart handle rts irq)

Reported-by: Arwed Springer <Arwed.Springer@de.trumpf.com>
Tested-by: Arwed Springer <Arwed.Springer@de.trumpf.com>
Cc: stable@kernel.org # 2.6.14+
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/imx.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index cb36b0d..62df72d 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_port *port)
 static irqreturn_t imx_rtsint(int irq, void *dev_id)
 {
 	struct imx_port *sport = dev_id;
-	unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
+	unsigned int val;
 	unsigned long flags;
 
 	spin_lock_irqsave(&sport->port.lock, flags);
 
 	writel(USR1_RTSD, sport->port.membase + USR1);
+	val = readl(sport->port.membase + USR1) & USR1_RTSS;
 	uart_handle_cts_change(&sport->port, !!val);
 	wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
 
-- 
1.7.4.2

_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] tty/n_gsm: fix bug in CRC calculation for gsm1 mode
  2011-04-22 23:11 ` [PATCH 1/3] parport_pc.c: correctly release the requested region for the IT887x Greg Kroah-Hartman
  2011-04-22 23:11   ` [PATCH 2/3] serial/imx: read cts state only after acking cts change irq Greg Kroah-Hartman
@ 2011-04-22 23:11   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2011-04-22 23:11 UTC (permalink / raw)
  To: linux-serial; +Cc: Mikhail Kshevetskiy, stable, Greg Kroah-Hartman

From: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>

Problem description:
  gsm_queue() calculate a CRC for arrived frames. As a last step of
  CRC calculation it call

    gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);

  This work perfectly for the case of GSM0 mode as gsm->received_fcs
  contain the last piece of data required to generate final CRC.

  gsm->received_fcs is not used for GSM1 mode. Thus we put an
  additional byte to CRC calculation. As result we get a wrong CRC
  and reject incoming frame.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/n_gsm.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 47f8cdb..74273e6 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1658,8 +1658,12 @@ static void gsm_queue(struct gsm_mux *gsm)
 
 	if ((gsm->control & ~PF) == UI)
 		gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len);
-	/* generate final CRC with received FCS */
-	gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
+	if (gsm->encoding == 0){
+		/* WARNING: gsm->received_fcs is used for gsm->encoding = 0 only.
+		            In this case it contain the last piece of data
+		            required to generate final CRC */
+		gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
+	}
 	if (gsm->fcs != GOOD_FCS) {
 		gsm->bad_fcs++;
 		if (debug & 4)
-- 
1.7.4.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-22 23:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-22 23:07 [GIT PATCH] TTY/serial driver fixes for .39 Greg KH
2011-04-22 23:11 ` [PATCH 1/3] parport_pc.c: correctly release the requested region for the IT887x Greg Kroah-Hartman
2011-04-22 23:11   ` [PATCH 2/3] serial/imx: read cts state only after acking cts change irq Greg Kroah-Hartman
2011-04-22 23:11   ` [PATCH 3/3] tty/n_gsm: fix bug in CRC calculation for gsm1 mode Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).