diff options
| author | David Woodhouse <David.Woodhouse@intel.com> | 2009-06-24 10:35:15 -0400 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-06-24 11:02:06 -0400 |
| commit | 17659c60629618c0aa67eb3cb6a77d2c52486d2e (patch) | |
| tree | c0bd2515acfb4c609e00f92291d5e71c2587f1b7 | |
| parent | 4839641333d4593bfc4fb29aa3af10d36f607d5b (diff) | |
mtd: maps: Remove BUS_ID_SIZE from integrator_flash
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
| -rw-r--r-- | drivers/mtd/maps/integrator-flash.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index b08a798ee25..2aac41bde8b 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c | |||
| @@ -42,10 +42,8 @@ | |||
| 42 | #include <mach/hardware.h> | 42 | #include <mach/hardware.h> |
| 43 | #include <asm/system.h> | 43 | #include <asm/system.h> |
| 44 | 44 | ||
| 45 | #define SUBDEV_NAME_SIZE (BUS_ID_SIZE + 2) | ||
| 46 | |||
| 47 | struct armflash_subdev_info { | 45 | struct armflash_subdev_info { |
| 48 | char name[SUBDEV_NAME_SIZE]; | 46 | char *name; |
| 49 | struct mtd_info *mtd; | 47 | struct mtd_info *mtd; |
| 50 | struct map_info map; | 48 | struct map_info map; |
| 51 | struct flash_platform_data *plat; | 49 | struct flash_platform_data *plat; |
| @@ -134,6 +132,8 @@ static void armflash_subdev_remove(struct armflash_subdev_info *subdev) | |||
| 134 | map_destroy(subdev->mtd); | 132 | map_destroy(subdev->mtd); |
| 135 | if (subdev->map.virt) | 133 | if (subdev->map.virt) |
| 136 | iounmap(subdev->map.virt); | 134 | iounmap(subdev->map.virt); |
| 135 | kfree(subdev->name); | ||
| 136 | subdev->name = NULL; | ||
| 137 | release_mem_region(subdev->map.phys, subdev->map.size); | 137 | release_mem_region(subdev->map.phys, subdev->map.size); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| @@ -177,16 +177,22 @@ static int armflash_probe(struct platform_device *dev) | |||
| 177 | 177 | ||
| 178 | if (nr == 1) | 178 | if (nr == 1) |
| 179 | /* No MTD concatenation, just use the default name */ | 179 | /* No MTD concatenation, just use the default name */ |
| 180 | snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s", | 180 | subdev->name = kstrdup(dev_name(&dev->dev), GFP_KERNEL); |
| 181 | dev_name(&dev->dev)); | ||
| 182 | else | 181 | else |
| 183 | snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s-%d", | 182 | subdev->name = kasprintf(GFP_KERNEL, "%s-%d", |
| 184 | dev_name(&dev->dev), i); | 183 | dev_name(&dev->dev), i); |
| 184 | if (!subdev->name) { | ||
| 185 | err = -ENOMEM; | ||
| 186 | break; | ||
| 187 | } | ||
| 185 | subdev->plat = plat; | 188 | subdev->plat = plat; |
| 186 | 189 | ||
| 187 | err = armflash_subdev_probe(subdev, res); | 190 | err = armflash_subdev_probe(subdev, res); |
| 188 | if (err) | 191 | if (err) { |
| 192 | kfree(subdev->name); | ||
| 193 | subdev->name = NULL; | ||
| 189 | break; | 194 | break; |
| 195 | } | ||
| 190 | } | 196 | } |
| 191 | info->nr_subdev = i; | 197 | info->nr_subdev = i; |
| 192 | 198 | ||
