linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd_dataflash: unbreak erase support
@ 2009-05-13 12:12 Peter Korsgaard
  2009-05-13 12:16 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Korsgaard @ 2009-05-13 12:12 UTC (permalink / raw)
  To: Artem.Bityutskiy, David.Woodhouse, linux-mtd; +Cc: stable

Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately
introduced a typo. Erase addr and len were swapped in the pageaddr
calculation, causing the wrong sectors to get erased.

Please consider for 2.6.29-stable as well.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 drivers/mtd/devices/mtd_dataflash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 62dee54..43976aa 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
 		/* Calculate flash page address; use block erase (for speed) if
 		 * we're at a block boundary and need to erase the whole block.
 		 */
-		pageaddr = div_u64(instr->len, priv->page_size);
+		pageaddr = div_u64(instr->addr, priv->page_size);
 		do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
 		pageaddr = pageaddr << priv->page_offset;
 
-- 
1.6.2

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

* Re: [PATCH] mtd_dataflash: unbreak erase support
  2009-05-13 12:12 [PATCH] mtd_dataflash: unbreak erase support Peter Korsgaard
@ 2009-05-13 12:16 ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2009-05-13 12:16 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: linux-mtd@lists.infradead.org, David.Woodhouse@intel.com,
	stable@kernel.org

ext Peter Korsgaard wrote:
> Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately
> introduced a typo. Erase addr and len were swapped in the pageaddr
> calculation, causing the wrong sectors to get erased.
> 
> Please consider for 2.6.29-stable as well.
> 
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
> ---
>  drivers/mtd/devices/mtd_dataflash.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> index 62dee54..43976aa 100644
> --- a/drivers/mtd/devices/mtd_dataflash.c
> +++ b/drivers/mtd/devices/mtd_dataflash.c
> @@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
>  		/* Calculate flash page address; use block erase (for speed) if
>  		 * we're at a block boundary and need to erase the whole block.
>  		 */
> -		pageaddr = div_u64(instr->len, priv->page_size);
> +		pageaddr = div_u64(instr->addr, priv->page_size);
>  		do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
>  		pageaddr = pageaddr << priv->page_offset;

Oh, sorry for that.

Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

* [PATCH] mtd_dataflash: unbreak erase support
@ 2009-05-18 10:07 Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2009-05-18 10:07 UTC (permalink / raw)
  To: David.Woodhouse, Artem.Bityutskiy, linux-mtd; +Cc: stable

Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately
introduced a typo. Erase addr and len were swapped in the pageaddr
calculation, causing the wrong sectors to get erased.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 Resend with Artem's acked-by
 David, clear regression from 2.6.28, please send to Linus for 2.6.30
 Please consider for 2.6.29-stable as well.

 drivers/mtd/devices/mtd_dataflash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 62dee54..43976aa 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
 		/* Calculate flash page address; use block erase (for speed) if
 		 * we're at a block boundary and need to erase the whole block.
 		 */
-		pageaddr = div_u64(instr->len, priv->page_size);
+		pageaddr = div_u64(instr->addr, priv->page_size);
 		do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
 		pageaddr = pageaddr << priv->page_offset;
 
-- 
1.6.2

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

* [PATCH] mtd_dataflash: unbreak erase support
@ 2009-05-18 10:13 David Woodhouse
  0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2009-05-18 10:13 UTC (permalink / raw)
  To: torvalds
  Cc: Artem.Bityutskiy@nokia.com, linux-mtd@lists.infradead.org,
	stable@kernel.org, Woodhouse, David

From: Peter Korsgaard <jacmet@sunsite.dk>

Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately
introduced a typo. Erase addr and len were swapped in the pageaddr
calculation, causing the wrong sectors to get erased.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 Resend with Artem's acked-by
 David, clear regression from 2.6.28, please send to Linus for 2.6.30
 Please consider for 2.6.29-stable as well.

 drivers/mtd/devices/mtd_dataflash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 62dee54..43976aa 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
 		/* Calculate flash page address; use block erase (for speed) if
 		 * we're at a block boundary and need to erase the whole block.
 		 */
-		pageaddr = div_u64(instr->len, priv->page_size);
+		pageaddr = div_u64(instr->addr, priv->page_size);
 		do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
 		pageaddr = pageaddr << priv->page_offset;
 
-- 
1.6.2

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

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

end of thread, other threads:[~2009-05-18 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 12:12 [PATCH] mtd_dataflash: unbreak erase support Peter Korsgaard
2009-05-13 12:16 ` Artem Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2009-05-18 10:07 Peter Korsgaard
2009-05-18 10:13 David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).