From patchwork Thu Apr 16 23:03:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 461870 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C2CC9140293 for ; Fri, 17 Apr 2015 09:09:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=Ns6uO2YW; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753458AbbDPXJd (ORCPT ); Thu, 16 Apr 2015 19:09:33 -0400 Received: from mail-qc0-f180.google.com ([209.85.216.180]:34128 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbbDPXE1 (ORCPT ); Thu, 16 Apr 2015 19:04:27 -0400 Received: by qcyk17 with SMTP id k17so15345710qcy.1; Thu, 16 Apr 2015 16:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fWqIchQkWzTeX+fYwGs5G2V9L/Cfmr6px0Ddi/SrsIg=; b=Ns6uO2YWIFqdRorHq4Iq4oMG3LqQe3qs+jBDaJ0ZqEsy06XRmZ1zxJwxuI6E0teJlB Ib85VUi1KE2Y+5zyZQmwDS/G/OdZRESLBIMiqzhB+vIlSOUl9UIkBmluzb8eaeRaowgG zXZc2Vtr7NXv2mSGZZ/wU8dUMTxwEk0nBcrgXYr8oxkw3Ej1EkZ/SEpoG9jEMTvmv0IE 14HI1fzoTSrRXwho+ffYJ8sKv6ejrXA1KSG69pfoBFUfFRz5JRwSqhlku6iK16yfWRNT XDliemrEKb85Aw9uD6Jkm0vjNE9H0MhvVXMlldg5tE13lmLGtbJzzf3DIWiFE/+/Jr3K /PLQ== X-Received: by 10.141.23.208 with SMTP id z199mr159564qhd.27.1429225466688; Thu, 16 Apr 2015 16:04:26 -0700 (PDT) Received: from htj.duckdns.org.lan (207-38-238-8.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com. [207.38.238.8]) by mx.google.com with ESMTPSA id z77sm6677670qkg.44.2015.04.16.16.04.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2015 16:04:25 -0700 (PDT) From: Tejun Heo To: akpm@linux-foundation.org, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Tejun Heo Subject: [PATCH 06/16] netconsole: make netconsole_target->enabled a bool Date: Thu, 16 Apr 2015 19:03:43 -0400 Message-Id: <1429225433-11946-7-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429225433-11946-1-git-send-email-tj@kernel.org> References: <1429225433-11946-1-git-send-email-tj@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We'll add more bool's to netconsole_target. Let's convert ->enabled to bool first so that things stay consistent. 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 15731d1..09d4e12 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;