Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Johan Hovold <johan@kernel.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	USB list <linux-usb@vger.kernel.org>,
	linux-serial@vger.kernel.org
Subject: Re: question on correct error return from break_ctl()
Date: Thu, 30 Nov 2023 13:48:24 +0000	[thread overview]
Message-ID: <2023113055-molecular-backlands-6b3d@gregkh> (raw)
In-Reply-To: <7e649033-0e1d-4c21-a1f3-ceb2de894861@suse.com>

On Thu, Nov 30, 2023 at 02:09:48PM +0100, Oliver Neukum wrote:
> Hi,
> 
> it seems inconsistent. The tty layer
> in drivers/tty/tty_io.c::send_break()
> 
> static int send_break(struct tty_struct *tty, unsigned int duration)
> {
>         int retval;
> 
>         if (tty->ops->break_ctl == NULL)
>                 return 0;
> 
> not supporting break_ctl() is treated as the operation
> succeeding. Yet in drivers/usb/serial/usb-serial.c::serial_break()
> 
> static int serial_break(struct tty_struct *tty, int break_state)
> {
>         struct usb_serial_port *port = tty->driver_data;
> 
>         dev_dbg(&port->dev, "%s\n", __func__);
> 
>         if (port->serial->type->break_ctl)
>                 return port->serial->type->break_ctl(tty, break_state);
> 
>         return -ENOTTY;
> }
> 
> we are seeing that not supporting break_ctl() leads to returning
> -ENOTTY, which drivers/tty/tty_io.c::send_break() will return to user space.
> These reactions are at odds with each other. What is a driver supposed
> to do?

usb-serial should probably change, but given the fact that no one has
noticed this in the 20+ years it has been like this, is it really
needed?  :)

thanks,

greg k-h

  reply	other threads:[~2023-11-30 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 13:09 question on correct error return from break_ctl() Oliver Neukum
2023-11-30 13:48 ` Greg Kroah-Hartman [this message]
2023-11-30 14:36   ` Oliver Neukum
2023-11-30 14:42     ` Greg Kroah-Hartman
2023-11-30 15:12       ` Johan Hovold

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=2023113055-molecular-backlands-6b3d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    /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