From patchwork Tue May 6 13:03:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 29703 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 156AA20534 for ; Tue, 6 May 2014 13:04:49 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id w62sf4175524wes.8 for ; Tue, 06 May 2014 06:04:49 -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=U72OkV9LULJYGHo0E+CjKLYLYBIaGPS4jwNjivz89d0=; b=MrHvlvhhf6XgRBZKzpKBksaFsyJEWzURU68VmJg1RCvm8RX37AwrBdgC1wswizYmQB Yxw0zn0e9QfZj1g6j/QPWMPHiSgRs0mQBoE7Dv5ZDdTxUxSA/slmKkc/kF6Q3E2XNaao Ojn7HAjuU089wvngRcg/BzIYfi2oa1uUYAu8l5UC6T6sSNpeyODNG/PToZxVfHbshPh9 KbgFoQ90bgnLB+0vwPdrBheu1K7n6GNRmTpF+LSz9aS/Y+ct8UdzStWavD/P2yFMu0cO 0sKcbQjms23vPJM55iWiudxUvqdXIDkBOfYVHbYqz0vn//RJiWCJGWafSusyioRKpjI8 IK5Q== X-Gm-Message-State: ALoCoQl7/4NwG5wpitWXNcbEPudnsOb+9IP57753fP3bWhEddWt2tir5g3DMyk78hn6bv3xjiF6x X-Received: by 10.15.94.8 with SMTP id ba8mr370783eeb.1.1399381489042; Tue, 06 May 2014 06:04:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.112 with SMTP id p103ls3058854qga.41.gmail; Tue, 06 May 2014 06:04:48 -0700 (PDT) X-Received: by 10.52.142.10 with SMTP id rs10mr27575685vdb.3.1399381488379; Tue, 06 May 2014 06:04:48 -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 q3si1189586veh.198.2014.05.06.06.04.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 06:04:48 -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 ij19so866721vcb.14 for ; Tue, 06 May 2014 06:04:48 -0700 (PDT) X-Received: by 10.58.116.175 with SMTP id jx15mr26592923veb.9.1399381488303; Tue, 06 May 2014 06:04:48 -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 ib8csp221747vcb; Tue, 6 May 2014 06:04:46 -0700 (PDT) X-Received: by 10.194.88.230 with SMTP id bj6mr537134wjb.85.1399381485929; Tue, 06 May 2014 06:04:45 -0700 (PDT) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id r9si4479905wia.103.2014.05.06.06.04.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 06:04:45 -0700 (PDT) Received-SPF: none (google.com: daniel.thompson@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.177; Received: by mail-we0-f177.google.com with SMTP id x48so3672450wes.36 for ; Tue, 06 May 2014 06:04:45 -0700 (PDT) X-Received: by 10.180.89.1 with SMTP id bk1mr2381046wib.35.1399381485482; Tue, 06 May 2014 06:04:45 -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 by1sm21966350wjc.26.2014.05.06.06.04.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 May 2014 06:04:44 -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: [PATCH v4 5/9] kdb: Use KDB_REPEAT_* values as flags Date: Tue, 6 May 2014 14:03:45 +0100 Message-Id: <1399381429-16194-6-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> References: <1398443370-12668-1-git-send-email-daniel.thompson@linaro.org> <1399381429-16194-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 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 626c6d2..2f54353 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; }