]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
MTD: handle pci_name() being const
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 2 Jul 2008 19:46:22 +0000 (12:46 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Jul 2008 04:55:03 +0000 (21:55 -0700)
This changes the MTD core to handle pci_name() now returning a constant
string.

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/mtd/devices/block2mtd.c
include/linux/mtd/map.h
include/linux/mtd/mtd.h

index 519d942e7940c6167672c2d53829530e3e7d9fcc..7b72a1b36115f4b1bf4c581c6d67c1e6f6454566 100644 (file)
@@ -241,6 +241,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
 {
        struct block_device *bdev;
        struct block2mtd_dev *dev;
+       char *name;
 
        if (!devname)
                return NULL;
@@ -279,12 +280,13 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
 
        /* Setup the MTD structure */
        /* make the name contain the block device in */
-       dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname),
+       name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1,
                        GFP_KERNEL);
-       if (!dev->mtd.name)
+       if (!name)
                goto devinit_err;
 
-       sprintf(dev->mtd.name, "block2mtd: %s", devname);
+       sprintf(name, "block2mtd: %s", devname);
+       dev->mtd.name = name;
 
        dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
        dev->mtd.erasesize = erase_size;
index a9fae032ba8176db0a256aea1160f3c04e78720e..9c1d95491f8b0a7d208257b39f6fd794d713be84 100644 (file)
@@ -189,7 +189,7 @@ typedef union {
 */
 
 struct map_info {
-       char *name;
+       const char *name;
        unsigned long size;
        resource_size_t phys;
 #define NO_XIP (-1UL)
index 245f9098e171cfe2bf5b27860f6be2e0365fa57f..8b5d49133ec616a80fdc7f375b95e9cc244e16cc 100644 (file)
@@ -121,7 +121,7 @@ struct mtd_info {
        u_int32_t oobavail;  // Available OOB bytes per block
 
        // Kernel-only stuff starts here.
-       char *name;
+       const char *name;
        int index;
 
        /* ecc layout structure pointer - read only ! */