From patchwork Wed Apr 2 15:43:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 27638 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C9A4120341 for ; Wed, 2 Apr 2014 15:44:22 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf1800237oac.11 for ; Wed, 02 Apr 2014 08:44:22 -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=vTbfBZtGdpp/6zB1IZunCKHKsFCzZqMjSv55UjHvs54=; b=EUuCq2UX6kNnnJL8wGvQ3dBo6wecg0+l6IwfmSRKwrpOAhnxs/kqe4TU4ZN4O1J2S7 WL89ROSrx653FMYj16SFkDsEdVAAnB9IGw4/mM4395ogVNVSS9IFM8hFJTGFjJlSLQnv dXQp9t6c7KHuvFvE1+8VD+BgfTcuUObXy8PkO02TL2RYx66/n0hwtN0yAv6gCb3UiAgw I90mPQyD94ulB2ODghV5sJcV50PhiJk/Ck9mo3gTbprtRXbg8CvZR8Ta3dsZTnpRict6 qa3h3W/WPbBVs4jaDBRGiiqeudSQkybgxCLrJPo2KnHhtvC5UUp+pPjO0FkpsaclRaHG biew== X-Gm-Message-State: ALoCoQn83BmID+ICFzh00tGRFXPh0JMnbX2Z2ejvYKQX7oBsQ1qGz0lzB6fkwa6w2hCDgpzDqRhJ X-Received: by 10.182.126.137 with SMTP id my9mr418122obb.13.1396453462179; Wed, 02 Apr 2014 08:44:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.170 with SMTP id l39ls368892qgd.6.gmail; Wed, 02 Apr 2014 08:44:22 -0700 (PDT) X-Received: by 10.52.123.97 with SMTP id lz1mr520071vdb.73.1396453462090; Wed, 02 Apr 2014 08:44:22 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id qr10si633798vcb.81.2014.04.02.08.44.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Apr 2014 08:44:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so561693vcb.8 for ; Wed, 02 Apr 2014 08:44:22 -0700 (PDT) X-Received: by 10.52.249.105 with SMTP id yt9mr1301297vdc.34.1396453462014; Wed, 02 Apr 2014 08:44:22 -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.12.8 with SMTP id v8csp334246vcv; Wed, 2 Apr 2014 08:44:21 -0700 (PDT) X-Received: by 10.194.185.148 with SMTP id fc20mr1812825wjc.27.1396453461216; Wed, 02 Apr 2014 08:44:21 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by mx.google.com with ESMTPS id bv7si1718133wib.31.2014.04.02.08.44.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Apr 2014 08:44:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.171 is neither permitted nor denied by best guess record for domain of daniel.thompson@linaro.org) client-ip=209.85.212.171; Received: by mail-wi0-f171.google.com with SMTP id q5so7425490wiv.10 for ; Wed, 02 Apr 2014 08:44:20 -0700 (PDT) X-Received: by 10.180.73.173 with SMTP id m13mr29869427wiv.52.1396453460532; Wed, 02 Apr 2014 08:44:20 -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 dg7sm3450581wjc.4.2014.04.02.08.44.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Apr 2014 08:44:19 -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, Daniel Thompson Subject: [RFC v2 05/10] kdb: Use KDB_REPEAT_* values as flags Date: Wed, 2 Apr 2014 16:43:55 +0100 Message-Id: <1396453440-16445-6-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396453440-16445-1-git-send-email-daniel.thompson@linaro.org> References: <1396453440-16445-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: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 --- 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; }