This makes it clear where the code resides.
Signed-off-by: Simon Glass <sjg@chromium.org>
 
        sprintf(output, "%s old: %s value: ", name, getenv(name));
        memset(cbuf, 0, CONFIG_SYS_CBSIZE);
-       readret = readline_into_buffer(output, cbuf, 0);
+       readret = cli_readline_into_buffer(output, cbuf, 0);
 
        if (readret >= 0) {
                ret = setenv(name, cbuf);
 
 
        do {
                printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
                        printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
 #endif
                }
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
                                printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
 
 #endif
-                       nbytes = readline (" ? ");
+                       nbytes = cli_readline(" ? ");
 
                        if (strcmp(console_buffer, "quit") == 0)
                                return 0;
 
        do {
                printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
        printf("Pci-X clk = %s MHz\n", pcixClock);
 
        do {
-               printf("\npress [y] to write I2C bootstrap \n");
-               printf("or [n] to abort.  \n");
-               printf("Don't forget to set board switches \n");
-               printf("according to your choice before re-starting \n");
-               printf("(refer to 440spe_uboot_kit_um_1_01.pdf) \n");
+               printf("\npress [y] to write I2C bootstrap\n");
+               printf("or [n] to abort.\n");
+               printf("Don't forget to set board switches\n");
+               printf("according to your choice before re-starting\n");
+               printf("(refer to 440spe_uboot_kit_um_1_01.pdf)\n");
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (strcmp(console_buffer, "n") == 0)
                        return 0;
 
 
                printf ("Press key:\n  <c> to copy current revision info to nvram.\n");
                printf ("  <r> to reenter revision info.\n");
                printf ("=> ");
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        switch ((char) toupper (console_buffer[0])) {
                        case 'C':
                                copyNv = 1;
                memcpy (buf, &eerev.revision[0][0], 14);        /* save all revision info */
                printf ("Enter revision number (0-9): %c  ",
                        eerev.revision[0][0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        eerev.revision[0][0] =
                                (char) toupper (console_buffer[0]);
                        memcpy (&eerev.revision[1][0], buf, 12);        /* shift rest of rev info */
 
                printf ("Enter revision character (A-Z): %c  ",
                        eerev.revision[0][1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        eerev.revision[0][1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &eerev.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++)
                                eerev.board[i] =
                                        (char) toupper (console_buffer[i]);
                }
 
                printf ("Enter serial number: %s ", (char *) &eerev.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++)
                                eerev.serial[i] = console_buffer[i];
                        eerev.serial[6] = '\0';
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", eerev.etheraddr[0], eerev.etheraddr[1], eerev.etheraddr[2], eerev.etheraddr[3], eerev.etheraddr[4], eerev.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2)
                                eerev.etheraddr[i >> 1] =
                                        (char) (16 *
                l = strlen ((char *) &eerev.text);
                printf ("Add to text section (max 64 chr): %s ",
                        (char *) &eerev.text);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        for (i = l; i < 63; i++)
                                eerev.text[i] = console_buffer[i - l];
                        eerev.text[63] = '\0';
 
        if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
                printf ("Enter revision number (0-9): %c  ",
                        mhpcRevInfo.revision[0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        mhpcRevInfo.revision[0] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter revision character (A-Z): %c  ",
                        mhpcRevInfo.revision[1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        mhpcRevInfo.revision[1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &mhpcRevInfo.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++) {
                                mhpcRevInfo.board[i] =
                                        (char) toupper (console_buffer[i]);
                do {
                        printf ("\nEnter sensor number (0-255): %d  ",
                                (int) mhpcRevInfo.sensor);
-                       if (0 != readline (NULL)) {
+                       if (0 != cli_readline(NULL)) {
                                mhpcRevInfo.sensor =
                                        (unsigned char)
                                        simple_strtoul (console_buffer, NULL,
 
                printf ("Enter serial number: %s ",
                        (char *) &mhpcRevInfo.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++) {
                                mhpcRevInfo.serial[i] = console_buffer[i];
                        }
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1], mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3], mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2) {
                                mhpcRevInfo.etheraddr[i >> 1] =
                                        (char) (16 *
 
 
 #ifdef CONFIG_BOOT_RETRY_TIME
        /*
-        * we use the readline () function, but we also want
+        * we use the cli_readline() function, but we also want
         * command timeout enabled
         */
        init_cmd_timeout ();
 
                reset_cmd_timeout ();
 #endif
 
-               n = readline (prompt);
+               n = cli_readline(prompt);
 
                if (n < 0)
                        return (n);
                reset_cmd_timeout ();
 #endif
 
-               n = readline ("Enter board ethernet address: ");
+               n = cli_readline("Enter board ethernet address: ");
 
                if (n < 0)
                        return (n);
 
 #endif
        i->__promptme = 1;
        if (i->promptmode == 1) {
-               n = readline(CONFIG_SYS_PROMPT);
+               n = cli_readline(CONFIG_SYS_PROMPT);
        } else {
-               n = readline(CONFIG_SYS_PROMPT_HUSH_PS2);
+               n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
        }
 #ifdef CONFIG_BOOT_RETRY_TIME
        if (n == -2) {
 
 
 /****************************************************************************/
 
-int readline(const char *const prompt)
+int cli_readline(const char *const prompt)
 {
        /*
         * If console_buffer isn't 0-length the user will be prompted to modify
         */
        console_buffer[0] = '\0';
 
-       return readline_into_buffer(prompt, console_buffer, 0);
+       return cli_readline_into_buffer(prompt, console_buffer, 0);
 }
 
 
-int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                            int timeout)
 {
        char *p = buffer;
 #ifdef CONFIG_CMDLINE_EDITING
 
        debug_cond(DEBUG_PARSER, fmt, ##args)
 
 
-int parse_line(char *line, char *argv[])
+int cli_simple_parse_line(char *line, char *argv[])
 {
        int nargs = 0;
 
                process_macros(token, finaltoken);
 
                /* Extract arguments */
-               argc = parse_line(finaltoken, argv);
+               argc = cli_simple_parse_line(finaltoken, argv);
                if (argc == 0) {
                        rc = -1;        /* no command at all */
                        continue;
                        reset_cmd_timeout();
                }
 #endif
-               len = readline(CONFIG_SYS_PROMPT);
+               len = cli_readline(CONFIG_SYS_PROMPT);
 
                flag = 0;       /* assume no special flags for now */
                if (len > 0)
 
 ulong dis_last_addr = 0;       /* Last address disassembled   */
 ulong dis_last_len = 20;       /* Default disassembler length */
 CPU_DEBUG_CTX bug_ctx;         /* Bedbug context structure    */
-\f
+
 
 /* ======================================================================
  * U-Boot's puts function does not append a newline, so the bedbug stuff
        printf ("%s\r\n", str);
        return 0;
 }                              /* bedbug_puts */
-\f
+
 
 
 /* ======================================================================
 
        return;
 }                              /* bedbug_init */
-\f
+
 
 
 /* ======================================================================
 U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
            "disassemble memory",
            "ds <address> [# instructions]");
-\f
+
 /* ======================================================================
  * Entry point from the interpreter to the assembler.  Assembles
  * instructions in consecutive memory locations until a '.' (period) is
                        F_RADHEX);
 
                sprintf (prompt, "%08lx:    ", mem_addr);
-               readline (prompt);
+               cli_readline(prompt);
 
                if (console_buffer[0] && strcmp (console_buffer, ".")) {
                        if ((instr =
 
 U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
            "assemble memory", "as <address>");
-\f
+
 /* ======================================================================
  * Used to set a break point from the interpreter.  Simply calls into the
  * CPU-specific break point set routine.
            "break <address> - Break at an address\n"
            "break off <bp#> - Disable breakpoint.\n"
            "break show      - List breakpoints.");
-\f
+
 /* ======================================================================
  * Called from the debug interrupt routine.  Simply calls the CPU-specific
  * breakpoint handling routine.
 
        return;
 }                              /* do_bedbug_breakpoint */
-\f
+
 
 
 /* ======================================================================
 
        /* A miniature main loop */
        while (bug_ctx.stopped) {
-               len = readline (prompt_str);
+               len = cli_readline(prompt_str);
 
                flag = 0;       /* assume no special flags for now */
 
 
        return;
 }                              /* bedbug_main_loop */
-\f
+
 
 
 /* ======================================================================
 U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
            "continue from a breakpoint",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping into
  * subroutines.  Works by calling the find_next_addr() routine to compute
 U_BOOT_CMD (step, 1, 1, do_bedbug_step,
            "single step execution.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping over
  * subroutines.  Works by calling the find_next_addr() routine to compute
 U_BOOT_CMD (next, 1, 1, do_bedbug_next,
            "single step execution, stepping over subroutines.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to print the current stack.  This assumes an EABI
  * architecture, so it starts with GPR R1 and works back up the stack.
 U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
            "Print the running stack.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to dump the registers.  Calls the CPU-specific
  * show registers routine.
 
        do {
                value = get_dcr (dcrn);
                printf ("%04x: %08lx", dcrn, value);
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
 
                                printf(" %08lx", data);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
 
                else
                        printf(" %02x", *((u8 *)ptr));
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
 
                return 1;
 
        /* prompt for input */
-       len = readline(message);
+       len = cli_readline(message);
 
        if (size < len)
                console_buffer[size] = '\0';
        else
                buffer[0] = '\0';
 
-       if (readline_into_buffer("edit: ", buffer, 0) < 0)
+       if (cli_readline_into_buffer("edit: ", buffer, 0) < 0)
                return 1;
 
        return setenv(argv[1], buffer);
 
                        printf(" %02x", val1);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
 
                menu_display(m);
 
                if (!m->item_choice) {
-                       readret = readline_into_buffer("Enter choice: ", cbuf,
-                                       m->timeout / 10);
+                       readret = cli_readline_into_buffer("Enter choice: ",
+                                                          cbuf,
+                                                          m->timeout / 10);
 
                        if (readret >= 0) {
                                choice_item = menu_item_by_key(m, cbuf);
 
                } else {
                        /*
                         * No need to worry for buffer overflow here in
-                        * this function;  readline() maxes out at CFG_CBSIZE
+                        * this function;  cli_readline() maxes out at
+                        * CFG_CBSIZE
                         */
-                       readline_into_buffer(prompt, buffer, 0);
+                       cli_readline_into_buffer(prompt, buffer, 0);
                }
-               argc = parse_line(buffer, argv);
+               argc = cli_simple_parse_line(buffer, argv);
                if (argc == 0)
                        continue;
 
 
  * @prompt: Prompt to display
  * @return command line length excluding terminator, or -ve on error
  */
-int readline(const char *const prompt);
+int cli_readline(const char *const prompt);
 
 /**
  * readline_into_buffer() - read a line into a buffer
  * parameter), then -2 is returned. If a break is detected (Ctrl-C) then
  * -1 is returned.
  */
-int readline_into_buffer(const char *const prompt, char *buffer, int timeout);
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                               int timeout);
 
 /**
  * parse_line() - split a command line down into separate arguments
  * @args:      Array to hold arguments
  * @return number of arguments
  */
-int parse_line(char *line, char *argv[]);
+int cli_simple_parse_line(char *line, char *argv[]);
 
 /** bootretry_dont_retry() - Indicate that we should not retry the boot */
 void bootretry_dont_retry(void);