From patchwork Wed Jan 7 16:34:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 42843 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D8822055F for ; Wed, 7 Jan 2015 16:45:03 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf970093wid.3 for ; Wed, 07 Jan 2015 08:45:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=BPBG40aMoLaTe45EDMfTNar7G7GoHJZrcllU1eGzEfo=; b=V6hImdzrE3lfqn32zzKLXvFa8DTbD763ozpc1M2zAhsmGT3WBP3ZmQvkq0LpywqdLY p0sp7eWi9vofKN6/9h/SdSaFRHzVK8ri+RJ86k59RzJSzvd2tBK2Pux87NYFReKgMqB2 JwvOXMp/tLENWZ8GiEz9qsMvC1SgrkFrEGtMHhB3aiHUCrwyksf1lPo7mADOzY9RT2Kg TTvXsWSJVwZe6H1gvZzM2RPkWAf43rT3pxTVDy27VyX3jI/AkQGmuoE1hkAD2FQsQmW2 suBoYnyI6WMuozcJnL6bPeTf7b78Mhp6U/jiRnUfpYcKjbsRTz6Le5EIW4katHNaDwhg 1+lQ== X-Gm-Message-State: ALoCoQkjkdR49Ix015KpWvrDMdJbGhwzGJarMnkRFDILC4+2SIP5rEbRzr1j1i2a0fYaT1JYDqAd X-Received: by 10.152.42.196 with SMTP id q4mr440844lal.6.1420649102813; Wed, 07 Jan 2015 08:45:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.49 with SMTP id bd17ls187271lab.14.gmail; Wed, 07 Jan 2015 08:45:02 -0800 (PST) X-Received: by 10.112.119.201 with SMTP id kw9mr6039495lbb.99.1420649102678; Wed, 07 Jan 2015 08:45:02 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id s4si3758512las.118.2015.01.07.08.45.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 08:45:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id s18so4560546lam.2 for ; Wed, 07 Jan 2015 08:45:02 -0800 (PST) X-Received: by 10.152.87.12 with SMTP id t12mr6184751laz.31.1420649102579; Wed, 07 Jan 2015 08:45:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1539859lbb; Wed, 7 Jan 2015 08:45:02 -0800 (PST) X-Received: by 10.194.108.202 with SMTP id hm10mr8426675wjb.72.1420649100029; Wed, 07 Jan 2015 08:45:00 -0800 (PST) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com. [74.125.82.44]) by mx.google.com with ESMTPS id hj8si5476103wjc.14.2015.01.07.08.44.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 08:45:00 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.44 as permitted sender) client-ip=74.125.82.44; Received: by mail-wg0-f44.google.com with SMTP id b13so1529976wgh.31 for ; Wed, 07 Jan 2015 08:44:59 -0800 (PST) X-Received: by 10.180.73.178 with SMTP id m18mr49257904wiv.65.1420649099710; Wed, 07 Jan 2015 08:44:59 -0800 (PST) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id cp4sm2741640wjb.16.2015.01.07.08.44.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jan 2015 08:44:58 -0800 (PST) From: Daniel Thompson To: Jason Wessel Cc: Anton Vorontsov , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Andrew Morton , Greg Kroah-Hartman , Jiri Slaby , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , Colin Cross , kernel-team@android.com, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , Daniel Thompson Subject: [RESEND PATCH v5 3.19-rc2 4/8] kdb: Use KDB_REPEAT_* values as flags Date: Wed, 7 Jan 2015 16:34:54 +0000 Message-Id: <1420648498-17428-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1420648498-17428-1-git-send-email-daniel.thompson@linaro.org> References: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> <1420648498-17428-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Anton Vorontsov The actual values of KDB_REPEAT_* enum values and overall logic stayed the same, but we now treat the values as flags. This makes it possible to add other flags and combine them, plus makes the code a lot simpler and shorter. But functionality-wise, there should be no changes. Signed-off-by: Anton Vorontsov Signed-off-by: John Stultz Signed-off-by: Daniel Thompson Cc: Jason Wessel --- include/linux/kdb.h | 4 ++-- kernel/debug/kdb/kdb_main.c | 21 +++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/include/linux/kdb.h b/include/linux/kdb.h index 32d2f407981d..90aed7c31f0d 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h @@ -15,8 +15,8 @@ typedef enum { KDB_REPEAT_NONE = 0, /* Do not repeat this command */ - KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ - KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ + KDB_REPEAT_NO_ARGS = 0x1, /* Repeat the command w/o arguments */ + KDB_REPEAT_WITH_ARGS = 0x2, /* Repeat the command w/ its arguments */ } kdb_cmdflags_t; typedef int (*kdb_func_t)(int, const char **); diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 070f1ff358d2..cbacae24a55a 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -1008,20 +1008,13 @@ int kdb_parse(const char *cmdstr) if (result && ignore_errors && result > KDB_CMD_GO) result = 0; KDB_STATE_CLEAR(CMD); - switch (tp->cmd_flags) { - case KDB_REPEAT_NONE: - argc = 0; - if (argv[0]) - *(argv[0]) = '\0'; - break; - case KDB_REPEAT_NO_ARGS: - argc = 1; - if (argv[1]) - *(argv[1]) = '\0'; - break; - case KDB_REPEAT_WITH_ARGS: - break; - } + + if (tp->cmd_flags & KDB_REPEAT_WITH_ARGS) + return result; + + argc = tp->cmd_flags & KDB_REPEAT_NO_ARGS ? 1 : 0; + if (argv[argc]) + *(argv[argc]) = '\0'; return result; }