From patchwork Fri Apr 25 16:29:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 29106 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D1FD203AC for ; Fri, 25 Apr 2014 16:29:58 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id v10sf8384110pde.7 for ; Fri, 25 Apr 2014 09:29:57 -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=9o5JqZQBhRunvCJhslSsTIMl8GJ/N+U87+ux0rPc4/k=; b=aIft5BbGlPDsKAZ74ZrPvozUd2Xc/LNi5KUDXfbWnoOlBG4HluiJdFn4HtG4QR+cCD 5wY2xhdwVrczCEAHA/HpPfENBQj6luXW3xx6ZBmEI3A6B/0wjC0qHVUisCs+vQgEz20r DWsiOh2XyjrF210CE4DZ5Lld2eVtKSLC/sACCgRxrfFAVXG9qqbHI9KJLWS7blY1luok XMcqX5+NMVjJXbMEWf2cEPBKfHmBn5v/wG7Oh6XdzFiJe/+sA/rqMMr51Mf9RKzMNV5x VSu+ro7bfWtccfju4dvVAC3XdcwpIUWSMlGipUsnCAUwJqYYJMDeh1RQ9Vu7PzMaa8/d xCIw== X-Gm-Message-State: ALoCoQnvjp7MS5Jzy1sY34IIdMa0frAJFmtU/X0//bSnE0wEdRG0jVlw0tmOJmp8Y6wNC9CDLkSF X-Received: by 10.68.253.66 with SMTP id zy2mr4949596pbc.1.1398443397835; Fri, 25 Apr 2014 09:29:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.72 with SMTP id f66ls1575951qga.47.gmail; Fri, 25 Apr 2014 09:29:57 -0700 (PDT) X-Received: by 10.58.143.72 with SMTP id sc8mr653148veb.46.1398443397650; Fri, 25 Apr 2014 09:29:57 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tz5si1814482vdc.79.2014.04.25.09.29.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 09:29:57 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id im17so5010688vcb.14 for ; Fri, 25 Apr 2014 09:29:57 -0700 (PDT) X-Received: by 10.52.136.35 with SMTP id px3mr61094vdb.66.1398443397532; Fri, 25 Apr 2014 09:29:57 -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.220.221.72 with SMTP id ib8csp110899vcb; Fri, 25 Apr 2014 09:29:57 -0700 (PDT) X-Received: by 10.180.105.132 with SMTP id gm4mr4402399wib.39.1398443396689; Fri, 25 Apr 2014 09:29:56 -0700 (PDT) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx.google.com with ESMTPS id gp8si1903696wib.45.2014.04.25.09.29.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 09:29:56 -0700 (PDT) Received-SPF: none (google.com: daniel.thompson@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.178; Received: by mail-wi0-f178.google.com with SMTP id bs8so2925815wib.5 for ; Fri, 25 Apr 2014 09:29:56 -0700 (PDT) X-Received: by 10.194.63.46 with SMTP id d14mr7509012wjs.24.1398443396140; Fri, 25 Apr 2014 09:29:56 -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 fw13sm6881026wic.6.2014.04.25.09.29.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Apr 2014 09:29:55 -0700 (PDT) From: Daniel Thompson To: kgdb-bugreport@lists.sourceforge.net, Jason Wessel Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, Anton Vorontsov , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , John Stultz , Colin Cross , kernel-team@android.com Subject: [RFC v3 5/9] kdb: Use KDB_REPEAT_* values as flags Date: Fri, 25 Apr 2014 17:29:26 +0100 Message-Id: <1398443370-12668-6-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398443370-12668-1-git-send-email-daniel.thompson@linaro.org> References: <1396453440-16445-1-git-send-email-daniel.thompson@linaro.org> <1398443370-12668-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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 --- 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 02bae26..f5cc722 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 17f9042..5d67ff6 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; }