mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Vicente Bergas <vicencb@gmail.com>
To: barebox@lists.infradead.org
Cc: Vicente Bergas <vicencb@gmail.com>
Subject: [PATCH 1/2] uimage: fix misunderstanding in common/uimage.c
Date: Sat, 24 Nov 2012 04:24:23 +0100	[thread overview]
Message-ID: <1353727464-15175-2-git-send-email-vicencb@gmail.com> (raw)
In-Reply-To: <1353727464-15175-1-git-send-email-vicencb@gmail.com>

The option of reading the file at once was discarded because
the option of increasing the buffer size provided almost the
same benefit.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 common/uimage.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/common/uimage.c b/common/uimage.c
index 3f5a3d5..8bcbfdd 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -28,8 +28,6 @@
 #include <rtc.h>
 #include <filetype.h>
 #include <memory.h>
-#include <linux/stat.h>
-#include <sizes.h>
 
 #ifdef CONFIG_UIMAGE_MULTI
 static inline int uimage_is_multi_image(struct uimage_handle *handle)
@@ -384,33 +382,11 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)
 	size_t ofs = 0;
 	size_t now;
 	int fd;
-	struct stat s;
 
 	fd = open(filename, O_RDONLY);
 	if (fd < 0)
 		return NULL;
 
-	/* TODO: use fstat(fd, &s) when implemented and avoid reopening file */
-	if (stat(filename, &s) == 0 && s.st_size <= SZ_1G) {
-		/*
-		 * As the file size is known we can read it at once and improve
-		 * transfer speed.
-		 */
-		size = s.st_size;
-		res = request_sdram_region("image", adr, size);
-		if (!res) {
-			printf("unable to request SDRAM 0x%08lx-0x%08lx\n",
-				adr, adr + size - 1);
-			goto out;
-		}
-
-		now = read_full(fd, (void *)(res->start), size);
-		if (now < size) {
-			release_sdram_region(res);
-			res = NULL;
-		}
-		goto out;
-	}
 	while (1) {
 		res = request_sdram_region("image", adr, size);
 		if (!res) {
-- 
1.8.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-24  3:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-24  3:24 [PATCH 0/2] Some corrections on archosG9 Vicente Bergas
2012-11-24  3:24 ` Vicente Bergas [this message]
2012-11-24  8:45   ` [PATCH 1/2] uimage: fix misunderstanding in common/uimage.c Jean-Christophe PLAGNIOL-VILLARD
2012-11-24 13:31     ` vj
2012-11-24  3:24 ` [PATCH 2/2] archosg9: improve configuration Vicente Bergas
2012-11-26  8:00 ` [PATCH 0/2] Some corrections on archosG9 Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353727464-15175-2-git-send-email-vicencb@gmail.com \
    --to=vicencb@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox