Merge git://git.infradead.org/mtd-2.6
[sfrench/cifs-2.6.git] / drivers / mtd / devices / mtd_dataflash.c
index a19480d07888dfd043872b2e5d715755851a17e8..a987e917f4e07e4c1bc534b574f66841d9c55cd3 100644 (file)
@@ -9,7 +9,6 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
 */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -460,7 +459,7 @@ add_dataflash(struct spi_device *spi, char *name,
        struct mtd_info                 *device;
        struct flash_platform_data      *pdata = spi->dev.platform_data;
 
-       priv = (struct dataflash *) kzalloc(sizeof *priv, GFP_KERNEL);
+       priv = kzalloc(sizeof *priv, GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
@@ -478,9 +477,10 @@ add_dataflash(struct spi_device *spi, char *name,
        device->name = (pdata && pdata->name) ? pdata->name : priv->name;
        device->size = nr_pages * pagesize;
        device->erasesize = pagesize;
+       device->writesize = pagesize;
        device->owner = THIS_MODULE;
        device->type = MTD_DATAFLASH;
-       device->flags = MTD_CAP_NORFLASH;
+       device->flags = MTD_WRITEABLE;
        device->erase = dataflash_erase;
        device->read = dataflash_read;
        device->write = dataflash_write;
@@ -536,7 +536,7 @@ static int __devinit dataflash_probe(struct spi_device *spi)
        if (status <= 0 || status == 0xff) {
                DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n",
                                spi->dev.bus_id, status);
-               if (status == 0xff)
+               if (status == 0 || status == 0xff)
                        status = -ENODEV;
                return status;
        }