Commit d5a45662 authored by Russell King's avatar Russell King

[SERIAL] Drop "level" argument from serial PM calls.

Since the driver model has transitioned away from using multi-level
device suspend/resume, we also drop the multi-level support from
the serial layer.

Update the 8250 and sa1100 drivers for this change.
parent da2df98a
...@@ -2101,9 +2101,9 @@ void serial8250_get_irq_map(unsigned int *map) ...@@ -2101,9 +2101,9 @@ void serial8250_get_irq_map(unsigned int *map)
* *
* Suspend one serial port. * Suspend one serial port.
*/ */
void serial8250_suspend_port(int line, u32 level) void serial8250_suspend_port(int line)
{ {
uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port, level); uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port);
} }
/** /**
...@@ -2112,9 +2112,9 @@ void serial8250_suspend_port(int line, u32 level) ...@@ -2112,9 +2112,9 @@ void serial8250_suspend_port(int line, u32 level)
* *
* Resume one serial port. * Resume one serial port.
*/ */
void serial8250_resume_port(int line, u32 level) void serial8250_resume_port(int line)
{ {
uart_resume_port(&serial8250_reg, &serial8250_ports[line].port, level); uart_resume_port(&serial8250_reg, &serial8250_ports[line].port);
} }
static int __init serial8250_init(void) static int __init serial8250_init(void)
......
...@@ -27,8 +27,8 @@ struct serial8250_probe { ...@@ -27,8 +27,8 @@ struct serial8250_probe {
int serial8250_register_probe(struct serial8250_probe *probe); int serial8250_register_probe(struct serial8250_probe *probe);
void serial8250_unregister_probe(struct serial8250_probe *probe); void serial8250_unregister_probe(struct serial8250_probe *probe);
void serial8250_get_irq_map(unsigned int *map); void serial8250_get_irq_map(unsigned int *map);
void serial8250_suspend_port(int line, u32 level); void serial8250_suspend_port(int line);
void serial8250_resume_port(int line, u32 level); void serial8250_resume_port(int line);
struct old_serial_port { struct old_serial_port {
unsigned int uart; unsigned int uart;
......
...@@ -1600,19 +1600,6 @@ static void __devexit pciserial_remove_one(struct pci_dev *dev) ...@@ -1600,19 +1600,6 @@ static void __devexit pciserial_remove_one(struct pci_dev *dev)
} }
} }
static int pciserial_save_state_one(struct pci_dev *dev, u32 state)
{
struct serial_private *priv = pci_get_drvdata(dev);
if (priv) {
int i;
for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_SAVE_STATE);
}
return 0;
}
static int pciserial_suspend_one(struct pci_dev *dev, u32 state) static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
{ {
struct serial_private *priv = pci_get_drvdata(dev); struct serial_private *priv = pci_get_drvdata(dev);
...@@ -1621,7 +1608,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, u32 state) ...@@ -1621,7 +1608,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
int i; int i;
for (i = 0; i < priv->nr; i++) for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_POWER_DOWN); serial8250_suspend_port(priv->line[i]);
} }
return 0; return 0;
} }
...@@ -1639,10 +1626,8 @@ static int pciserial_resume_one(struct pci_dev *dev) ...@@ -1639,10 +1626,8 @@ static int pciserial_resume_one(struct pci_dev *dev)
if (priv->quirk->init) if (priv->quirk->init)
priv->quirk->init(dev); priv->quirk->init(dev);
for (i = 0; i < priv->nr; i++) { for (i = 0; i < priv->nr; i++)
serial8250_resume_port(priv->line[i], RESUME_POWER_ON); serial8250_resume_port(priv->line[i]);
serial8250_resume_port(priv->line[i], RESUME_RESTORE_STATE);
}
} }
return 0; return 0;
} }
...@@ -2040,7 +2025,6 @@ static struct pci_driver serial_pci_driver = { ...@@ -2040,7 +2025,6 @@ static struct pci_driver serial_pci_driver = {
.name = "serial", .name = "serial",
.probe = pciserial_init_one, .probe = pciserial_init_one,
.remove = __devexit_p(pciserial_remove_one), .remove = __devexit_p(pciserial_remove_one),
.save_state = pciserial_save_state_one,
.suspend = pciserial_suspend_one, .suspend = pciserial_suspend_one,
.resume = pciserial_resume_one, .resume = pciserial_resume_one,
.id_table = serial_pci_tbl, .id_table = serial_pci_tbl,
......
...@@ -862,8 +862,8 @@ static int sa1100_serial_suspend(struct device *_dev, u32 state, u32 level) ...@@ -862,8 +862,8 @@ static int sa1100_serial_suspend(struct device *_dev, u32 state, u32 level)
{ {
struct sa1100_port *sport = dev_get_drvdata(_dev); struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport) if (sport && level == SUSPEND_DISABLE)
uart_suspend_port(&sa1100_reg, &sport->port, level); uart_suspend_port(&sa1100_reg, &sport->port);
return 0; return 0;
} }
...@@ -872,8 +872,8 @@ static int sa1100_serial_resume(struct device *_dev, u32 level) ...@@ -872,8 +872,8 @@ static int sa1100_serial_resume(struct device *_dev, u32 level)
{ {
struct sa1100_port *sport = dev_get_drvdata(_dev); struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport) if (sport && level == RESUME_ENABLE)
uart_resume_port(&sa1100_reg, &sport->port, level); uart_resume_port(&sa1100_reg, &sport->port);
return 0; return 0;
} }
......
...@@ -1875,84 +1875,72 @@ static void uart_change_pm(struct uart_state *state, int pm_state) ...@@ -1875,84 +1875,72 @@ static void uart_change_pm(struct uart_state *state, int pm_state)
state->pm_state = pm_state; state->pm_state = pm_state;
} }
int uart_suspend_port(struct uart_driver *drv, struct uart_port *port, u32 level) int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
{ {
struct uart_state *state = drv->state + port->line; struct uart_state *state = drv->state + port->line;
down(&state->sem); down(&state->sem);
switch (level) { if (state->info && state->info->flags & UIF_INITIALIZED) {
case SUSPEND_SAVE_STATE: struct uart_ops *ops = port->ops;
if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops;
spin_lock_irq(&port->lock); spin_lock_irq(&port->lock);
ops->stop_tx(port, 0); ops->stop_tx(port, 0);
ops->set_mctrl(port, 0); ops->set_mctrl(port, 0);
ops->stop_rx(port); ops->stop_rx(port);
spin_unlock_irq(&port->lock); spin_unlock_irq(&port->lock);
/*
* Wait for the transmitter to empty.
*/
while (!ops->tx_empty(port)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ/1000);
}
set_current_state(TASK_RUNNING);
ops->shutdown(port);
}
break;
case SUSPEND_POWER_DOWN:
/* /*
* Disable the console device before suspending. * Wait for the transmitter to empty.
*/ */
if (uart_console(port)) while (!ops->tx_empty(port)) {
port->cons->flags &= ~CON_ENABLED; set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ/1000);
}
set_current_state(TASK_RUNNING);
uart_change_pm(state, 3); ops->shutdown(port);
break;
} }
/*
* Disable the console device before suspending.
*/
if (uart_console(port))
port->cons->flags &= ~CON_ENABLED;
uart_change_pm(state, 3);
up(&state->sem); up(&state->sem);
return 0; return 0;
} }
int uart_resume_port(struct uart_driver *drv, struct uart_port *port, u32 level) int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
{ {
struct uart_state *state = drv->state + port->line; struct uart_state *state = drv->state + port->line;
down(&state->sem); down(&state->sem);
switch (level) { uart_change_pm(state, 0);
case RESUME_POWER_ON:
uart_change_pm(state, 0);
/* /*
* Re-enable the console device after suspending. * Re-enable the console device after suspending.
*/ */
if (uart_console(port)) { if (uart_console(port)) {
uart_change_speed(state, NULL); uart_change_speed(state, NULL);
port->cons->flags |= CON_ENABLED; port->cons->flags |= CON_ENABLED;
} }
break;
case RESUME_RESTORE_STATE: if (state->info && state->info->flags & UIF_INITIALIZED) {
if (state->info && state->info->flags & UIF_INITIALIZED) { struct uart_ops *ops = port->ops;
struct uart_ops *ops = port->ops;
ops->set_mctrl(port, 0); ops->set_mctrl(port, 0);
ops->startup(port); ops->startup(port);
uart_change_speed(state, NULL); uart_change_speed(state, NULL);
spin_lock_irq(&port->lock); spin_lock_irq(&port->lock);
ops->set_mctrl(port, port->mctrl); ops->set_mctrl(port, port->mctrl);
ops->start_tx(port, 0); ops->start_tx(port, 0);
spin_unlock_irq(&port->lock); spin_unlock_irq(&port->lock);
}
break;
} }
up(&state->sem); up(&state->sem);
......
...@@ -325,8 +325,8 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); ...@@ -325,8 +325,8 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
/* /*
* Power Management * Power Management
*/ */
int uart_suspend_port(struct uart_driver *reg, struct uart_port *port, u32 level); int uart_suspend_port(struct uart_driver *reg, struct uart_port *port);
int uart_resume_port(struct uart_driver *reg, struct uart_port *port, u32 level); int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
#define uart_circ_empty(circ) ((circ)->head == (circ)->tail) #define uart_circ_empty(circ) ((circ)->head == (circ)->tail)
#define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0) #define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment