From patchwork Thu Jun 19 13:19:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 32220 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DDEC2206A0 for ; Thu, 19 Jun 2014 13:20:16 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf6737910qcx.1 for ; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) 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=hY6a7etQ29vadRM0GTOqb7XNK6ITPgSxYAfu5y0iN2M=; b=jWpsPNUqDFnVcp6vNpSBPW/t/eAVhZjXnhO84ELadziclCnCi4zecEa2O/TyRiVzOV kJV7ffAV9ZRrs8fdKp9iSBNuAntTVcbkMLcKDXDb1i6hxNEuJOFH9yeNuurogJievOSR 1CM2vDXpITOD9v+JC69FOsHOa4e30O7DfO7gVtV3wbhoC+fZ+KU8ODfFka8JPaRwUXlV r3jFjv2j7m72ekCCct85ih3CkyXg6XwDmCvtUwgePHnhbd0YOT5qKEEvr1Y+mmz5EbWg ROfuRzRz8Gf0c4t9unKs1dsBZJmxYDLZDGR2D7UfiSTYkGTt0D+sgLxOmBI0OlntkiYm v3gg== X-Gm-Message-State: ALoCoQmfApkRnmQwigdYT3soUYXS+mtYBgjPDw+9enMQZTHJ8FKU9jsiXIf+8W/TuJLw0phztZwS X-Received: by 10.236.9.41 with SMTP id 29mr1907500yhs.23.1403184016766; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.70 with SMTP id 64ls583549qgg.19.gmail; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) X-Received: by 10.52.136.98 with SMTP id pz2mr238628vdb.70.1403184016701; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id im2si2359556veb.47.2014.06.19.06.20.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Jun 2014 06:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so2209216vcb.29 for ; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) X-Received: by 10.58.24.38 with SMTP id r6mr734078vef.41.1403184016611; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) 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.221.54.6 with SMTP id vs6csp361289vcb; Thu, 19 Jun 2014 06:20:16 -0700 (PDT) X-Received: by 10.112.143.98 with SMTP id sd2mr3182033lbb.15.1403184015471; Thu, 19 Jun 2014 06:20:15 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx.google.com with ESMTPS id lm9si6771639wic.98.2014.06.19.06.20.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Jun 2014 06:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id bs8so2834656wib.3 for ; Thu, 19 Jun 2014 06:20:15 -0700 (PDT) X-Received: by 10.180.81.134 with SMTP id a6mr6480175wiy.19.1403184014710; Thu, 19 Jun 2014 06:20:14 -0700 (PDT) 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 m3sm11538652wik.7.2014.06.19.06.20.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 06:20:14 -0700 (PDT) From: Daniel Thompson To: kgdb-bugreport@lists.sourceforge.net, Jason Wessel Cc: Anton Vorontsov , patches@linaro.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , John Stultz , Colin Cross , kernel-team@android.com, Daniel Thompson , Mike Travis Subject: [PATCH v5 4/8] kdb: Use KDB_REPEAT_* values as flags Date: Thu, 19 Jun 2014 14:19:33 +0100 Message-Id: <1403183977-3454-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403183977-3454-1-git-send-email-daniel.thompson@linaro.org> References: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> <1403183977-3454-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.220.170 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 Cc: Mike Travis Cc: kgdb-bugreport@lists.sourceforge.net --- 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 32d2f40..90aed7c 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 6b33f9c..7a0a65c 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; }