public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Pho Tran <Pho.Tran@silabs.com>
Cc: "johan@kernel.org" <johan@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Hung Nguyen <Hung.Nguyen@silabs.com>
Subject: Re: [PATCH v3] USB: serial: cp210x: Fix error 32 when hardware flow control  is enabled.
Date: Thu, 21 Jan 2021 08:39:37 +0100	[thread overview]
Message-ID: <YAkvua8BMkSh1QHs@kroah.com> (raw)
In-Reply-To: <9E531B87-06A8-45F0-A2A8-EC6FA61A99A7@silabs.com>

On Thu, Jan 21, 2021 at 07:09:13AM +0000, Pho Tran wrote:
> Fix error 32 returned by CP210X_SET_MHS when hardware flow control is enabled.
> 
> The root cause of error 32 is that user application (CoolTerm, linux-serial-test)
> opened cp210x device with hardware flow control then attempt to control RTS/DTR pins.
> In hardware flow control, RTS/DTR pins will be controlled by hardware only,
> any attempt to control those pins will cause error 32 from the device.
> This fix will block MHS command(command to control RTS/DTR pins) to the device
> if hardware flow control is being used.
> 
> Signed-off-by: Pho Tran <pho.tran@silabs.com>
> ---
> 01/19/2021: Patch v2  Modified based on comment from Johan Hovold <johan@kernel.org>
> and Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/serial/cp210x.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index fbb10dfc56e3..5b6bbda2b424 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -1204,7 +1204,12 @@ static int cp210x_tiocmset(struct tty_struct *tty,
>  		unsigned int set, unsigned int clear)
>  {
>  	struct usb_serial_port *port = tty->driver_data;
> -	return cp210x_tiocmset_port(port, set, clear);
> +	if (C_CRTSCTS(tty))
> +
> +	/* Don't send SET_MHS command if device in hardware flow control mode. */
> +		return 0;

That indentation and whitespace is very odd.  Did you run checkpatch.pl
on your change before sending it to us to verify that all is ok?

Please do so.

thanks,

greg k-h

      reply	other threads:[~2021-01-21  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  7:09 [PATCH v3] USB: serial: cp210x: Fix error 32 when hardware flow control is enabled Pho Tran
2021-01-21  7:39 ` gregkh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YAkvua8BMkSh1QHs@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Hung.Nguyen@silabs.com \
    --cc=Pho.Tran@silabs.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox