Commit 698cf1c6 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds

netconsole: make netconsole_target->enabled a bool

netconsole uses both bool and int for boolean values.  Let's convert
nt->enabled to bool for consistency.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: David Miller <davem@davemloft.net>
Cc: Kay Sievers <kay@vrfy.org>
Cc: Petr Mladek <pmladek@suse.cz>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a6d403ac
...@@ -104,7 +104,7 @@ struct netconsole_target { ...@@ -104,7 +104,7 @@ struct netconsole_target {
#ifdef CONFIG_NETCONSOLE_DYNAMIC #ifdef CONFIG_NETCONSOLE_DYNAMIC
struct config_item item; struct config_item item;
#endif #endif
int enabled; bool enabled;
struct mutex mutex; struct mutex mutex;
struct netpoll np; struct netpoll np;
}; };
...@@ -197,7 +197,7 @@ static struct netconsole_target *alloc_param_target(char *target_config) ...@@ -197,7 +197,7 @@ static struct netconsole_target *alloc_param_target(char *target_config)
if (err) if (err)
goto fail; goto fail;
nt->enabled = 1; nt->enabled = true;
return nt; return nt;
...@@ -322,13 +322,13 @@ static ssize_t store_enabled(struct netconsole_target *nt, ...@@ -322,13 +322,13 @@ static ssize_t store_enabled(struct netconsole_target *nt,
return err; return err;
if (enabled < 0 || enabled > 1) if (enabled < 0 || enabled > 1)
return -EINVAL; return -EINVAL;
if (enabled == nt->enabled) { if ((bool)enabled == nt->enabled) {
pr_info("network logging has already %s\n", pr_info("network logging has already %s\n",
nt->enabled ? "started" : "stopped"); nt->enabled ? "started" : "stopped");
return -EINVAL; return -EINVAL;
} }
if (enabled) { /* 1 */ if (enabled) { /* true */
/* /*
* Skip netpoll_parse_options() -- all the attributes are * Skip netpoll_parse_options() -- all the attributes are
* already configured via configfs. Just print them out. * already configured via configfs. Just print them out.
...@@ -340,13 +340,13 @@ static ssize_t store_enabled(struct netconsole_target *nt, ...@@ -340,13 +340,13 @@ static ssize_t store_enabled(struct netconsole_target *nt,
return err; return err;
pr_info("netconsole: network logging started\n"); pr_info("netconsole: network logging started\n");
} else { /* 0 */ } else { /* false */
/* We need to disable the netconsole before cleaning it up /* We need to disable the netconsole before cleaning it up
* otherwise we might end up in write_msg() with * otherwise we might end up in write_msg() with
* nt->np.dev == NULL and nt->enabled == 1 * nt->np.dev == NULL and nt->enabled == true
*/ */
spin_lock_irqsave(&target_list_lock, flags); spin_lock_irqsave(&target_list_lock, flags);
nt->enabled = 0; nt->enabled = false;
spin_unlock_irqrestore(&target_list_lock, flags); spin_unlock_irqrestore(&target_list_lock, flags);
netpoll_cleanup(&nt->np); netpoll_cleanup(&nt->np);
} }
...@@ -594,7 +594,7 @@ static struct config_item *make_netconsole_target(struct config_group *group, ...@@ -594,7 +594,7 @@ static struct config_item *make_netconsole_target(struct config_group *group,
/* /*
* Allocate and initialize with defaults. * Allocate and initialize with defaults.
* Target is disabled at creation (enabled == 0). * Target is disabled at creation (!enabled).
*/ */
nt = kzalloc(sizeof(*nt), GFP_KERNEL); nt = kzalloc(sizeof(*nt), GFP_KERNEL);
if (!nt) if (!nt)
...@@ -695,7 +695,7 @@ static int netconsole_netdev_event(struct notifier_block *this, ...@@ -695,7 +695,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
spin_lock_irqsave(&target_list_lock, flags); spin_lock_irqsave(&target_list_lock, flags);
dev_put(nt->np.dev); dev_put(nt->np.dev);
nt->np.dev = NULL; nt->np.dev = NULL;
nt->enabled = 0; nt->enabled = false;
stopped = true; stopped = true;
netconsole_target_put(nt); netconsole_target_put(nt);
goto restart; goto restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment