diff mbox series

USB: serial: console: add support for enabling flow control

Message ID 20200701173722.4536-1-johan@kernel.org (mailing list archive)
State Mainlined
Commit cabe0785ff14e944ab1d828bed64e796e8f96594
Headers show
Series USB: serial: console: add support for enabling flow control | expand

Commit Message

Johan Hovold July 1, 2020, 5:37 p.m. UTC
Add support for enabling hardware flow control using the 'r' command
line option.

This also avoids a W=1 (-Wunused-but-set-variable) warning.

Signed-off-by: Johan Hovold <johan@kernel.org>
---

Missed this one at first... The white space change is done on purpose to
remove a stray tab.

Johan


 drivers/usb/serial/console.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Greg KH July 2, 2020, 7:38 a.m. UTC | #1
On Wed, Jul 01, 2020 at 07:37:22PM +0200, Johan Hovold wrote:
> Add support for enabling hardware flow control using the 'r' command
> line option.
> 
> This also avoids a W=1 (-Wunused-but-set-variable) warning.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> 
> Missed this one at first... The white space change is done on purpose to
> remove a stray tab.
> 
> Johan
> 
> 
>  drivers/usb/serial/console.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
> index 7d289302ff6c..b97aa40ca4d1 100644
> --- a/drivers/usb/serial/console.c
> +++ b/drivers/usb/serial/console.c
> @@ -79,7 +79,7 @@ static int usb_console_setup(struct console *co, char *options)
>  		if (*s)
>  			doflow = (*s++ == 'r');
>  	}
> -	
> +
>  	/* Sane default */
>  	if (baud == 0)
>  		baud = 9600;
> @@ -102,6 +102,9 @@ static int usb_console_setup(struct console *co, char *options)
>  		break;
>  	}
>  
> +	if (doflow)
> +		cflag |= CRTSCTS;
> +
>  	/*
>  	 * no need to check the index here: if the index is wrong, console
>  	 * code won't call us
> -- 
> 2.26.2
> 

Nice fix!

And I think one of the first real "bugfixes" that have come out of the
recent W=1 work...

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Johan Hovold July 2, 2020, 8:44 a.m. UTC | #2
On Thu, Jul 02, 2020 at 09:38:28AM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jul 01, 2020 at 07:37:22PM +0200, Johan Hovold wrote:
> > Add support for enabling hardware flow control using the 'r' command
> > line option.
> > 
> > This also avoids a W=1 (-Wunused-but-set-variable) warning.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>

> >  drivers/usb/serial/console.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
> > index 7d289302ff6c..b97aa40ca4d1 100644
> > --- a/drivers/usb/serial/console.c
> > +++ b/drivers/usb/serial/console.c

> > @@ -102,6 +102,9 @@ static int usb_console_setup(struct console *co, char *options)
> >  		break;
> >  	}
> >  
> > +	if (doflow)
> > +		cflag |= CRTSCTS;
> > +
> >  	/*
> >  	 * no need to check the index here: if the index is wrong, console
> >  	 * code won't call us
> > -- 
> > 2.26.2
> > 
> 
> Nice fix!

Or is it a new feature? ;)

> And I think one of the first real "bugfixes" that have come out of the
> recent W=1 work...

Yeah, first one I've seen too.

> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks for reviewing. All of these now applied.

Johan
diff mbox series

Patch

diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 7d289302ff6c..b97aa40ca4d1 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -79,7 +79,7 @@  static int usb_console_setup(struct console *co, char *options)
 		if (*s)
 			doflow = (*s++ == 'r');
 	}
-	
+
 	/* Sane default */
 	if (baud == 0)
 		baud = 9600;
@@ -102,6 +102,9 @@  static int usb_console_setup(struct console *co, char *options)
 		break;
 	}
 
+	if (doflow)
+		cflag |= CRTSCTS;
+
 	/*
 	 * no need to check the index here: if the index is wrong, console
 	 * code won't call us