* (TTY driver and console driver)
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/console.h>
unsigned long flags;
int retval = 0;
- spin_lock_irqsave(&srmconsp_lock, flags);
-
- do {
- if (srmconsp != NULL) {
- *ps = srmconsp;
- break;
- }
+ if (srmconsp == NULL) {
+ spin_lock_irqsave(&srmconsp_lock, flags);
srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
- if (srmconsp == NULL) {
+ if (srmconsp == NULL)
retval = -ENOMEM;
- break;
+ else {
+ srmconsp->tty = NULL;
+ spin_lock_init(&srmconsp->lock);
+ init_timer(&srmconsp->timer);
}
- srmconsp->tty = NULL;
- spin_lock_init(&srmconsp->lock);
- init_timer(&srmconsp->timer);
-
- *ps = srmconsp;
- } while(0);
-
- spin_unlock_irqrestore(&srmconsp_lock, flags);
+ spin_unlock_irqrestore(&srmconsp_lock, flags);
+ }
+ *ps = srmconsp;
return retval;
}
static struct tty_driver *srmcons_driver;
-static struct tty_operations srmcons_ops = {
+static const struct tty_operations srmcons_ops = {
.open = srmcons_open,
.close = srmcons_close,
.write = srmcons_write,