[IA64-SGI] sn_console.c minor cleanup
Fix printk level and remove unnecessary CONFIG_SMP|CONFIG_PREEMPT tests as this is taken care through the spinlock macros anyway. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Pat Gefre <pfg@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
* driver for that.
|
* driver for that.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
|
* Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms of version 2 of the GNU General Public License
|
* under the terms of version 2 of the GNU General Public License
|
||||||
@@ -829,8 +829,8 @@ static int __init sn_sal_module_init(void)
|
|||||||
misc.name = DEVICE_NAME_DYNAMIC;
|
misc.name = DEVICE_NAME_DYNAMIC;
|
||||||
retval = misc_register(&misc);
|
retval = misc_register(&misc);
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
printk
|
printk(KERN_WARNING "Failed to register console "
|
||||||
("Failed to register console device using misc_register.\n");
|
"device using misc_register.\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
sal_console_uart.major = MISC_MAJOR;
|
sal_console_uart.major = MISC_MAJOR;
|
||||||
@@ -942,20 +942,21 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||||||
{
|
{
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
struct sn_cons_port *port = &sal_console_port;
|
struct sn_cons_port *port = &sal_console_port;
|
||||||
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
|
|
||||||
static int stole_lock = 0;
|
static int stole_lock = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
BUG_ON(!port->sc_is_asynch);
|
BUG_ON(!port->sc_is_asynch);
|
||||||
|
|
||||||
/* We can't look at the xmit buffer if we're not registered with serial core
|
/* We can't look at the xmit buffer if we're not registered with serial core
|
||||||
* yet. So only do the fancy recovery after registering
|
* yet. So only do the fancy recovery after registering
|
||||||
*/
|
*/
|
||||||
if (port->sc_port.info) {
|
if (!port->sc_port.info) {
|
||||||
|
/* Not yet registered with serial core - simple case */
|
||||||
|
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* somebody really wants this output, might be an
|
/* somebody really wants this output, might be an
|
||||||
* oops, kdb, panic, etc. make sure they get it. */
|
* oops, kdb, panic, etc. make sure they get it. */
|
||||||
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
|
|
||||||
if (spin_is_locked(&port->sc_port.lock)) {
|
if (spin_is_locked(&port->sc_port.lock)) {
|
||||||
int lhead = port->sc_port.info->xmit.head;
|
int lhead = port->sc_port.info->xmit.head;
|
||||||
int ltail = port->sc_port.info->xmit.tail;
|
int ltail = port->sc_port.info->xmit.tail;
|
||||||
@@ -976,25 +977,20 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||||||
if (!spin_is_locked(&port->sc_port.lock)
|
if (!spin_is_locked(&port->sc_port.lock)
|
||||||
|| stole_lock) {
|
|| stole_lock) {
|
||||||
if (!stole_lock) {
|
if (!stole_lock) {
|
||||||
spin_lock_irqsave(&port->
|
spin_lock_irqsave(&port->sc_port.lock,
|
||||||
sc_port.lock,
|
|
||||||
flags);
|
flags);
|
||||||
got_lock = 1;
|
got_lock = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* still locked */
|
/* still locked */
|
||||||
if ((lhead !=
|
if ((lhead != port->sc_port.info->xmit.head)
|
||||||
port->sc_port.info->xmit.head)
|
|
||||||
|| (ltail !=
|
|| (ltail !=
|
||||||
port->sc_port.info->xmit.
|
port->sc_port.info->xmit.tail)) {
|
||||||
tail)) {
|
|
||||||
lhead =
|
lhead =
|
||||||
port->sc_port.info->xmit.
|
port->sc_port.info->xmit.head;
|
||||||
head;
|
|
||||||
ltail =
|
ltail =
|
||||||
port->sc_port.info->xmit.
|
port->sc_port.info->xmit.tail;
|
||||||
tail;
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1002,8 +998,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||||||
/* flush anything in the serial core xmit buffer, raw */
|
/* flush anything in the serial core xmit buffer, raw */
|
||||||
sn_transmit_chars(port, 1);
|
sn_transmit_chars(port, 1);
|
||||||
if (got_lock) {
|
if (got_lock) {
|
||||||
spin_unlock_irqrestore(&port->sc_port.lock,
|
spin_unlock_irqrestore(&port->sc_port.lock, flags);
|
||||||
flags);
|
|
||||||
stole_lock = 0;
|
stole_lock = 0;
|
||||||
} else {
|
} else {
|
||||||
/* fell thru */
|
/* fell thru */
|
||||||
@@ -1012,18 +1007,10 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||||||
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
||||||
} else {
|
} else {
|
||||||
stole_lock = 0;
|
stole_lock = 0;
|
||||||
#endif
|
|
||||||
spin_lock_irqsave(&port->sc_port.lock, flags);
|
spin_lock_irqsave(&port->sc_port.lock, flags);
|
||||||
sn_transmit_chars(port, 1);
|
sn_transmit_chars(port, 1);
|
||||||
spin_unlock_irqrestore(&port->sc_port.lock, flags);
|
spin_unlock_irqrestore(&port->sc_port.lock, flags);
|
||||||
|
|
||||||
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
|
||||||
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Not yet registered with serial core - simple case */
|
|
||||||
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user