diff options
Diffstat (limited to 'drivers/net/netconsole.c')
| -rw-r--r-- | drivers/net/netconsole.c | 21 | 
1 files changed, 11 insertions, 10 deletions
| diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index bdff9ac5056d..4f4f79532c6c 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -332,10 +332,8 @@ static ssize_t enabled_store(struct config_item *item,  	}  	if (enabled) {	/* true */ -		if (nt->extended && !(netconsole_ext.flags & CON_ENABLED)) { -			netconsole_ext.flags |= CON_ENABLED; +		if (nt->extended && !console_is_registered(&netconsole_ext))  			register_console(&netconsole_ext); -		}  		/*  		 * Skip netpoll_parse_options() -- all the attributes are @@ -869,7 +867,7 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)  static struct console netconsole_ext = {  	.name	= "netcon_ext", -	.flags	= CON_EXTENDED,	/* starts disabled, registered on first use */ +	.flags	= CON_ENABLED | CON_EXTENDED,  	.write	= write_ext_msg,  }; @@ -883,6 +881,7 @@ static int __init init_netconsole(void)  {  	int err;  	struct netconsole_target *nt, *tmp; +	bool extended = false;  	unsigned long flags;  	char *target_config;  	char *input = config; @@ -895,11 +894,12 @@ static int __init init_netconsole(void)  				goto fail;  			}  			/* Dump existing printks when we register */ -			if (nt->extended) -				netconsole_ext.flags |= CON_PRINTBUFFER | -							CON_ENABLED; -			else +			if (nt->extended) { +				extended = true; +				netconsole_ext.flags |= CON_PRINTBUFFER; +			} else {  				netconsole.flags |= CON_PRINTBUFFER; +			}  			spin_lock_irqsave(&target_list_lock, flags);  			list_add(&nt->list, &target_list); @@ -915,7 +915,7 @@ static int __init init_netconsole(void)  	if (err)  		goto undonotifier; -	if (netconsole_ext.flags & CON_ENABLED) +	if (extended)  		register_console(&netconsole_ext);  	register_console(&netconsole);  	pr_info("network logging started\n"); @@ -945,7 +945,8 @@ static void __exit cleanup_netconsole(void)  {  	struct netconsole_target *nt, *tmp; -	unregister_console(&netconsole_ext); +	if (console_is_registered(&netconsole_ext)) +		unregister_console(&netconsole_ext);  	unregister_console(&netconsole);  	dynamic_netconsole_exit();  	unregister_netdevice_notifier(&netconsole_netdev_notifier); |