mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tollef Fog Heen <tfheen@err.no>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, werner@cornelius-consult.de,
	frank@kingswood-consulting.co.uk
Subject: Re: [PATCH] Winchiphead 340/1: full baud rate and status/control line support
Date: Sun, 04 Jan 2009 22:15:51 +0100	[thread overview]
Message-ID: <87zli693i0.fsf@qurzaw.linpro.no> (raw)
In-Reply-To: <20090104121652.35a33c4c@lxorguk.ukuu.org.uk> (Alan Cox's message of "Sun, 4 Jan 2009 12:16:52 +0000")

]] Alan Cox 

| > +	if (factor > 0xfff0) { /* Clamp */
| > +		factor = 0xfff0;
| > +		divisor = 0;
| > +	}
| > +
| > +	t1 = factor;
| > +	for (t2 = divisor; t2 <= CH341_BAUDBASE_DIVMAX; t2++)
| > +		t1 >>= 3;
| > +	baud = CH341_BAUDBASE_FACTOR / t1;
| > +
| 
| Same question as before: Can baud really become zero at this point ? Also
| for that matter what guarantees that t1 cannot become zero in this
| computation ?

Nothing, that code is completely wrong.  I've rewritten it now.  Thanks
for explaining.

| > +	if (baud && tty)
| > +		tty_encode_baud_rate(tty, baud, baud);
| 
| The check for B0 (hangup) was done earlier (see set_termios). So if you
| can end up with a requested baud rate being turned into 0 you need to
| bump it up to 1. If not you don't need the test.

Indeed, fixed as well.  New patch incoming in a few minutes.

I've also added the mutex protecting set_handshake, but I feel less
confident about whether that's the right approach, so feedback there is
also appreciated.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


  reply	other threads:[~2009-01-04 21:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-04 10:22 Tollef Fog Heen
2009-01-04 12:16 ` Alan Cox
2009-01-04 21:15   ` Tollef Fog Heen [this message]
2009-01-04 21:18 ` Tollef Fog Heen
     [not found] <200807290254.m6T2sIBG010575@imap1.linux-foundation.org>
     [not found] ` <20080729104331.367fde6b@lxorguk.ukuu.org.uk>
2008-09-21  9:22   ` Tollef Fog Heen
2008-09-21 14:14     ` Alan Cox
2009-01-04 10:19       ` Tollef Fog Heen
2009-01-04 12:19         ` Alan Cox

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=87zli693i0.fsf@qurzaw.linpro.no \
    --to=tfheen@err.no \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=frank@kingswood-consulting.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=werner@cornelius-consult.de \
    /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

all inboxes | Powered by JetHome®