|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] console+serial: don't open-code IRQ-safe locking primitives
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1010,8 +1010,7 @@ vprintk_common(const char *fmt, va_list
unsigned long flags;
/* console_lock can be acquired recursively from __printk_ratelimit(). */
- local_irq_save(flags);
- rspin_lock(&console_lock);
+ flags = rspin_lock_irqsave(&console_lock);
state = &this_cpu(state);
(void)vsnprintf(buf, sizeof(buf), fmt, args);
@@ -1047,8 +1046,7 @@ vprintk_common(const char *fmt, va_list
state->continued = 1;
}
- rspin_unlock(&console_lock);
- local_irq_restore(flags);
+ rspin_unlock_irqrestore(&console_lock, flags);
}
void vprintk(const char *fmt, va_list args)
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -76,17 +76,15 @@ void serial_tx_interrupt(struct serial_p
int i, n;
unsigned long flags;
- local_irq_save(flags);
-
/*
* Avoid spinning for a long time: if there is a long-term lock holder
* then we know that they'll be stuffing bytes into the transmitter which
* will therefore not be empty for long.
*/
- while ( !spin_trylock(&port->tx_lock) )
+ while ( !spin_trylock_irqsave(&port->tx_lock, flags) )
{
if ( port->driver->tx_ready(port) <= 0 )
- goto out;
+ return;
cpu_relax();
}
@@ -94,7 +92,6 @@ void serial_tx_interrupt(struct serial_p
{
/* Disable TX. nothing to send */
serial_stop_tx(port);
- spin_unlock(&port->tx_lock);
goto out;
}
else
@@ -112,10 +109,8 @@ void serial_tx_interrupt(struct serial_p
if ( i && port->driver->flush )
port->driver->flush(port);
- spin_unlock(&port->tx_lock);
-
out:
- local_irq_restore(flags);
+ spin_unlock_irqrestore(&port->tx_lock, flags);
}
static void __serial_putc(struct serial_port *port, char c)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |