From 9ef78511cda39987e5fc10febf386fd19f58ecf7 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 9 Nov 2009 15:17:50 -0600 Subject: circbuf: Move to lib_generic and conditionally compile circbuf could be used as a generic library and is only currently needed when CONFIG_USB_TTY is defined. Signed-off-by: Peter Tyser --- common/Makefile | 1 - common/circbuf.c | 110 ------------------------------------------------------- 2 files changed, 111 deletions(-) delete mode 100644 common/circbuf.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 3781738e1..47f6a71e2 100644 --- a/common/Makefile +++ b/common/Makefile @@ -29,7 +29,6 @@ AOBJS = # core COBJS-y += main.o -COBJS-y += circbuf.o COBJS-y += console.o COBJS-y += command.o COBJS-y += dlmalloc.o diff --git a/common/circbuf.c b/common/circbuf.c deleted file mode 100644 index 2332c6371..000000000 --- a/common/circbuf.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (C) Copyright 2003 - * Gerry Hamel, geh@ti.com, Texas Instruments - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include - -#include - - -int buf_init (circbuf_t * buf, unsigned int size) -{ - assert (buf != NULL); - - buf->size = 0; - buf->totalsize = size; - buf->data = (char *) malloc (sizeof (char) * size); - assert (buf->data != NULL); - - buf->top = buf->data; - buf->tail = buf->data; - buf->end = &(buf->data[size]); - - return 1; -} - -int buf_free (circbuf_t * buf) -{ - assert (buf != NULL); - assert (buf->data != NULL); - - free (buf->data); - memset (buf, 0, sizeof (circbuf_t)); - - return 1; -} - -int buf_pop (circbuf_t * buf, char *dest, unsigned int len) -{ - unsigned int i; - char *p = buf->top; - - assert (buf != NULL); - assert (dest != NULL); - - /* Cap to number of bytes in buffer */ - if (len > buf->size) - len = buf->size; - - for (i = 0; i < len; i++) { - dest[i] = *p++; - /* Bounds check. */ - if (p == buf->end) { - p = buf->data; - } - } - - /* Update 'top' pointer */ - buf->top = p; - buf->size -= len; - - return len; -} - -int buf_push (circbuf_t * buf, const char *src, unsigned int len) -{ - /* NOTE: this function allows push to overwrite old data. */ - unsigned int i; - char *p = buf->tail; - - assert (buf != NULL); - assert (src != NULL); - - for (i = 0; i < len; i++) { - *p++ = src[i]; - if (p == buf->end) { - p = buf->data; - } - /* Make sure pushing too much data just replaces old data */ - if (buf->size < buf->totalsize) { - buf->size++; - } else { - buf->top++; - if (buf->top == buf->end) { - buf->top = buf->data; - } - } - } - - /* Update 'tail' pointer */ - buf->tail = p; - - return len; -} -- cgit v1.2.3 From a5dd4dc64fe68e549c5ffcf6a048281b5ba94752 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Wed, 11 Nov 2009 10:36:19 -0600 Subject: cmd_license: Remove unneeded #ifdef CONFIG_CMD_LICENSE cmd_license is already conditionally compiled at the Makefile-level. Signed-off-by: Peter Tyser --- common/cmd_license.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'common') diff --git a/common/cmd_license.c b/common/cmd_license.c index 141215b3a..c6f272ad3 100644 --- a/common/cmd_license.c +++ b/common/cmd_license.c @@ -23,8 +23,6 @@ #include -#if defined(CONFIG_CMD_LICENSE) - /* COPYING is currently 15951 bytes in size */ #define LICENSE_MAX 20480 @@ -56,5 +54,3 @@ U_BOOT_CMD(license, 1, 1, do_license, "print GPL license text", "" ); - -#endif /* CONFIG_CMD_LICENSE */ -- cgit v1.2.3 From c253122395753abb9e531d8906c5265dc8803fb1 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Wed, 11 Nov 2009 10:36:28 -0600 Subject: Move do_irqinfo() to common/cmd_irq.c cmd_irq.c is a much better home and it is already conditionally compiled based on CONFIG_CMD_IRQ. Signed-off-by: Peter Tyser --- common/cmd_irq.c | 9 +++++++++ common/cmd_misc.c | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/cmd_irq.c b/common/cmd_irq.c index 4604a5a31..2c7e6bbf0 100644 --- a/common/cmd_irq.c +++ b/common/cmd_irq.c @@ -47,3 +47,12 @@ U_BOOT_CMD( "enable or disable interrupts", "[on, off]" ); + +/* Implemented in $(CPU)/interrupts.c */ +int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +U_BOOT_CMD( + irqinfo, 1, 1, do_irqinfo, + "print information about IRQs", + "" +); diff --git a/common/cmd_misc.c b/common/cmd_misc.c index b97537ecd..b0ced2f3b 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -49,17 +49,6 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -/* Implemented in $(CPU)/interrupts.c */ -#if defined(CONFIG_CMD_IRQ) -int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); - -U_BOOT_CMD( - irqinfo, 1, 1, do_irqinfo, - "print information about IRQs", - "" -); -#endif - U_BOOT_CMD( sleep , 2, 1, do_sleep, "delay execution for some time", -- cgit v1.2.3 From d52e3e0176a74c30549251e16c5c00a363c544d2 Mon Sep 17 00:00:00 2001 From: Magnus Lilja Date: Wed, 11 Nov 2009 19:56:36 +0100 Subject: cmd_date: Fix spelling in error message. Signed-off-by: Magnus Lilja --- common/cmd_date.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/cmd_date.c b/common/cmd_date.c index 9f50f8956..3141a3968 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -71,9 +71,9 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* and write to RTC */ rcode = rtc_set (&tm); if(rcode) - puts("## Set date failled\n"); + puts("## Set date failed\n"); } else { - puts("## Get date failled\n"); + puts("## Get date failed\n"); } } /* FALL TROUGH */ @@ -81,7 +81,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) rcode = rtc_get (&tm); if (rcode) { - puts("## Get date failled\n"); + puts("## Get date failed\n"); break; } -- cgit v1.2.3 From bd3784df94bfeca43fbf34094df9cb1bd3ecca3b Mon Sep 17 00:00:00 2001 From: Pratap Chandu Date: Thu, 12 Nov 2009 19:28:25 +0530 Subject: Removes dead code in the file common/cmd_i2c.c There is some dead code enclosed by #if 0 .... #endif in the file common/cmd_i2c.c This patch removes the dead code. Signed-off-by: Pratap Chandu --- common/cmd_i2c.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'common') diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 8f0fc9e1d..8d6feda27 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -326,14 +326,6 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #if !defined(CONFIG_SYS_I2C_FRAM) udelay(11000); #endif - -#if 0 - for (timeout = 0; timeout < 10; timeout++) { - udelay(2000); - if (i2c_probe(chip) == 0) - break; - } -#endif } return (0); -- cgit v1.2.3 From bcb324d68f7955c1136dafc944eb55db8ebaa601 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Thu, 19 Nov 2009 11:00:28 -0500 Subject: Remove superfluous preprocessor tests from some cmd_*.c files. A small number of common/cmd_*.c files contain preprocessor tests that are apparently superfluous since those same tests are used in the Makefile to control the compilation of those files. Those tests are clearly redundant as long as they surround the entirety of the source in those files. Signed-off-by: Robert P. J. Day --- common/cmd_cache.c | 4 ---- common/cmd_mgdisk.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'common') diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 0dfa3363b..120225841 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -27,8 +27,6 @@ #include #include -#if defined(CONFIG_CMD_CACHE) - static int on_off (const char *); int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -108,5 +106,3 @@ U_BOOT_CMD( "[on, off]\n" " - enable or disable data (writethrough) cache" ); - -#endif diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c index aadc33563..3ba62f618 100644 --- a/common/cmd_mgdisk.c +++ b/common/cmd_mgdisk.c @@ -24,8 +24,6 @@ #include #include -#if defined (CONFIG_CMD_MG_DISK) - #include int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -72,5 +70,3 @@ U_BOOT_CMD( " - sector read : mgd readsec [sector] [to] [counts]\n" " - sector write : mgd writesec [from] [sector] [counts]" ); - -#endif -- cgit v1.2.3