Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21436
b: refs/heads/master
c: 1ddb7c9
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Mar 20, 2006
1 parent 2d8389c commit acbcfdb
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10951ee61056a9f91c00c16746f2042672d7af7c
refs/heads/master: 1ddb7c98d44b898cfe0443c1e242cebfb0479d46
17 changes: 8 additions & 9 deletions trunk/drivers/serial/sunsab.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,14 +955,13 @@ static struct console sunsab_console = {
.index = -1,
.data = &sunsab_reg,
};
#define SUNSAB_CONSOLE (&sunsab_console)

static void __init sunsab_console_init(void)
static inline struct console *SUNSAB_CONSOLE(void)
{
int i;

if (con_is_present())
return;
return NULL;

for (i = 0; i < num_channels; i++) {
int this_minor = sunsab_reg.minor + i;
Expand All @@ -971,13 +970,14 @@ static void __init sunsab_console_init(void)
break;
}
if (i == num_channels)
return;
return NULL;

sunsab_console.index = i;
register_console(&sunsab_console);

return &sunsab_console;
}
#else
#define SUNSAB_CONSOLE (NULL)
#define SUNSAB_CONSOLE() (NULL)
#define sunsab_console_init() do { } while (0)
#endif

Expand Down Expand Up @@ -1124,7 +1124,6 @@ static int __init sunsab_init(void)

sunsab_reg.minor = sunserial_current_minor;
sunsab_reg.nr = num_channels;
sunsab_reg.cons = SUNSAB_CONSOLE;

ret = uart_register_driver(&sunsab_reg);
if (ret < 0) {
Expand All @@ -1143,10 +1142,10 @@ static int __init sunsab_init(void)
return ret;
}

sunsab_reg.cons = SUNSAB_CONSOLE();

sunserial_current_minor += num_channels;

sunsab_console_init();

for (i = 0; i < num_channels; i++) {
struct uart_sunsab_port *up = &sunsab_ports[i];

Expand Down
22 changes: 11 additions & 11 deletions trunk/drivers/serial/sunsu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,18 +1464,17 @@ static struct console sunsu_cons = {
.index = -1,
.data = &sunsu_reg,
};
#define SUNSU_CONSOLE (&sunsu_cons)

/*
* Register console.
*/

static int __init sunsu_serial_console_init(void)
static inline struct console *SUNSU_CONSOLE(void)
{
int i;

if (con_is_present())
return 0;
return NULL;

for (i = 0; i < UART_NR; i++) {
int this_minor = sunsu_reg.minor + i;
Expand All @@ -1484,16 +1483,16 @@ static int __init sunsu_serial_console_init(void)
break;
}
if (i == UART_NR)
return 0;
return NULL;
if (sunsu_ports[i].port_node == 0)
return 0;
return NULL;

sunsu_cons.index = i;
register_console(&sunsu_cons);
return 0;

return &sunsu_cons;
}
#else
#define SUNSU_CONSOLE (NULL)
#define SUNSU_CONSOLE() (NULL)
#define sunsu_serial_console_init() do { } while (0)
#endif

Expand Down Expand Up @@ -1523,16 +1522,17 @@ static int __init sunsu_serial_init(void)
}

sunsu_reg.minor = sunserial_current_minor;
sunserial_current_minor += instance;

sunsu_reg.nr = instance;
sunsu_reg.cons = SUNSU_CONSOLE;

ret = uart_register_driver(&sunsu_reg);
if (ret < 0)
return ret;

sunsu_serial_console_init();
sunserial_current_minor += instance;

sunsu_reg.cons = SUNSU_CONSOLE();

for (i = 0; i < UART_NR; i++) {
struct uart_sunsu_port *up = &sunsu_ports[i];

Expand Down
34 changes: 28 additions & 6 deletions trunk/drivers/serial/sunzilog.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,6 @@ static struct console sunzilog_console = {
.index = -1,
.data = &sunzilog_reg,
};
#define SUNZILOG_CONSOLE (&sunzilog_console)

static int __init sunzilog_console_init(void)
{
Expand All @@ -1413,8 +1412,31 @@ static int __init sunzilog_console_init(void)
register_console(&sunzilog_console);
return 0;
}

static inline struct console *SUNZILOG_CONSOLE(void)
{
int i;

if (con_is_present())
return NULL;

for (i = 0; i < NUM_CHANNELS; i++) {
int this_minor = sunzilog_reg.minor + i;

if ((this_minor - 64) == (serial_console - 1))
break;
}
if (i == NUM_CHANNELS)
return NULL;

sunzilog_console.index = i;
sunzilog_port_table[i].flags |= SUNZILOG_FLAG_IS_CONS;

return &sunzilog_console;
}

#else
#define SUNZILOG_CONSOLE (NULL)
#define SUNZILOG_CONSOLE() (NULL)
#define sunzilog_console_init() do { } while (0)
#endif

Expand Down Expand Up @@ -1666,14 +1688,14 @@ static int __init sunzilog_ports_init(void)
}

sunzilog_reg.nr = uart_count;
sunzilog_reg.cons = SUNZILOG_CONSOLE;

sunzilog_reg.minor = sunserial_current_minor;
sunserial_current_minor += uart_count;

ret = uart_register_driver(&sunzilog_reg);
if (ret == 0) {
sunzilog_console_init();
sunzilog_reg.cons = SUNZILOG_CONSOLE();

sunserial_current_minor += uart_count;

for (i = 0; i < NUM_CHANNELS; i++) {
struct uart_sunzilog_port *up = &sunzilog_port_table[i];

Expand Down

0 comments on commit acbcfdb

Please sign in to comment.