Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338399
b: refs/heads/master
c: 9f10969
h: refs/heads/master
i:
  338397: b3e23e7
  338395: 07310ac
  338391: b5d18fd
  338383: 27ff644
  338367: c3036f4
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Oct 30, 2012
1 parent db4cbdb commit 771fefc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 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: bebe73e31d98845c8b63e624c25a5da2d819345a
refs/heads/master: 9f1096943a56c35cc85a0729ec759fd8a25e552f
29 changes: 15 additions & 14 deletions trunk/drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,10 @@ static void uart_unthrottle(struct tty_struct *tty)
uart_set_mctrl(port, TIOCM_RTS);
}

static void uart_get_info(struct tty_port *port,
struct uart_state *state,
static void do_uart_get_info(struct tty_port *port,
struct serial_struct *retinfo)
{
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = state->uart_port;

memset(retinfo, 0, sizeof(*retinfo));
Expand All @@ -662,17 +662,21 @@ static void uart_get_info(struct tty_port *port,
retinfo->iomem_base = (void *)(unsigned long)uport->mapbase;
}

static int uart_get_info_user(struct uart_state *state,
struct serial_struct __user *retinfo)
static void uart_get_info(struct tty_port *port,
struct serial_struct *retinfo)
{
struct tty_port *port = &state->port;
struct serial_struct tmp;

/* Ensure the state we copy is consistent and no hardware changes
occur as we go */
mutex_lock(&port->mutex);
uart_get_info(port, state, &tmp);
do_uart_get_info(port, retinfo);
mutex_unlock(&port->mutex);
}

static int uart_get_info_user(struct tty_port *port,
struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
uart_get_info(port, &tmp);

if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
Expand Down Expand Up @@ -1131,7 +1135,7 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd,
*/
switch (cmd) {
case TIOCGSERIAL:
ret = uart_get_info_user(state, uarg);
ret = uart_get_info_user(port, uarg);
break;

case TIOCSSERIAL:
Expand Down Expand Up @@ -2331,12 +2335,8 @@ static ssize_t uart_get_attr_uartclk(struct device *dev,
{
struct serial_struct tmp;
struct tty_port *port = dev_get_drvdata(dev);
struct uart_state *state = container_of(port, struct uart_state, port);

mutex_lock(&port->mutex);
uart_get_info(port, state, &tmp);
mutex_unlock(&port->mutex);

uart_get_info(port, &tmp);
return snprintf(buf, PAGE_SIZE, "%d\n", tmp.baud_base * 16);
}

Expand All @@ -2356,6 +2356,7 @@ static const struct attribute_group *tty_dev_attr_groups[] = {
NULL
};


/**
* uart_add_one_port - attach a driver-defined port structure
* @drv: pointer to the uart low level driver structure for this port
Expand Down

0 comments on commit 771fefc

Please sign in to comment.