mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: ubi: get_bad_peb_limit from mtd master
@ 2014-11-19 14:45 Jan Weitzel
  2014-11-20 13:53 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Weitzel @ 2014-11-19 14:45 UTC (permalink / raw)
  To: barebox

Like mentioned in the coment we need the size of the entire flash chip.
Check if a master exists and take his size.

Otherwise the limit will be too small and kernel prints:
UBI warning: print_rsvd_warning: cannot reserve enough PEBs for \
bad PEB handling, reserved 19, need 20

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 drivers/mtd/ubi/build.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 7b1c332..b02880e 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -237,7 +237,11 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
 	 * is that all the bad eraseblocks of the chip are in
 	 * the MTD partition we are attaching (ubi->mtd).
 	 */
-	device_size = ubi->mtd->size;
+	if (ubi->mtd->master)
+		device_size = ubi->mtd->master->size;
+	else
+		device_size = ubi->mtd->size;
+
 	device_pebs = mtd_div_by_eb(device_size, ubi->mtd);
 	limit = mult_frac(device_pebs, max_beb_per1024, 1024);
 
-- 
1.9.1


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: ubi: get_bad_peb_limit from mtd master
  2014-11-19 14:45 [PATCH] mtd: ubi: get_bad_peb_limit from mtd master Jan Weitzel
@ 2014-11-20 13:53 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-11-20 13:53 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Wed, Nov 19, 2014 at 03:45:41PM +0100, Jan Weitzel wrote:
> Like mentioned in the coment we need the size of the entire flash chip.
> Check if a master exists and take his size.
> 
> Otherwise the limit will be too small and kernel prints:
> UBI warning: print_rsvd_warning: cannot reserve enough PEBs for \
> bad PEB handling, reserved 19, need 20
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>

Applied, thanks

Sascha

> ---
>  drivers/mtd/ubi/build.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 7b1c332..b02880e 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -237,7 +237,11 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
>  	 * is that all the bad eraseblocks of the chip are in
>  	 * the MTD partition we are attaching (ubi->mtd).
>  	 */
> -	device_size = ubi->mtd->size;
> +	if (ubi->mtd->master)
> +		device_size = ubi->mtd->master->size;
> +	else
> +		device_size = ubi->mtd->size;
> +
>  	device_pebs = mtd_div_by_eb(device_size, ubi->mtd);
>  	limit = mult_frac(device_pebs, max_beb_per1024, 1024);
>  
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-20 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 14:45 [PATCH] mtd: ubi: get_bad_peb_limit from mtd master Jan Weitzel
2014-11-20 13:53 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox