Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964992AbbENQIR (ORCPT ); Thu, 14 May 2015 12:08:17 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:36129 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422659AbbENQGt (ORCPT ); Thu, 14 May 2015 12:06:49 -0400 From: Tejun Heo To: akpm@linux-foundation.org Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Tejun Heo Subject: [PATCH 5/7] netconsole: make netconsole_target->enabled a bool Date: Thu, 14 May 2015 12:06:24 -0400 Message-Id: <1431619586-29187-6-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1431619586-29187-1-git-send-email-tj@kernel.org> References: <1431619586-29187-1-git-send-email-tj@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2739 Lines: 90 netconsole uses both bool and int for boolean values. Let's convert nt->enabled to bool for consistency. Signed-off-by: Tejun Heo Cc: David Miller --- drivers/net/netconsole.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 30c0524..8dd1e55 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -104,7 +104,7 @@ struct netconsole_target { #ifdef CONFIG_NETCONSOLE_DYNAMIC struct config_item item; #endif - int enabled; + bool enabled; struct mutex mutex; struct netpoll np; }; @@ -197,7 +197,7 @@ static struct netconsole_target *alloc_param_target(char *target_config) if (err) goto fail; - nt->enabled = 1; + nt->enabled = true; return nt; @@ -322,13 +322,13 @@ static ssize_t store_enabled(struct netconsole_target *nt, return err; if (enabled < 0 || enabled > 1) return -EINVAL; - if (enabled == nt->enabled) { + if ((bool)enabled == nt->enabled) { pr_info("network logging has already %s\n", nt->enabled ? "started" : "stopped"); return -EINVAL; } - if (enabled) { /* 1 */ + if (enabled) { /* true */ /* * Skip netpoll_parse_options() -- all the attributes are * already configured via configfs. Just print them out. @@ -340,13 +340,13 @@ static ssize_t store_enabled(struct netconsole_target *nt, return err; pr_info("netconsole: network logging started\n"); - } else { /* 0 */ + } else { /* false */ /* We need to disable the netconsole before cleaning it up * 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); - nt->enabled = 0; + nt->enabled = false; spin_unlock_irqrestore(&target_list_lock, flags); netpoll_cleanup(&nt->np); } @@ -594,7 +594,7 @@ static struct config_item *make_netconsole_target(struct config_group *group, /* * Allocate and initialize with defaults. - * Target is disabled at creation (enabled == 0). + * Target is disabled at creation (!enabled). */ nt = kzalloc(sizeof(*nt), GFP_KERNEL); if (!nt) @@ -695,7 +695,7 @@ restart: spin_lock_irqsave(&target_list_lock, flags); dev_put(nt->np.dev); nt->np.dev = NULL; - nt->enabled = 0; + nt->enabled = false; stopped = true; netconsole_target_put(nt); goto restart; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/