From patchwork Fri Jul 11 11:33:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 33477 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 39AD120672 for ; Fri, 11 Jul 2014 11:36:11 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf3053258igc.9 for ; Fri, 11 Jul 2014 04:36:10 -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=SGsSAiNZYwOIZ8PFF9ug6+hq/bD+lfypSI/GLwGsUpYS0O6oezyi6femMfw7++PNoW Uj6/K1Z/NzcWNjquhTp5cBAsLodGE1+bhJZRyhTaIwhvKHF0Qi9DxRcDTrWif6nKerwv BGwRo1as8G+kXaL8N1vPa8VXR9lyvope+gTUqhodgtB1uCRp2RSv1PToOYtsUr5aDRbV 1NzuEJmuW05b7aUEVHGPZELF7XPn0KhMdLm98psxFvQEO+W7CefFtdPWVhdr1VPiGorA QIfHWkWGLj45HyKfZxN7R+1SPniipBrkKT0hLh3VleshYhXEpEr9gMfY8c6cIfXE6lRb c3sw== X-Gm-Message-State: ALoCoQmlnP3/Ptg2l1jKOOWyU8wiV5fE4MV3+ROYuNx6pp+5oI1oEI8x/TZN4NX49mpfX34cuaty X-Received: by 10.42.37.71 with SMTP id x7mr1818384icd.4.1405078570740; Fri, 11 Jul 2014 04:36:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.203 with SMTP id c69ls368510qgd.85.gmail; Fri, 11 Jul 2014 04:36:10 -0700 (PDT) X-Received: by 10.52.103.97 with SMTP id fv1mr761381vdb.42.1405078570614; Fri, 11 Jul 2014 04:36:10 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id g18si1315565veh.84.2014.07.11.04.36.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 04:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id im17so1729040vcb.39 for ; Fri, 11 Jul 2014 04:36:10 -0700 (PDT) X-Received: by 10.52.27.208 with SMTP id v16mr43320530vdg.21.1405078570511; Fri, 11 Jul 2014 04:36:10 -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.37.5 with SMTP id tc5csp27722vcb; Fri, 11 Jul 2014 04:36:10 -0700 (PDT) X-Received: by 10.194.134.70 with SMTP id pi6mr66153819wjb.1.1405078569118; Fri, 11 Jul 2014 04:36:09 -0700 (PDT) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by mx.google.com with ESMTPS id k10si3594007wjf.110.2014.07.11.04.35.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 04:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.175 as permitted sender) client-ip=209.85.212.175; Received: by mail-wi0-f175.google.com with SMTP id ho1so6121282wib.2 for ; Fri, 11 Jul 2014 04:35:59 -0700 (PDT) X-Received: by 10.180.74.42 with SMTP id q10mr4245241wiv.39.1405078557931; Fri, 11 Jul 2014 04:35:57 -0700 (PDT) Received: from harvey.bri.st.com (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id ub8sm6541984wib.0.2014.07.11.04.35.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jul 2014 04:35:57 -0700 (PDT) From: Daniel Thompson To: 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, kgdb-bugreport@lists.sourceforge.net, Daniel Thompson , Mike Travis Subject: [RESEND PATCH v5 3.16-rc4 4/8] kdb: Use KDB_REPEAT_* values as flags Date: Fri, 11 Jul 2014 12:33:34 +0100 Message-Id: <1405078418-14070-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405078418-14070-1-git-send-email-daniel.thompson@linaro.org> References: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> <1405078418-14070-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.180 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; }