public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Ben Shelton <ben.shelton@ni.com>
Cc: linux-mtd@lists.infradead.org, computersforpeace@gmail.com,
	dwmw2@infradead.org, linux-kernel@vger.kernel.org,
	Jeff Westfahl <jeff.westfahl@ni.com>
Subject: Re: [PATCH] mtd: Introduce CONFIG_MTD_RESERVE_END
Date: Fri, 01 May 2015 00:02:37 +0200	[thread overview]
Message-ID: <1430431357.2187.43.camel@x220> (raw)
In-Reply-To: <1430335682-6174-1-git-send-email-ben.shelton@ni.com>

While you're discussing more substantial questions with Brian, I found
some nits.

On Wed, 2015-04-29 at 14:28 -0500, Ben Shelton wrote:
> --- a/drivers/mtd/Kconfig
> +++ b/drivers/mtd/Kconfig


> +config MTD_RESERVE_END
> +	int "Reserved space at the end of an all remaining space partition"
> +	depends on MTD_CMDLINE_PARTS = "y"

(The quotes are unneeded.)

MTD_CMDLINE_PARTS is tristate. Why does it need to be built-in for this
symbol?

> +	default 0
> +	---help---
> +	  Specify an amount of reserved space at the end of the last MTD
> +	  partition when the size is specified with '-' to denote all
> +	  remaining space.
> +
> +	  This can be useful if, for example, the BBT is stored at the end
> +	  of the flash, and you don't want those blocks counted as part of
> +	  the last MTD partition. This is less heavyweight than reserving
> +	  the BBT blocks with a separate MTD partition. The BBT marks its
> +	  own blocks as bad blocks, which prevents an MTD driver such as
> +	  UBI from getting an accurate count of the actual bad blocks in
> +	  the MTD partition that contains the BBT.
> +
> +	  The value is specified in bytes. As an example, a typical BBT
> +	  reserves four erase blocks, and a typical erase block size is
> +	  128kB. To reserve that much space at the end of the flash, the
> +	  value for this config option would be 524288.
> +
> +	  If unsure, use the default value of zero.

> --- a/drivers/mtd/cmdlinepart.c
> +++ b/drivers/mtd/cmdlinepart.c
> @@ -340,7 +340,8 @@ static int parse_cmdline_partitions(struct mtd_info *master,
>  			offset = part->parts[i].offset;
>  
>  		if (part->parts[i].size == SIZE_REMAINING)
> -			part->parts[i].size = master->size - offset;
> +			part->parts[i].size = master->size - offset -
> +					      CONFIG_MTD_RESERVE_END;

I haven't tested this. (Quite often that means: I'm wrong.) But if
MTD_CMDLINE_PARTS is set to "m" I think MTD_RESERVE_END will not be set.
In that case CPP will helpfully set CONFIG_MTD_RESERVE_END to zero
(which is what you want). But it should also trigger this warning:
    "CONFIG_MTD_RESERVE_END" is not defined [-Wundef]

>  
>  		if (offset + part->parts[i].size > master->size) {
>  			printk(KERN_WARNING ERRP


Paul Bolle

  parent reply	other threads:[~2015-04-30 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:28 [PATCH] mtd: Introduce CONFIG_MTD_RESERVE_END Ben Shelton
2015-04-29 21:46 ` Brian Norris
2015-04-30 17:36   ` Ben Shelton
2015-05-01 11:57     ` Jonas Gorski
2015-05-07  3:27       ` Brian Norris
2015-04-30 22:02 ` Paul Bolle [this message]
2015-04-30 22:46   ` Ben Shelton

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=1430431357.2187.43.camel@x220 \
    --to=pebolle@tiscali.nl \
    --cc=ben.shelton@ni.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jeff.westfahl@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@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