public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Bastian Stender <bst@pengutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Richard Weinberger <richard@nod.at>,
	Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org, kernel@pengutronix.de,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>,
	Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH] mtd: partitions: no unnecessary check for erase block
Date: Mon, 9 Jan 2017 11:18:55 +0100	[thread overview]
Message-ID: <20170109111855.7580f007@bbrezillon> (raw)
In-Reply-To: <20170106162624.544-1-bst@pengutronix.de>

On Fri,  6 Jan 2017 17:26:24 +0100
Bastian Stender <bst@pengutronix.de> wrote:

> Partitions must start/end on erase block or boundary to be writeable.
> This makes only sense if erasing is necessary. Do not force the
> partition to be read-only if MTD_NO_ERASE flag is set.

Shouldn't the partition be aligned on ->writesize in this case?

> 
> Signed-off-by: Bastian Stender <bst@pengutronix.de>
> ---
>  drivers/mtd/mtdpart.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index fccdd49bb964..cd138023ed32 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -557,6 +557,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
>  	}
>  
>  	if ((slave->mtd.flags & MTD_WRITEABLE) &&
> +	    !(slave->mtd.flags & MTD_NO_ERASE) &&
>  	    mtd_mod_by_eb(slave->offset, &slave->mtd)) {
>  		/* Doesn't start on a boundary of major erase size */
>  		/* FIXME: Let it be writable if it is on a boundary of
> @@ -566,6 +567,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
>  			part->name);
>  	}
>  	if ((slave->mtd.flags & MTD_WRITEABLE) &&
> +	    !(slave->mtd.flags & MTD_NO_ERASE) &&
>  	    mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) {
>  		slave->mtd.flags &= ~MTD_WRITEABLE;
>  		printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n",

  reply	other threads:[~2017-01-09 10:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 16:26 [PATCH] mtd: partitions: no unnecessary check for erase block Bastian Stender
2017-01-09 10:18 ` Boris Brezillon [this message]
2017-01-16 15:19   ` Bastian Stender

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=20170109111855.7580f007@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=bst@pengutronix.de \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /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