Browse Source

[MTD] [NAND] pxa3xx_nand: allow building as module

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Mike Rapoport 16 years ago
parent
commit
82a72d108b
2 changed files with 11 additions and 1 deletions
  1. 1 1
      drivers/mtd/nand/Kconfig
  2. 10 0
      drivers/mtd/nand/pxa3xx_nand.c

+ 1 - 1
drivers/mtd/nand/Kconfig

@@ -334,7 +334,7 @@ config MTD_NAND_ATMEL_ECC_NONE
 endchoice
 endchoice
 
 
 config MTD_NAND_PXA3xx
 config MTD_NAND_PXA3xx
-	bool "Support for NAND flash devices on PXA3xx"
+	tristate "Support for NAND flash devices on PXA3xx"
 	depends on MTD_NAND && PXA3xx
 	depends on MTD_NAND && PXA3xx
 	help
 	help
 	  This enables the driver for the NAND flash device found on
 	  This enables the driver for the NAND flash device found on

+ 10 - 0
drivers/mtd/nand/pxa3xx_nand.c

@@ -1079,6 +1079,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
 
 
 	this = &info->nand_chip;
 	this = &info->nand_chip;
 	mtd->priv = info;
 	mtd->priv = info;
+	mtd->owner = THIS_MODULE;
 
 
 	info->clk = clk_get(&pdev->dev, NULL);
 	info->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(info->clk)) {
 	if (IS_ERR(info->clk)) {
@@ -1187,6 +1188,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
 {
 {
 	struct mtd_info *mtd = platform_get_drvdata(pdev);
 	struct mtd_info *mtd = platform_get_drvdata(pdev);
 	struct pxa3xx_nand_info *info = mtd->priv;
 	struct pxa3xx_nand_info *info = mtd->priv;
+	struct resource *r;
 
 
 	platform_set_drvdata(pdev, NULL);
 	platform_set_drvdata(pdev, NULL);
 
 
@@ -1199,6 +1201,14 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
 				info->data_buff, info->data_buff_phys);
 				info->data_buff, info->data_buff_phys);
 	} else
 	} else
 		kfree(info->data_buff);
 		kfree(info->data_buff);
+
+	iounmap(info->mmio_base);
+	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	release_mem_region(r->start, resource_size(r));
+
+	clk_disable(info->clk);
+	clk_put(info->clk);
+
 	kfree(mtd);
 	kfree(mtd);
 	return 0;
 	return 0;
 }
 }