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

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?

	Regards
		Oliver

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 13:09 Oliver Neukum [this message]
2023-11-30 13:48 ` question on correct error return from break_ctl() Greg Kroah-Hartman
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=7e649033-0e1d-4c21-a1f3-ceb2de894861@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-serial@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