serial: clps711x: Using resource-managed functions

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alexander Shiyan 2012-10-14 11:05:31 +04:00 committed by Greg Kroah-Hartman
parent f27de95c2a
commit 135cc79035
1 changed files with 16 additions and 21 deletions

View File

@ -94,7 +94,7 @@ static void clps711xuart_enable_ms(struct uart_port *port)
{ {
} }
static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id) static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id)
{ {
struct uart_port *port = dev_id; struct uart_port *port = dev_id;
struct tty_struct *tty = tty_port_tty_get(&port->state->port); struct tty_struct *tty = tty_port_tty_get(&port->state->port);
@ -149,7 +149,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) static irqreturn_t uart_clps711x_int_tx(int irq, void *dev_id)
{ {
struct uart_port *port = dev_id; struct uart_port *port = dev_id;
struct clps711x_port *s = dev_get_drvdata(port->dev); struct clps711x_port *s = dev_get_drvdata(port->dev);
@ -232,23 +232,20 @@ static int clps711xuart_startup(struct uart_port *port)
{ {
struct clps711x_port *s = dev_get_drvdata(port->dev); struct clps711x_port *s = dev_get_drvdata(port->dev);
unsigned int syscon; unsigned int syscon;
int retval; int ret;
s->tx_enabled[port->line] = 1; s->tx_enabled[port->line] = 1;
/* Allocate the IRQs */
ret = devm_request_irq(port->dev, TX_IRQ(port), uart_clps711x_int_tx,
0, UART_CLPS711X_NAME " TX", port);
if (ret)
return ret;
/* ret = devm_request_irq(port->dev, RX_IRQ(port), uart_clps711x_int_rx,
* Allocate the IRQs 0, UART_CLPS711X_NAME " RX", port);
*/ if (ret) {
retval = request_irq(TX_IRQ(port), clps711xuart_int_tx, 0, devm_free_irq(port->dev, TX_IRQ(port), port);
"clps711xuart_tx", port); return ret;
if (retval)
return retval;
retval = request_irq(RX_IRQ(port), clps711xuart_int_rx, 0,
"clps711xuart_rx", port);
if (retval) {
free_irq(TX_IRQ(port), port);
return retval;
} }
/* /*
@ -265,11 +262,9 @@ static void clps711xuart_shutdown(struct uart_port *port)
{ {
unsigned int ubrlcr, syscon; unsigned int ubrlcr, syscon;
/* /* Free the interrupts */
* Free the interrupt devm_free_irq(port->dev, TX_IRQ(port), port);
*/ devm_free_irq(port->dev, RX_IRQ(port), port);
free_irq(TX_IRQ(port), port); /* TX interrupt */
free_irq(RX_IRQ(port), port); /* RX interrupt */
/* /*
* disable the port * disable the port