public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Clean up of code found when adding support for > 2GiB MTD devices
@ 2008-08-19 21:27 Bruce Leonard
  2008-08-27  5:29 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Leonard @ 2008-08-19 21:27 UTC (permalink / raw)
  To: linux-mtd

These are just some code cleanups that I found while working on the MTD sub-system.

 From ab740d4e4b786a04a51b1de44e91f51919709e0a Mon Sep 17 00:00:00 2001
From: brucle <brucle@selinc.com>
Date: Wed, 13 Aug 2008 17:16:48 -0700
Subject: [PATCH] Code clean up preping for support of > 2GiB MTD devices

Signed-off-by: Bruce D. Leonard <brucle@selinc.com>

---
  drivers/mtd/nand/nand_base.c |    2 +-
  drivers/mtd/nand/nand_bbt.c  |    5 ++---
  2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d1129ba..d5ac675 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2042,7 +2042,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
  		return -EINVAL;
  	}

-	instr->fail_addr = 0xffffffff;
+	instr->fail_addr = (typeof(instr->fail_addr))(-1);

  	/* Grab the lock and see if the device is available */
  	nand_get_device(chip, mtd, FL_ERASING);
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 0b1c485..2f9f0f5 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -411,7 +411,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
  		numblocks = this->chipsize >> (this->bbt_erase_shift - 1);
  		startblock = chip * numblocks;
  		numblocks += startblock;
-		from = startblock << (this->bbt_erase_shift - 1);
+		from = (loff_t)startblock << (this->bbt_erase_shift - 1);
  	}

  	for (i = startblock; i < numblocks;) {
@@ -495,7 +495,7 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
  		for (block = 0; block < td->maxblocks; block++) {

  			int actblock = startblock + dir * block;
-			loff_t offs = actblock << this->bbt_erase_shift;
+			loff_t offs = (loff_t)actblock << this->bbt_erase_shift;

  			/* Read first page */
  			scan_read_raw(mtd, buf, offs, mtd->writesize);
@@ -1027,7 +1027,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
  	if (!this->bbt || !td)
  		return -EINVAL;

-	len = mtd->size >> (this->bbt_erase_shift + 2);
  	/* Allocate a temporary buffer for one eraseblock incl. oob */
  	len = (1 << this->bbt_erase_shift);
  	len += (len >> this->page_shift) * mtd->oobsize;
-- 
1.5.3.4

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

* Re: [PATCH 1/2] Clean up of code found when adding support for > 2GiB MTD devices
  2008-08-19 21:27 [PATCH 1/2] Clean up of code found when adding support for > 2GiB MTD devices Bruce Leonard
@ 2008-08-27  5:29 ` Artem Bityutskiy
  2008-08-27  7:39   ` Bruce Leonard
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2008-08-27  5:29 UTC (permalink / raw)
  To: Bruce Leonard; +Cc: linux-mtd, linux-kernel

Hi,

On Tue, 2008-08-19 at 14:27 -0700, Bruce Leonard wrote:
> These are just some code cleanups that I found while working on the MTD sub-system.
> From: brucle <brucle@selinc.com>
> Date: Wed, 13 Aug 2008 17:16:48 -0700
> Subject: [PATCH] Code clean up preping for support of > 2GiB MTD devices
> 
> Signed-off-by: Bruce D. Leonard <brucle@selinc.com>

For this clean-up patch,

Acked-by: Artem Bityutskiy <dedekind@infradead.org>

However, are you shure it is against the mtd-2.6.git tree?

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

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

* Re: [PATCH 1/2] Clean up of code found when adding support for > 2GiB MTD devices
  2008-08-27  5:29 ` Artem Bityutskiy
@ 2008-08-27  7:39   ` Bruce Leonard
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Leonard @ 2008-08-27  7:39 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd, linux-kernel

Artem,

On Aug 26, 2008, at 10:29 PM, Artem Bityutskiy wrote:

> Hi,
>
> On Tue, 2008-08-19 at 14:27 -0700, Bruce Leonard wrote:
>> These are just some code cleanups that I found while working on the  
>> MTD sub-system.
>> From: brucle <brucle@selinc.com>
>> Date: Wed, 13 Aug 2008 17:16:48 -0700
>> Subject: [PATCH] Code clean up preping for support of > 2GiB MTD  
>> devices
>>
>> Signed-off-by: Bruce D. Leonard <brucle@selinc.com>
>
> For this clean-up patch,
>
> Acked-by: Artem Bityutskiy <dedekind@infradead.org>
>
> However, are you shure it is against the mtd-2.6.git tree?

This patch set is against the mainline, 2.6.27-rc3.  At the time I  
posted the patch I was only a day or two out from pulling the latest  
from Linus' tree.  It's now a couple of weeks out of date I think.

Bruce

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

end of thread, other threads:[~2008-08-27  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 21:27 [PATCH 1/2] Clean up of code found when adding support for > 2GiB MTD devices Bruce Leonard
2008-08-27  5:29 ` Artem Bityutskiy
2008-08-27  7:39   ` Bruce Leonard

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