Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146298
b: refs/heads/master
c: 7d55dea
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Jun 11, 2009
1 parent b989a7f commit 9109081
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34aec591847c696339189b070cce2a11f901cfea
refs/heads/master: 7d55deaf50182c47c1e805dc8cc85f2769f0673e
24 changes: 15 additions & 9 deletions trunk/drivers/serial/timbuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int get_bindex(int baud)
int i;

for (i = 0; i < ARRAY_SIZE(baudrates); i++)
if (baud == baudrates[i])
if (baud <= baudrates[i])
return i;

return -1;
Expand All @@ -296,14 +296,20 @@ static void timbuart_set_termios(struct uart_port *port,
bindex = get_bindex(baud);
dev_dbg(port->dev, "%s - bindex %d\n", __func__, bindex);

if (bindex < 0) {
printk(KERN_ALERT "timbuart: Unsupported baud rate\n");
} else {
spin_lock_irqsave(&port->lock, flags);
iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE);
uart_update_timeout(port, termios->c_cflag, baud);
spin_unlock_irqrestore(&port->lock, flags);
}
if (bindex < 0)
bindex = 0;
baud = baudrates[bindex];

/* The serial layer calls into this once with old = NULL when setting
up initially */
if (old)
tty_termios_copy_hw(termios, old);
tty_termios_encode_baud_rate(termios, baud, baud);

spin_lock_irqsave(&port->lock, flags);
iowrite8((u8)bindex, port->membase + TIMBUART_BAUDRATE);
uart_update_timeout(port, termios->c_cflag, baud);
spin_unlock_irqrestore(&port->lock, flags);
}

static const char *timbuart_type(struct uart_port *port)
Expand Down

0 comments on commit 9109081

Please sign in to comment.