All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Stuart MacDonald <stuartm@connecttech.com>
Cc: "'Rogier Wolff'" <R.E.Wolff@BitWizard.nl>,
	"'Alan Cox'" <alan@lxorguk.ukuu.org.uk>,
	"'linux-os (Dick Johnson)'" <linux-os@analogic.com>,
	"'Krzysztof Halasa'" <khc@pm.waw.pl>,
	"'David Woodhouse'" <dwmw2@infradead.org>,
	linux-serial@vger.kernel.org,
	"'LKML'" <linux-kernel@vger.kernel.org>
Subject: Re: Serial custom speed deprecated?
Date: Mon, 28 Aug 2006 21:09:18 +0100	[thread overview]
Message-ID: <20060828200918.GA959@flint.arm.linux.org.uk> (raw)
In-Reply-To: <000901c6caac$478bfca0$294b82ce@stuartm>

On Mon, Aug 28, 2006 at 10:14:30AM -0400, Stuart MacDonald wrote:
> From: On Behalf Of Rogier Wolff
> > Note that IMHO, we should have started hiding this mess from /drivers/
> > a long time ago. The tty layer should convert the B_9600 thingies to
> > "9600", the integer, and then call the set_termios function. The
> > driver should be prohibited from looking at how the the baud rate came
> > to be 9600, and attempt to approach the requested baud rate as good as
> > possible. It might return a flag somewhere: Not exact. In the example
> > above, the resulting baud rate is about 1.4 baud off: 9598.6. This is
> > not a problem in very many cases.
> > 
> > Once this is in place, you lose a lot of "figure out the baud rate
> > integer from the B_xxx settings" code in all the drivers, as well as
> > that we get to provide a new interface to userspace without having to
> > change ALL drivers at the same time. This decouples the drivers from
> > the kernel<->userspace interface.
> 
> I'll second the motion. :-)

You might do, but it's incompatible with the POSIX standard.  As I
explained to Rogier (he took it off list) there's no need for "inexact"
flags.

If we pass a baud rate via tcsetattr() (or ioctl), you should set what
ever settings you can.  If you can set _no_ settings, you return an
error.  If you can set at least one setting, you do not return an error,
and you only set those settings you can do.

When you subsequently read the settings via tcgetattr(), POSIX requires
that the returned information be what the port is _actually_ doing.

So, this means that if you can only do 9599 baud and not 9600 baud,
maybe you should be returning 9599 baud.

On the same subject, if you don't support RTS/CTS flow control, and
userland requests CRTSCTS, you shouldn't be allowing CRTSCTS to be set.
And indeed, if you don't allow that in the kernel today, stty will
correctly issue a warning that it was "unable to perform all requested
operations".

So, while I whole heartedly agree with passing baud rates numerically,
I do not think we need any of this inexact flagging nonsense provided
we implement something as userland programs expect - iow, the POSIX
behaviour.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  reply	other threads:[~2006-08-28 20:09 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 21:41 Serial custom speed deprecated? Stuart MacDonald
2006-08-24  9:18 ` David Woodhouse
2006-08-24 12:41   ` Stuart MacDonald
2006-08-24 13:19     ` Alan Cox
2006-08-24 13:03       ` David Woodhouse
2006-08-24 16:27   ` Krzysztof Halasa
2006-08-24 17:41     ` Alan Cox
2006-08-24 18:51       ` Krzysztof Halasa
2006-08-24 20:43         ` linux-os (Dick Johnson)
2006-08-24 20:43           ` linux-os (Dick Johnson)
2006-08-24 22:11           ` Alan Cox
2006-08-27  6:52             ` Rogier Wolff
2006-08-27  6:52               ` Rogier Wolff
2006-08-27 10:00               ` Russell King
2006-08-28 14:14               ` Stuart MacDonald
2006-08-28 14:14                 ` Stuart MacDonald
2006-08-28 20:09                 ` Russell King [this message]
2006-08-29  6:20                   ` Rogier Wolff
2006-08-29  6:20                     ` Rogier Wolff
2006-08-29  7:46                     ` Russell King
2006-08-25 15:17           ` Stuart MacDonald
2006-08-25 15:17             ` Stuart MacDonald
2006-08-25 15:52             ` linux-os (Dick Johnson)
2006-08-25 15:52               ` linux-os (Dick Johnson)
2006-08-24 22:43         ` Alan Cox
2006-08-25 10:58           ` Krzysztof Halasa
2006-08-25 15:21           ` Stuart MacDonald
2006-08-25 15:21             ` Stuart MacDonald
2006-08-25 19:32             ` Russell King
2006-08-25 20:21               ` Stuart MacDonald
2006-08-25 20:21                 ` Stuart MacDonald
2006-08-25 20:54                 ` linux-os (Dick Johnson)
2006-08-25 20:54                   ` linux-os (Dick Johnson)
2006-08-25 20:39               ` Theodore Tso
2006-08-26 12:16                 ` Krzysztof Halasa
2006-08-25 15:10         ` Stuart MacDonald
2006-08-25 15:10           ` Stuart MacDonald
2006-08-24 22:05       ` Russell King
2006-08-25 15:01       ` Stuart MacDonald
2006-08-25 15:01         ` Stuart MacDonald
     [not found] <6N8LR-22A-5@gated-at.bofh.it>
     [not found] ` <6Njxz-797-13@gated-at.bofh.it>
     [not found]   ` <6NqfR-5Ld-49@gated-at.bofh.it>
     [not found]     ` <6NrbQ-7Ab-27@gated-at.bofh.it>
     [not found]       ` <6NsB4-2GL-37@gated-at.bofh.it>
     [not found]         ` <6NvSc-1go-31@gated-at.bofh.it>
2006-08-25 11:40           ` Nick Craig-Wood
2006-08-26 18:16 linux
2006-08-26 19:37 ` Ian Stirling
2006-08-26 20:30   ` linux
2006-08-28 12:17 ` linux-os (Dick Johnson)
2006-08-28 14:39   ` Alan Cox
2006-08-28 14:50     ` linux-os (Dick Johnson)
2006-08-28 15:51       ` Michael Poole
2006-08-28 16:57         ` linux-os (Dick Johnson)
2006-08-28 17:40           ` Michael Poole
2006-08-28 18:04             ` linux-os (Dick Johnson)
2006-08-28 17:01       ` Alan Cox
2006-08-28 17:24         ` linux
2006-08-26 19:35 linux

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=20060828200918.GA959@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=stuartm@connecttech.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 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.