lkml.org 
[lkml]   [2009]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Winchiphead 340/1: full baud rate and status/control line support
Date
]] 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



\
 
 \ /
  Last update: 2009-01-04 22:19    [W:0.051 / U:1.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site