From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-bw0-f212.google.com ([209.85.218.212]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N3krf-000763-OD for linux-mtd@lists.infradead.org; Fri, 30 Oct 2009 06:21:40 +0000 Received: by mail-bw0-f212.google.com with SMTP id 4so3543519bwz.2 for ; Thu, 29 Oct 2009 23:21:35 -0700 (PDT) MIME-Version: 1.0 From: Vimal Singh Date: Fri, 30 Oct 2009 11:51:15 +0530 Message-ID: Subject: [PATCH 2/3]NAND: OMAP: Fixing omap nand driver, compiled as module To: Linux MTD Content-Type: text/plain; charset=ISO-8859-1 List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vimal Singh Date: Fri, 30 Oct 2009 11:32:17 +0530 Subject: [PATCH] NAND: OMAP: Fixing omap nand driver, compiled as module Removing OMAP NAND driver, when loaded as a module, gives error and does not get success. This fixes this and makes driver loadable and removable run time. Signed-off-by: Vimal Singh --- drivers/mtd/nand/omap2.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 92573d5..ecc4d32 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1056,7 +1056,8 @@ out_free_info: static int omap_nand_remove(struct platform_device *pdev) { struct mtd_info *mtd = platform_get_drvdata(pdev); - struct omap_nand_info *info = mtd->priv; + struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, + mtd); platform_set_drvdata(pdev, NULL); if (use_dma) @@ -1064,7 +1065,9 @@ static int omap_nand_remove(struct platform_device *pdev) /* Release NAND device, its internal structures and partitions */ nand_release(&info->mtd); + release_mem_region(info->phys_base, NAND_IO_SIZE); iounmap(info->nand_pref_fifo_add); + gpmc_cs_free(info->gpmc_cs); kfree(&info->mtd); return 0; } -- 1.5.5