diff mbox

[U-Boot,U-Boot,v6,4/9] nand: Extend nand_(read|write)_skip_bad with *actual and limit parameters

Message ID 20130410130819.GR5729@bill-the-cat
State Accepted
Delegated to: Marek Vasut
Headers show

Commit Message

Tom Rini April 10, 2013, 1:08 p.m. UTC
On Thu, Mar 14, 2013 at 05:32:50AM -0000, Tom Rini wrote:

> We make these two functions take a size_t pointer to how much space
> was used on NAND to read or write the buffer (when reads/writes happen)
> so that bad blocks can be accounted for.  We also make them take an
> loff_t limit on how much data can be read or written.  This means that
> we can now catch the case of when writing to a partition would exceed
> the partition size due to bad blocks.  To do this we also need to make
> check_skip_len count not just complete blocks used but partial ones as
> well.  All callers of nand_(read|write)_skip_bad are adjusted to call
> these with the most sensible limits available.
> 
> The changes were started by Pantelis and finished by Tom.
> 
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> Signed-off-by: Tom Rini <trini@ti.com>

With current master, the following changes are needed to adapt cm_t35 to
these call changes:

Comments

Igor Grinberg April 11, 2013, 6:37 a.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/10/13 16:08, Tom Rini wrote:
> On Thu, Mar 14, 2013 at 05:32:50AM -0000, Tom Rini wrote:
> 
>> We make these two functions take a size_t pointer to how much space
>> was used on NAND to read or write the buffer (when reads/writes happen)
>> so that bad blocks can be accounted for.  We also make them take an
>> loff_t limit on how much data can be read or written.  This means that
>> we can now catch the case of when writing to a partition would exceed
>> the partition size due to bad blocks.  To do this we also need to make
>> check_skip_len count not just complete blocks used but partial ones as
>> well.  All callers of nand_(read|write)_skip_bad are adjusted to call
>> these with the most sensible limits available.
>>
>> The changes were started by Pantelis and finished by Tom.
>>
>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>> Signed-off-by: Tom Rini <trini@ti.com>
> 
> With current master, the following changes are needed to adapt cm_t35 to
> these call changes:

I guess, you will squash both patches into one, right?

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

> 
> diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
> index 629ce4a..84c36ba 100644
> --- a/board/cm_t35/cm_t35.c
> +++ b/board/cm_t35/cm_t35.c
> @@ -91,6 +91,7 @@ static int splash_load_from_nand(u32 bmp_load_addr)
>  
>  	res = nand_read_skip_bad(&nand_info[nand_curr_device],
>  			splash_screen_nand_offset, &bmp_header_size,
> +			NULL, nand_info[nand_curr_device].size,
>  			(u_char *)bmp_load_addr);
>  	if (res < 0)
>  		return res;
> @@ -103,6 +104,7 @@ static int splash_load_from_nand(u32 bmp_load_addr)
>  
>  	return nand_read_skip_bad(&nand_info[nand_curr_device],
>  			splash_screen_nand_offset, &bmp_size,
> +			NULL, nand_info[nand_curr_device].size,
>  			(u_char *)bmp_load_addr);
>  
>  splash_address_too_high:
> 

