X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fnand%2Ftoto.c;h=ecb9f3dc8805ce8ba1308fe9aa689c7ede5cb284;hb=9e1bf581d67d87a1d7fc0ea500729e3a03643a26;hp=52c808fb5fa93165038f59a4c399136899134789;hpb=8d40237c730b8be87c1b80a5d96b9c603fefa829;p=linux-2.6.git diff --git a/drivers/mtd/nand/toto.c b/drivers/mtd/nand/toto.c index 52c808fb5..ecb9f3dc8 100644 --- a/drivers/mtd/nand/toto.c +++ b/drivers/mtd/nand/toto.c @@ -15,7 +15,7 @@ * This is a device driver for the NAND flash device found on the * TI fido board. It supports 32MiB and 64MiB cards * - * $Id: toto.c,v 1.4 2004/10/05 13:50:20 gleixner Exp $ + * $Id: toto.c,v 1.2 2003/10/21 10:04:58 dwmw2 Exp $ */ #include @@ -37,7 +37,7 @@ */ static struct mtd_info *toto_mtd = NULL; -static unsigned long toto_io_base = OMAP_FLASH_1_BASE; +static int toto_io_base = OMAP_FLASH_1_BASE; #define CONFIG_NAND_WORKAROUND 1 @@ -155,6 +155,14 @@ int __init toto_init (void) goto out_mtd; } + /* Allocate memory for internal data buffer */ + this->data_buf = kmalloc (sizeof(u_char) * (toto_mtd->oobblock + toto_mtd->oobsize), GFP_KERNEL); + if (!this->data_buf) { + printk (KERN_WARNING "Unable to allocate NAND data buffer for toto.\n"); + err = -ENOMEM; + goto out_mtd; + } + /* Register the partitions */ switch(toto_mtd->size){ case SZ_64M: add_mtd_partitions(toto_mtd, partition_info64M, NUM_PARTITIONS64M); break; @@ -186,8 +194,16 @@ module_init(toto_init); */ static void __exit toto_cleanup (void) { - /* Release resources, unregister device */ - nand_release (toto_mtd); + struct nand_chip *this = (struct nand_chip *) &toto_mtd[1]; + + /* Unregister partitions */ + del_mtd_partitions(toto_mtd); + + /* Unregister the device */ + del_mtd_device (toto_mtd); + + /* Free internal data buffers */ + kfree (this->data_buf); /* Free the MTD device structure */ kfree (toto_mtd);