Patchwork [U-Boot,13/20] drivers: Use new numeric setenv functions

login
register
mail settings
Submitter Simon Glass
Date Dec. 26, 2012, 6:57 p.m.
Message ID <1356548233-5570-14-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/208197/
State Superseded, archived
Delegated to: Simon Glass
Headers show

Comments

Simon Glass - Dec. 26, 2012, 6:57 p.m.
Use setenv_ulong(), setenv_hex() and setenv_addr() in drivers/

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 fs/fs.c          |    4 +---
 fs/ubifs/ubifs.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
Simon Glass - Feb. 15, 2013, 11:55 p.m.
On Wed, Dec 26, 2012 at 10:57 AM, Simon Glass <sjg@chromium.org> wrote:
> Use setenv_ulong(), setenv_hex() and setenv_addr() in drivers/
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to x86/master.

> ---
>  fs/fs.c          |    4 +---
>  fs/ubifs/ubifs.c |    4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
Tom Rini - Feb. 18, 2013, 10:37 p.m.
On Wed, Dec 26, 2012 at 10:57:06AM -0800, Simon Glass wrote:

> Use setenv_ulong(), setenv_hex() and setenv_addr() in drivers/
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>  fs/fs.c          |    4 +---
>  fs/ubifs/ubifs.c |    4 +---

fs/ not drivers/

Patch

diff --git a/fs/fs.c b/fs/fs.c
index 023e7ef..2c9f2c5 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -256,7 +256,6 @@  int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	unsigned long bytes;
 	unsigned long pos;
 	int len_read;
-	char buf[12];
 	unsigned long time;
 
 	if (argc < 2)
@@ -308,8 +307,7 @@  int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	}
 	puts("\n");
 
-	sprintf(buf, "0x%x", len_read);
-	setenv("filesize", buf);
+	setenv_hex("filesize", len_read);
 
 	return 0;
 }
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 44be3f5..273c0a9 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -687,7 +687,6 @@  int ubifs_load(char *filename, u32 addr, u32 size)
 	int i;
 	int count;
 	int last_block_size = 0;
-	char buf [10];
 
 	c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY);
 	/* ubifs_findfile will resolve symlinks, so we know that we get
@@ -740,8 +739,7 @@  int ubifs_load(char *filename, u32 addr, u32 size)
 	if (err)
 		printf("Error reading file '%s'\n", filename);
 	else {
-	        sprintf(buf, "%X", size);
-		setenv("filesize", buf);
+		setenv_hex("filesize", size);
 		printf("Done\n");
 	}