- -- 
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRZlo8AAoJEBDE8YO64EfazSoP/1u/f8FQwl7zZDcwlUIWSJPe
nsk66wJxMteHKPG9Ib3DGKNW+ncAEfNYWH7Pzqg9rnsp+oWf/bMpTil/qWV0J8Qp
QSTC3ez5QOYONBn/Zb8MyOyMcHVnbOFrKiHIR+7zjPhaWWRzVAM7VBxiYS/gtGUY
tiK8ccqH9w8r+t4s6fbWZ8WWTX0ZryKcCiGxiNnjFGz5xphsS9+AvTbIL7n2r+ji
mie9SD/Lb6GCeEhgYT9XBgo7gjx6Q0RNEXZL5fP+YWpII73KPFzvzzMTRo2jwWxr
/vggymfjJ3amAFvMuFuIk3OEbH5CSWKnfX5pwyW2TIZ+GZttiFw040ZurmA6k3f9
LdwhFdgrp0BzRkwC92FLR+aMyV8A8WgFYkMysuqDlJkiaSXLVFlcLB43le6kuuyq
uKbRDTMMNiyHncet6znIjgmH3wzYECXlRyAkH7K0mz6DrkmAGraYizUy/XwxK6cr
/Zh0rmR0Owg/XZKZRRdhQnwGf/B9+FufNZehgYJlhOFHVFwm9bbHX02k16RD2PP5
P/AgdV8psCR0HvH9dJ+/93Y0r/paIp3PeAAt4nZxMwiHp07cJwqpjwgQUWDjxPkK
q3R6H0otAh7cDzE84QotNzeHlR1GuxFU6wQLuTE16EDrGE7BHyMaYjuhRXH9zHek
ptNpTuQm5/O7yn6tQHvV
=6ma+
-----END PGP SIGNATURE-----
Tom Rini April 11, 2013, 12:07 p.m. UTC | #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/11/2013 02:37 AM, Igor Grinberg wrote:
> On 04/10/13 16:08, Tom Rini wrote:
>> On Thu, Mar 14, 2013 at 05:32:50AM -0000, Tom Rini wrote:
> 
>>> We make these two functions take a size_t pointer to how much
>>> space was used on NAND to read or write the buffer (when
>>> reads/writes happen) so that bad blocks can be accounted for.
>>> We also make them take an loff_t limit on how much data can be
>>> read or written.  This means that we can now catch the case of
>>> when writing to a partition would exceed the partition size due
>>> to bad blocks.  To do this we also need to make check_skip_len
>>> count not just complete blocks used but partial ones as well.
>>> All callers of nand_(read|write)_skip_bad are adjusted to call 
>>> these with the most sensible limits available.
>>> 
>>> The changes were started by Pantelis and finished by Tom.
>>> 
>>> Signed-off-by: Pantelis Antoniou
>>> <panto@antoniou-consulting.com> Signed-off-by: Tom Rini
>>> <trini@ti.com>
> 
>> With current master, the following changes are needed to adapt
>> cm_t35 to these call changes:
> 
> I guess, you will squash both patches into one, right?

Yes, Marek already squashed this in as part of his pull request that I
need to switch hats and grab.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRZqeDAAoJENk4IS6UOR1WLuIP/RWThgn2nc7xMuMA2soKHQQQ
rSrF/wAAvVNRV3g0g6qQ7VZ/+IkH8C+cjPhpD/VUVbeodx+0b24kiW1Zfxcpblmw
G5cgIMDtAT9prs7upcktjzUwnU/JuZDx0HAfIeA7kWu/hpm2xhe7p3JIID47/sr1
k5Cw+8X+pKYVCt4px68TWhy+gEdKgfvK5rXKVpB4RCLVjTC9hyfmdySo7h6n1M+t
JhmuoHRbDmQsB/qVcauZypirO5AidrRU+baak83XBqgQnwTAPy/i6jDOegHYlaou
9rVzpyOpCUDXNEqDNrU9lOslFpSf0NfpRsAsWsvu35AbcA7yMnRR2kNXeOr2Djur
sUvWpaLpWYpvhT16GGvk8xyoj6eaA3G+LycBFdTcRZPsdeIfs4/lnjRn0Nreq1jQ
CST9w6HyMzBEUhwV4BarPmR4nk1tRwbmX6hfkRbH4iENhG63PYRuX5A18uC8O8uS
wCOZo71a2GvOHFvDSNd2Qkscs3A1QC+6jcm9FBbvydzU4NXo9yIFt+QlsWjenhwv
MWHsFZX5tBP4U2N/mkkRoaJfrpTW137RqPvxwsqB96JObeafdw0SNGGlks6N7X1Z
/83jyM2iEy7icg8e3g+cVTtrJUwAifyZI6wjBGiEV4rxtthLyxNBhm0nerJcXvX+
B8AiXe67JK9wju7t7fRt
=ACw6
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 629ce4a..84c36ba 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -91,6 +91,7 @@  static int splash_load_from_nand(u32 bmp_load_addr)
 
 	res = nand_read_skip_bad(&nand_info[nand_curr_device],
 			splash_screen_nand_offset, &bmp_header_size,
+			NULL, nand_info[nand_curr_device].size,
 			(u_char *)bmp_load_addr);
 	if (res < 0)
 		return res;
@@ -103,6 +104,7 @@  static int splash_load_from_nand(u32 bmp_load_addr)
 
 	return nand_read_skip_bad(&nand_info[nand_curr_device],
 			splash_screen_nand_offset, &bmp_size,
+			NULL, nand_info[nand_curr_device].size,
 			(u_char *)bmp_load_addr);
 
 splash_address_too_high: