All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: pl2303: fixed handling of CS5 setting
@ 2013-11-04 18:40 Colin Leitner
  2013-11-04 19:13 ` Johan Hovold
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Leitner @ 2013-11-04 18:40 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, Johan Hovold
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA

This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a
value of 0 and the CSIZE setting has been skipped altogether by the enclosing
if. Tested on 3.11.6 and the scope shows the correct output after the fix has
been applied.

Tagged to be added to stable, because it fixes a user visible driver bug and is
simple enough to backport easily.

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Colin Leitner <colin.leitner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 1e6de4c..1e3318d 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
 			    0, 0, buf, 7, 100);
 	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);

-	if (C_CSIZE(tty)) {
-		switch (C_CSIZE(tty)) {
-		case CS5:
-			buf[6] = 5;
-			break;
-		case CS6:
-			buf[6] = 6;
-			break;
-		case CS7:
-			buf[6] = 7;
-			break;
-		default:
-		case CS8:
-			buf[6] = 8;
-		}
-		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
+	switch (C_CSIZE(tty)) {
+	case CS5:
+		buf[6] = 5;
+		break;
+	case CS6:
+		buf[6] = 6;
+		break;
+	case CS7:
+		buf[6] = 7;
+		break;
+	default:
+	case CS8:
+		buf[6] = 8;
 	}
+	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);

 	/* For reference buf[0]:buf[3] baud rate value */
 	pl2303_encode_baudrate(tty, port, &buf[0]);
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] USB: pl2303: fixed handling of CS5 setting
  2013-11-04 18:40 [PATCH] USB: pl2303: fixed handling of CS5 setting Colin Leitner
@ 2013-11-04 19:13 ` Johan Hovold
  2013-11-05 18:08   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2013-11-04 19:13 UTC (permalink / raw)
  To: Colin Leitner, Greg KH; +Cc: Johan Hovold, linux-serial, linux-usb

On Mon, Nov 04, 2013 at 07:40:43PM +0100, Colin Leitner wrote:
> This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a
> value of 0 and the CSIZE setting has been skipped altogether by the enclosing
> if. Tested on 3.11.6 and the scope shows the correct output after the fix has
> been applied.
> 
> Tagged to be added to stable, because it fixes a user visible driver bug and is
> simple enough to backport easily.

Thanks! Now it applies cleanly to v3.12.

Greg, can you pick this one up for v3.13-rc? The fix could be backported
to all stable trees as the bug has been there since pre-git times.

> Cc: stable@vger.kernel.org
> Signed-off-by: Colin Leitner <colin.leitner@gmail.com>

Signed-off-by: Johan Hovold <jhovold@gmail.com>

