From patchwork Tue Aug 19 14:01:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 35599 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 95158201EF for ; Tue, 19 Aug 2014 14:02:25 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf54563043pab.0 for ; Tue, 19 Aug 2014 07:02:19 -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=7s0izLB0LcB1ks8sXbtIjoxakp9zN+GdH6+RYMHL3kY=; b=GrsPTg0NHoAs7/dIny6SZsmEzc4IxozWF32RiwHryjV+AM4qc/AJDhpYz8jJXdGSnA 3YO1lPrJMf7V9OxLdEueJ0sNDlYIjPFkI8TofLWFsBBG2qfthYSMxScHgTyfmAr3VIqL W65hbDRBJKMy9rj4q4kuMPuJFu4s9c8wHwDIwrifZy0p8ah+sSNFfIrcz2QkdXBkYRZY F+nea2dyURrx/6YYSg5x3VxXSGGOMqsv2xuVhA1o4ncDuAIMkQdbHpIKCYhT1O9Fbyfr PLqd4zS24qwee7+wLjI+3FIackf7EyimglwQRxaQdpVHvMqJsn4lyFwMWCjDbNti32r/ KYvA== X-Gm-Message-State: ALoCoQlHRQQH+qDspppVvwGKwCqW+F7Ch/7sZtVp4GAEz9T30KhMqkBz+ag+RCN2S6yYViWkvFBF X-Received: by 10.70.34.195 with SMTP id b3mr21945046pdj.7.1408456937715; Tue, 19 Aug 2014 07:02:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.211 with SMTP id z77ls2757736qgz.54.gmail; Tue, 19 Aug 2014 07:02:17 -0700 (PDT) X-Received: by 10.52.253.39 with SMTP id zx7mr16274169vdc.2.1408456937578; Tue, 19 Aug 2014 07:02:17 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id yg1si5490797vdb.58.2014.08.19.07.02.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so7504406vcb.10 for ; Tue, 19 Aug 2014 07:02:17 -0700 (PDT) X-Received: by 10.52.73.202 with SMTP id n10mr280350vdv.86.1408456937427; Tue, 19 Aug 2014 07:02:17 -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 tc5csp241187vcb; Tue, 19 Aug 2014 07:02:16 -0700 (PDT) X-Received: by 10.180.93.8 with SMTP id cq8mr6947515wib.17.1408456936237; Tue, 19 Aug 2014 07:02:16 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by mx.google.com with ESMTPS id qe4si22241215wic.82.2014.08.19.07.02.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:02:15 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.180 as permitted sender) client-ip=74.125.82.180; Received: by mail-we0-f180.google.com with SMTP id w61so6473073wes.39 for ; Tue, 19 Aug 2014 07:02:15 -0700 (PDT) X-Received: by 10.194.158.226 with SMTP id wx2mr17464099wjb.107.1408456935241; Tue, 19 Aug 2014 07:02:15 -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 do6sm48987446wib.22.2014.08.19.07.02.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2014 07:02:14 -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.17-rc1 4/8] kdb: Use KDB_REPEAT_* values as flags Date: Tue, 19 Aug 2014 15:01:58 +0100 Message-Id: <1408456922-12221-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1408456922-12221-1-git-send-email-daniel.thompson@linaro.org> References: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> <1408456922-12221-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.179 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 070f1ff..cbacae2 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; }