From patchwork Mon Jun 24 22:36:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 253984 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6A4BB2C0084 for ; Tue, 25 Jun 2013 08:38:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF0ED4A04E; Tue, 25 Jun 2013 00:37:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YTSNU-knJjCA; Tue, 25 Jun 2013 00:37:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0DD04A03B; Tue, 25 Jun 2013 00:37:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D40554A027 for ; Tue, 25 Jun 2013 00:37:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SFc6lHXMDd7K for ; Tue, 25 Jun 2013 00:37:19 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yh0-f73.google.com (mail-yh0-f73.google.com [209.85.213.73]) by theia.denx.de (Postfix) with ESMTPS id 4473A4A028 for ; Tue, 25 Jun 2013 00:37:12 +0200 (CEST) Received: by mail-yh0-f73.google.com with SMTP id l109so1320497yhq.2 for ; Mon, 24 Jun 2013 15:37:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=oGWQM8T8EG0VG7bpArMkDvm5j929P5hX+36f+6z9p90=; b=dli57NkmP3C1O4MWKATEHWJQ1X6jS7liL/medYWV/6R8b0HHIDxur73QtWt6hpsf0a OBEfPo3yFjnHpfph7tuVuwmYar38xp2S6qvfNvbZcEfC5Y65c4ZgcjCuafX45hOT3V18 Kv5uGA6EiiGIybBpjcVv1R6Bmjkf0MarqJMe1C+74hCIvp7SgUOmWKNKvPReL+tSH+6P BB6tPv+yQzy3oUoZTZ4KrLnlQHAjzOOuXLHdcjL2AO1isSYm59rO7JGF5F7ElEjWlG94 su5FJZm/j7fyjnLPMRZYejH+85U9hlTrFjGjcILWlwaFoeoSJUK7KgQ9R9qiEbtptLDs xB7Q== X-Received: by 10.236.148.101 with SMTP id u65mr1947784yhj.47.1372113431220; Mon, 24 Jun 2013 15:37:11 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x33si10101194yhj.0.2013.06.24.15.37.11 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 24 Jun 2013 15:37:11 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 06FB031C078; Mon, 24 Jun 2013 15:37:11 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id A45FB160997; Mon, 24 Jun 2013 15:37:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 24 Jun 2013 15:36:26 -0700 Message-Id: <1372113389-9415-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1372113389-9415-1-git-send-email-sjg@chromium.org> References: <1372113389-9415-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQmJNcnrlNAIUgevcnLdEcRrMbpNCuuCDirbG3O1QANyonl0ASk6Hh3k7NOVdwEOWrjzkMY8NIOzowCaVLISlOH8DYkI7I5x98qnJMX/jkFtmtqn+G3LpROpDWB7PVMKSIxgl5VUPDczdOJZMeJUf6Ygv5GI9YdKuJ2OI/124/EEZTVFiK2igCGSg+6AdViFYicfYtBy Cc: u-boot-review@google.com Subject: [U-Boot] [PATCH v4 3/6] sandbox: Rename sb_cmdline_option to sandbox_cmdline_option X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The new name is longer but more clearly related to sandbox. This is in a separate patch within the same series since some coments on the SPI series rely on it. Signed-off-by: Simon Glass --- Changes in v4: - Add new patch to rename to sandbox_cmdline_option Changes in v3: None Changes in v2: None arch/sandbox/cpu/os.c | 2 +- arch/sandbox/cpu/start.c | 17 +++++++++-------- arch/sandbox/include/asm/getopt.h | 23 ++++++++++++----------- arch/sandbox/include/asm/sections.h | 4 ++-- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index d075407..3e4fd0e 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -176,7 +176,7 @@ static struct option *long_opts; int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) { - struct sb_cmdline_option **sb_opt = __u_boot_sandbox_option_start; + struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start; size_t num_options = __u_boot_sandbox_option_count(); size_t i; diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index ae6e16c..e1f83f9 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -29,7 +29,7 @@ int sandbox_early_getopt_check(void) { struct sandbox_state *state = state_get_current(); - struct sb_cmdline_option **sb_opt = __u_boot_sandbox_option_start; + struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start; size_t num_options = __u_boot_sandbox_option_count(); size_t i; int max_arg_len, max_noarg_len; @@ -56,7 +56,7 @@ int sandbox_early_getopt_check(void) max_noarg_len = max_arg_len + 7; for (i = 0; i < num_options; ++i) { - struct sb_cmdline_option *opt = sb_opt[i]; + struct sandbox_cmdline_option *opt = sb_opt[i]; /* first output the short flag if it has one */ if (opt->flag_short >= 0x100) @@ -77,12 +77,12 @@ int sandbox_early_getopt_check(void) os_exit(0); } -static int sb_cmdline_cb_help(struct sandbox_state *state, const char *arg) +static int sandbox_cmdline_cb_help(struct sandbox_state *state, const char *arg) { /* just flag to sandbox_early_getopt_check to show usage */ return 1; } -SB_CMDLINE_OPT_SHORT(help, 'h', 0, "Display help"); +SANDBOX_CMDLINE_OPT_SHORT(help, 'h', 0, "Display help"); int sandbox_main_loop_init(void) { @@ -97,19 +97,20 @@ int sandbox_main_loop_init(void) return 0; } -static int sb_cmdline_cb_command(struct sandbox_state *state, const char *arg) +static int sandbox_cmdline_cb_command(struct sandbox_state *state, + const char *arg) { state->cmd = arg; return 0; } -SB_CMDLINE_OPT_SHORT(command, 'c', 1, "Execute U-Boot command"); +SANDBOX_CMDLINE_OPT_SHORT(command, 'c', 1, "Execute U-Boot command"); -static int sb_cmdline_cb_fdt(struct sandbox_state *state, const char *arg) +static int sandbox_cmdline_cb_fdt(struct sandbox_state *state, const char *arg) { state->fdt_fname = arg; return 0; } -SB_CMDLINE_OPT_SHORT(fdt, 'd', 1, "Specify U-Boot's control FDT"); +SANDBOX_CMDLINE_OPT_SHORT(fdt, 'd', 1, "Specify U-Boot's control FDT"); int main(int argc, char *argv[]) { diff --git a/arch/sandbox/include/asm/getopt.h b/arch/sandbox/include/asm/getopt.h index 685883c..3048c2c 100644 --- a/arch/sandbox/include/asm/getopt.h +++ b/arch/sandbox/include/asm/getopt.h @@ -18,7 +18,7 @@ struct sandbox_state; * consumer code should focus on the macros below and * the callback function. */ -struct sb_cmdline_option { +struct sandbox_cmdline_option { /* The long flag name: "help" for "--help" */ const char *flag; /* The (optional) short flag name: "h" for "-h" */ @@ -35,18 +35,19 @@ struct sb_cmdline_option { * Internal macro to expand the lower macros into the necessary * magic junk that makes this all work. */ -#define _SB_CMDLINE_OPT(f, s, ha, h) \ - static struct sb_cmdline_option sb_cmdline_option_##f = { \ +#define _SANDBOX_CMDLINE_OPT(f, s, ha, h) \ + static struct sandbox_cmdline_option sandbox_cmdline_option_##f = { \ .flag = #f, \ .flag_short = s, \ .help = h, \ .has_arg = ha, \ - .callback = sb_cmdline_cb_##f, \ + .callback = sandbox_cmdline_cb_##f, \ }; \ /* Ppointer to the struct in a special section for the linker script */ \ static __attribute__((section(".u_boot_sandbox_getopt"), used)) \ - struct sb_cmdline_option *sb_cmdline_option_##f##_ptr = \ - &sb_cmdline_option_##f + struct sandbox_cmdline_option \ + *sandbox_cmdline_option_##f##_ptr = \ + &sandbox_cmdline_option_##f /** * Macros for end code to declare new command line flags. @@ -56,16 +57,16 @@ struct sb_cmdline_option { * @param h The help string displayed when showing --help * * This invocation: - * SB_CMDLINE_OPT(foo, 0, "The foo arg"); + * SANDBOX_CMDLINE_OPT(foo, 0, "The foo arg"); * Will create a new flag named "--foo" (no short option) that takes * no argument. If the user specifies "--foo", then the callback func - * sb_cmdline_cb_foo() will automatically be called. + * sandbox_cmdline_cb_foo() will automatically be called. */ -#define SB_CMDLINE_OPT(f, ha, h) _SB_CMDLINE_OPT(f, 0, ha, h) +#define SANDBOX_CMDLINE_OPT(f, ha, h) _SANDBOX_CMDLINE_OPT(f, 0, ha, h) /* * Same as above, but @s is used to specify a short flag e.g. - * SB_CMDLINE_OPT(foo, 'f', 0, "The foo arg"); + * SANDBOX_CMDLINE_OPT(foo, 'f', 0, "The foo arg"); */ -#define SB_CMDLINE_OPT_SHORT(f, s, ha, h) _SB_CMDLINE_OPT(f, s, ha, h) +#define SANDBOX_CMDLINE_OPT_SHORT(f, s, ha, h) _SANDBOX_CMDLINE_OPT(f, s, ha, h) #endif diff --git a/arch/sandbox/include/asm/sections.h b/arch/sandbox/include/asm/sections.h index 4c37860..fbc1bd1 100644 --- a/arch/sandbox/include/asm/sections.h +++ b/arch/sandbox/include/asm/sections.h @@ -11,9 +11,9 @@ #include -struct sb_cmdline_option; +struct sandbox_cmdline_option; -extern struct sb_cmdline_option *__u_boot_sandbox_option_start[], +extern struct sandbox_cmdline_option *__u_boot_sandbox_option_start[], *__u_boot_sandbox_option_end[]; static inline size_t __u_boot_sandbox_option_count(void)