From patchwork Thu Nov 6 14:36:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 40312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 277AE24237 for ; Thu, 6 Nov 2014 14:38:14 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf735200lbi.10 for ; Thu, 06 Nov 2014 06:38:13 -0800 (PST) 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=W/NLoHxNwcJ0Jzu3wIw5yDWCl4VR0SQ6XlcBQMlMiGM=; b=V4UM5yZpI3kICAIywuhHtHtSwAt25ALA6gNTLvs0Q8/QaVMK48+juQPIEMgXPm9Uhl yn/WA/HZipe+Pps7jPxTLl63LhUGL+F2xkmIjvnGJmloF2xerxAgApRKAAGWSDR93Cl0 Xn6A/UwpUZmsHF6h34P4r16M3XCnfA7u8BMVfIEqMHvgJy3tvPnx4PVNDhSG4icsAuz9 wUQRds4Ku5NCAXR50sFTxwl4a2D4YXUqirr5c7MM0ytICkVbVRs/vhwk6+HZ141FF43C JIOigZfgAZjxPTj9MZh3ZXPrBjpmBonJuyiLrIrrDkY617Ji1p8NwUlhQMT+tdbJg+v9 8SLg== X-Gm-Message-State: ALoCoQkrHcTndy8ygNfoCg3DttkpwTMxa81o9V3r0nFxu3PJ+8xH+wTurknrqESEDQTh8ZXPjq9A X-Received: by 10.112.137.202 with SMTP id qk10mr636492lbb.11.1415284692963; Thu, 06 Nov 2014 06:38:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.4 with SMTP id i4ls51649laf.59.gmail; Thu, 06 Nov 2014 06:38:12 -0800 (PST) X-Received: by 10.112.57.227 with SMTP id l3mr5419096lbq.68.1415284692692; Thu, 06 Nov 2014 06:38:12 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id li1si11559401lab.112.2014.11.06.06.38.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 06:38:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id mc6so2751084lab.12 for ; Thu, 06 Nov 2014 06:38:12 -0800 (PST) X-Received: by 10.112.12.35 with SMTP id v3mr5422626lbb.80.1415284692604; Thu, 06 Nov 2014 06:38:12 -0800 (PST) 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.112.184.201 with SMTP id ew9csp53487lbc; Thu, 6 Nov 2014 06:38:12 -0800 (PST) X-Received: by 10.194.61.99 with SMTP id o3mr6232400wjr.54.1415284690761; Thu, 06 Nov 2014 06:38:10 -0800 (PST) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com. [209.85.212.178]) by mx.google.com with ESMTPS id a1si10195658wiy.97.2014.11.06.06.38.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 06:38:10 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.178 as permitted sender) client-ip=209.85.212.178; Received: by mail-wi0-f178.google.com with SMTP id bs8so1680733wib.5 for ; Thu, 06 Nov 2014 06:38:10 -0800 (PST) X-Received: by 10.194.243.106 with SMTP id wx10mr3330101wjc.97.1415284690527; Thu, 06 Nov 2014 06:38:10 -0800 (PST) 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 pc8sm8029386wjb.36.2014.11.06.06.38.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Nov 2014 06:38:06 -0800 (PST) From: Daniel Thompson To: Jason Wessel Cc: Anton Vorontsov , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Andrew Morton , Greg Kroah-Hartman , Jiri Slaby , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , Colin Cross , kernel-team@android.com, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , Daniel Thompson Subject: [RESEND PATCH v5 3.18-rc3 4/8] kdb: Use KDB_REPEAT_* values as flags Date: Thu, 6 Nov 2014 14:36:43 +0000 Message-Id: <1415284607-7628-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415284607-7628-1-git-send-email-daniel.thompson@linaro.org> References: <1415284607-7628-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.215.53 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 --- 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..cbacae24 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; }