From patchwork Tue Jul 10 00:10:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 9914 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DE94B23E01 for ; Tue, 10 Jul 2012 00:13:27 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id AEC51A1875C for ; Tue, 10 Jul 2012 00:13:27 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so11498815ghb.11 for ; Mon, 09 Jul 2012 17:13:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=/SS+xDrGIpqyJ6a7N726P4XdOjarY3+Pq0+ykfARzVs=; b=NaVcyIsMP7vGzEg35F6z6QCJSFf1saa3bpNxQxWpPs+S8OCevykuLid0sYeTnd+IUy sKVy2w2wCp9HIc/X/BwdA3hhhftlXc5YajyCEGlGFMgt44rrLTPlObFdkTb5Jf8VmUL9 4ycPoSqd3BFZDLIZvhNvlwe/luQCzcz9o4FZN7MloFji/QLk8btOaJsAIaSIqgmvW9XD 6BC2d8oxoV0kCOsE8LXolMQzp+eDAL3ozvLQcK3qCsG2RxP4SmClgPywBezNN/FEN8LJ pJFsKWUI72ReiSZs3yv4C6CaLYOllGIgJ4bu9aTsVqOOHRKagGig47DytMp0Gw37gzKe egSg== Received: by 10.42.89.72 with SMTP id f8mr21876960icm.33.1341879207235; Mon, 09 Jul 2012 17:13:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp42702ibb; Mon, 9 Jul 2012 17:13:26 -0700 (PDT) Received: by 10.236.189.9 with SMTP id b9mr47970979yhn.105.1341879206691; Mon, 09 Jul 2012 17:13:26 -0700 (PDT) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by mx.google.com with ESMTPS id d45si11449208yhe.92.2012.07.09.17.13.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 17:13:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.213.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.213.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.213.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-yw0-f50.google.com with SMTP id j63so6225232yhj.37 for ; Mon, 09 Jul 2012 17:13:26 -0700 (PDT) Received: by 10.66.79.100 with SMTP id i4mr69241439pax.78.1341879206125; Mon, 09 Jul 2012 17:13:26 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id wf7sm28648536pbc.34.2012.07.09.17.13.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 17:13:25 -0700 (PDT) From: Anton Vorontsov To: Greg Kroah-Hartman , Kees Cook , Colin Cross , Tony Luck , Steven Rostedt , Frederic Weisbecker , Ingo Molnar Cc: Arnd Bergmann , John Stultz , Shuah Khan , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 8/8] tracing/function: Convert func_set_flag() to a switch statement Date: Mon, 9 Jul 2012 17:10:46 -0700 Message-Id: <1341879046-5197-8-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120710001004.GA22744@lizard> References: <20120710001004.GA22744@lizard> X-Gm-Message-State: ALoCoQk5jRZpmiDgBEsxvl5uq/JDsu+HDkTweI+kxYW1mE6UIrFdb0Pd6LUImDyk/HOasRqgZ6TH Since the function accepts just one bit, we can use the switch construction instead of if/else if/... Just a cosmetic change, there should be no functional changes. Suggested-by: Steven Rostedt Signed-off-by: Anton Vorontsov --- kernel/trace/trace_functions.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 13770ab..a426f41 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void) static int func_set_flag(u32 old_flags, u32 bit, int set) { - if (bit == TRACE_FUNC_OPT_STACK) { + switch (bit) { + case TRACE_FUNC_OPT_STACK: /* do nothing if already set */ if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK)) - return 0; + break; if (set) { unregister_ftrace_function(&trace_ops); @@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set) register_ftrace_function(&trace_ops); } - return 0; - } else if (bit == TRACE_FUNC_OPT_PSTORE) { - return 0; + break; + case TRACE_FUNC_OPT_PSTORE: + break; + default: + return -EINVAL; } - return -EINVAL; + return 0; } static struct tracer function_trace __read_mostly =