X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fnand%2Ftx4925ndfmc.c;h=5f6a2f5ed1384bbe2691954d3168633ebe667086;hb=9e1bf581d67d87a1d7fc0ea500729e3a03643a26;hp=bba688830c9b0c4032772aacdff61473e9e29346;hpb=8d40237c730b8be87c1b80a5d96b9c603fefa829;p=linux-2.6.git diff --git a/drivers/mtd/nand/tx4925ndfmc.c b/drivers/mtd/nand/tx4925ndfmc.c index bba688830..5f6a2f5ed 100644 --- a/drivers/mtd/nand/tx4925ndfmc.c +++ b/drivers/mtd/nand/tx4925ndfmc.c @@ -11,7 +11,7 @@ * Derived from drivers/mtd/autcpu12.c * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) * - * $Id: tx4925ndfmc.c,v 1.5 2004/10/05 13:50:20 gleixner Exp $ + * $Id: tx4925ndfmc.c,v 1.3 2004/07/20 02:44:26 dwmw2 Exp $ * * Copyright (C) 2001 Toshiba Corporation * @@ -340,8 +340,8 @@ int __init tx4925ndfmc_init (void) tx4925ndfmc_mtd->priv = this; /* Set address of NAND IO lines */ - this->IO_ADDR_R = (void __iomem *)&(tx4925_ndfmcptr->dtr); - this->IO_ADDR_W = (void __iomem *)&(tx4925_ndfmcptr->dtr); + this->IO_ADDR_R = (unsigned long)&(tx4925_ndfmcptr->dtr); + this->IO_ADDR_W = (unsigned long)&(tx4925_ndfmcptr->dtr); this->hwcontrol = tx4925ndfmc_hwcontrol; this->enable_hwecc = tx4925ndfmc_enable_hwecc; this->calculate_ecc = tx4925ndfmc_readecc; @@ -363,6 +363,14 @@ int __init tx4925ndfmc_init (void) goto out_ior; } + /* Allocate memory for internal data buffer */ + this->data_buf = kmalloc (sizeof(u_char) * (tx4925ndfmc_mtd->oobblock + tx4925ndfmc_mtd->oobsize), GFP_KERNEL); + if (!this->data_buf) { + printk ("Unable to allocate NAND data buffer for RBTX4925.\n"); + err = -ENOMEM; + goto out_ior; + } + /* Register the partitions */ #ifdef CONFIG_MTD_CMDLINE_PARTS { @@ -383,12 +391,14 @@ int __init tx4925ndfmc_init (void) default: { printk ("Unsupported SmartMedia device\n"); err = -ENXIO; - goto out_ior; + goto out_buf; } } #endif /* ifdef CONFIG_MTD_CMDLINE_PARTS */ goto out; +out_buf: + kfree (this->data_buf); out_ior: out: return err; @@ -402,8 +412,16 @@ module_init(tx4925ndfmc_init); #ifdef MODULE static void __exit tx4925ndfmc_cleanup (void) { - /* Release resources, unregister device */ - nand_release (tx4925ndfmc_mtd); + struct nand_chip *this = (struct nand_chip *) &tx4925ndfmc_mtd[1]; + + /* Unregister partitions */ + del_mtd_partitions(tx4925ndfmc_mtd); + + /* Unregister the device */ + del_mtd_device (tx4925ndfmc_mtd); + + /* Free internal data buffers */ + kfree (this->data_buf); /* Free the MTD device structure */ kfree (tx4925ndfmc_mtd);