Permalink
Browse files

MTD: NAND: jz4740: Fix remove function.

Used banks do not have to be consecutive, so if a bank is empty skip it instead of stopping the unmapping.
Free the NAND busy sense GPIO.
  • Loading branch information...
1 parent fea3607 commit 9c5557e38c87b7a902a4a1532a59cd7ce029510e @mthuurne committed Jul 30, 2010
Showing with 6 additions and 5 deletions.
  1. +6 −5 drivers/mtd/nand/jz4740_nand.c
@@ -565,18 +565,19 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
static int __devexit jz_nand_remove(struct platform_device *pdev)
{
struct jz_nand *nand = platform_get_drvdata(pdev);
+ struct jz_nand_platform_data *pdata = pdev->dev.platform_data;
int i;
nand_release(&nand->mtd);
/* Deassert and disable all chips */
writel(0, nand->base + JZ_REG_NAND_CTRL);
- i = 0;
- do {
- jz_nand_iounmap_resource(nand->bank_mem[i], nand->bank_base[i]);
- ++i;
- } while (nand->bank_base[i] != 0 && i < 4);
+ for (i = 0; i < 4; ++i)
+ if (nand->bank_base[i] != 0)
+ jz_nand_iounmap_resource(nand->bank_mem[i],
+ nand->bank_base[i]);
+ gpio_free(pdata->busy_gpio);
jz_nand_iounmap_resource(nand->mem, nand->base);

0 comments on commit 9c5557e

Please sign in to comment.