> ---
>  drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index 1e6de4c..1e3318d 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
>  			    0, 0, buf, 7, 100);
>  	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
> 
> -	if (C_CSIZE(tty)) {
> -		switch (C_CSIZE(tty)) {
> -		case CS5:
> -			buf[6] = 5;
> -			break;
> -		case CS6:
> -			buf[6] = 6;
> -			break;
> -		case CS7:
> -			buf[6] = 7;
> -			break;
> -		default:
> -		case CS8:
> -			buf[6] = 8;
> -		}
> -		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
> +	switch (C_CSIZE(tty)) {
> +	case CS5:
> +		buf[6] = 5;
> +		break;
> +	case CS6:
> +		buf[6] = 6;
> +		break;
> +	case CS7:
> +		buf[6] = 7;
> +		break;
> +	default:
> +	case CS8:
> +		buf[6] = 8;
>  	}
> +	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
> 
>  	/* For reference buf[0]:buf[3] baud rate value */
>  	pl2303_encode_baudrate(tty, port, &buf[0]);
> -- 
> 1.7.10.4

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

* Re: [PATCH] USB: pl2303: fixed handling of CS5 setting
  2013-11-04 19:13 ` Johan Hovold
@ 2013-11-05 18:08   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2013-11-05 18:08 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Colin Leitner, linux-serial, linux-usb

On Mon, Nov 04, 2013 at 08:13:55PM +0100, Johan Hovold wrote:
> On Mon, Nov 04, 2013 at 07:40:43PM +0100, Colin Leitner wrote:
> > This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a
> > value of 0 and the CSIZE setting has been skipped altogether by the enclosing
> > if. Tested on 3.11.6 and the scope shows the correct output after the fix has
> > been applied.
> > 
> > Tagged to be added to stable, because it fixes a user visible driver bug and is
> > simple enough to backport easily.
> 
> Thanks! Now it applies cleanly to v3.12.
> 
> Greg, can you pick this one up for v3.13-rc? The fix could be backported
> to all stable trees as the bug has been there since pre-git times.
> 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Colin Leitner <colin.leitner@gmail.com>
> 
> Signed-off-by: Johan Hovold <jhovold@gmail.com>

Thanks, I'll pick this up after 3.13-rc1 is out and get it into the
stable kernels as well.

greg k-h

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

* Re: [PATCH] USB: pl2303: fixed handling of CS5 setting
  2013-11-03 22:09 Colin Leitner
@ 2013-11-04 10:13 ` Johan Hovold
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2013-11-04 10:13 UTC (permalink / raw)
  To: Colin Leitner; +Cc: gregkh, Johan Hovold, linux-serial, linux-usb

On Sun, Nov 03, 2013 at 11:09:50PM +0100, Colin Leitner wrote:
> This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a
> value of 0 and the CSIZE setting has been skipped altogether by the enclosing
> if. Tested on 3.11.6 and the scope shows the correct output after the fix has
> been applied.
> 
> Tagged to be added to stable, because it fixes a user visible driver bug and is
> simple enough to backport easily.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Colin Leitner <colin.leitner@gmail.com>

Looks good now, but I'm afraid it doesn't apply to v3.12. There were
some last minute reverts in v3.12 which could possibly explain that.

Care to rebase against v3.12 and send a v2 (v3?)?

Thanks,
Johan

> ---
>  drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index bedf8e4..fd86357 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -522,23 +522,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
>  			    0, 0, buf, 7, 100);
>  	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
> 
> -	if (C_CSIZE(tty)) {
> -		switch (C_CSIZE(tty)) {
> -		case CS5:
> -			buf[6] = 5;
> -			break;
> -		case CS6:
> -			buf[6] = 6;
> -			break;
> -		case CS7:
> -			buf[6] = 7;
> -			break;
> -		default:
> -		case CS8:
> -			buf[6] = 8;
> -		}
> -		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
> +	switch (C_CSIZE(tty)) {
> +	case CS5:
> +		buf[6] = 5;
> +		break;
> +	case CS6:
> +		buf[6] = 6;
> +		break;
> +	case CS7:
> +		buf[6] = 7;
> +		break;
> +	default:
> +	case CS8:
> +		buf[6] = 8;
>  	}
> +	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
> 
>  	/* For reference:   buf[0]:buf[3] baud rate value */
>  	pl2303_encode_baudrate(tty, port, spriv->type, buf);
> -- 
> 1.7.10.4

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

* [PATCH] USB: pl2303: fixed handling of CS5 setting
@ 2013-11-03 22:09 Colin Leitner
  2013-11-04 10:13 ` Johan Hovold
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Leitner @ 2013-11-03 22:09 UTC (permalink / raw)
  To: gregkh, Johan Hovold; +Cc: linux-serial, linux-usb

This patch fixes the CS5 setting on the PL2303 USB-to-serial devices. CS5 has a
value of 0 and the CSIZE setting has been skipped altogether by the enclosing
if. Tested on 3.11.6 and the scope shows the correct output after the fix has
been applied.

Tagged to be added to stable, because it fixes a user visible driver bug and is
simple enough to backport easily.

Cc: stable@vger.kernel.org
Signed-off-by: Colin Leitner <colin.leitner@gmail.com>
---
 drivers/usb/serial/pl2303.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index bedf8e4..fd86357 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -522,23 +522,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
 			    0, 0, buf, 7, 100);
 	dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);

-	if (C_CSIZE(tty)) {
-		switch (C_CSIZE(tty)) {
-		case CS5:
-			buf[6] = 5;
-			break;
-		case CS6:
-			buf[6] = 6;
-			break;
-		case CS7:
-			buf[6] = 7;
-			break;
-		default:
-		case CS8:
-			buf[6] = 8;
-		}
-		dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
+	switch (C_CSIZE(tty)) {
+	case CS5:
+		buf[6] = 5;
+		break;
+	case CS6:
+		buf[6] = 6;
+		break;
+	case CS7:
+		buf[6] = 7;
+		break;
+	default:
+	case CS8:
+		buf[6] = 8;
 	}
+	dev_dbg(&port->dev, "data bits = %d\n", buf[6]);

 	/* For reference:   buf[0]:buf[3] baud rate value */
 	pl2303_encode_baudrate(tty, port, spriv->type, buf);
-- 
1.7.10.4

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

end of thread, other threads:[~2013-11-05 18:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 18:40 [PATCH] USB: pl2303: fixed handling of CS5 setting Colin Leitner
2013-11-04 19:13 ` Johan Hovold
2013-11-05 18:08   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2013-11-03 22:09 Colin Leitner
2013-11-04 10:13 ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.