* [PATCH] mtd: partitions: no unnecessary check for erase block
@ 2017-01-06 16:26 Bastian Stender
2017-01-09 10:18 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Bastian Stender @ 2017-01-06 16:26 UTC (permalink / raw)
To: David Woodhouse
Cc: Brian Norris, Boris Brezillon, Marek Vasut, Richard Weinberger,
Cyrille Pitchen, linux-mtd, kernel, Bastian Stender
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.
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",
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: partitions: no unnecessary check for erase block
2017-01-06 16:26 [PATCH] mtd: partitions: no unnecessary check for erase block Bastian Stender
@ 2017-01-09 10:18 ` Boris Brezillon
2017-01-16 15:19 ` Bastian Stender
0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2017-01-09 10:18 UTC (permalink / raw)
To: Bastian Stender
Cc: David Woodhouse, Richard Weinberger, Marek Vasut, linux-mtd,
kernel, Cyrille Pitchen, Brian Norris
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",
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: partitions: no unnecessary check for erase block
2017-01-09 10:18 ` Boris Brezillon
@ 2017-01-16 15:19 ` Bastian Stender
0 siblings, 0 replies; 3+ messages in thread
From: Bastian Stender @ 2017-01-16 15:19 UTC (permalink / raw)
To: Boris Brezillon
Cc: David Woodhouse, Richard Weinberger, Marek Vasut, linux-mtd,
kernel, Cyrille Pitchen, Brian Norris
Hi,
On 01/09/2017 11:18 AM, Boris Brezillon wrote:
> 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?
Yes, you are right. This patch is obsolete, I reworked it:
[PATCH 1/2] mtd: spi-nor: make n_sectors in flash_info 32 bit wide
<20170116151214.11195-1-bst@pengutronix.de>
[PATCH 2/2] mtd: spi-nor: fix mr25h* definitions
<20170116151214.11195-2-bst@pengutronix.de>
Regards,
Bastian Stender
--
Pengutronix e.K.
Industrial Linux Solutions
http://www.pengutronix.de/
Peiner Str. 6-8, 31137 Hildesheim, Germany
Amtsgericht Hildesheim, HRA 2686
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-16 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-06 16:26 [PATCH] mtd: partitions: no unnecessary check for erase block Bastian Stender
2017-01-09 10:18 ` Boris Brezillon
2017-01-16 15:19 ` Bastian Stender
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox