Commit fdbf3bf6 authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: gpio-addr-flash: convert to mtd_device_register()

Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.
Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 5af3aa24
...@@ -464,7 +464,6 @@ config MTD_GPIO_ADDR ...@@ -464,7 +464,6 @@ config MTD_GPIO_ADDR
tristate "GPIO-assisted Flash Chip Support" tristate "GPIO-assisted Flash Chip Support"
depends on GENERIC_GPIO || GPIOLIB depends on GENERIC_GPIO || GPIOLIB
depends on MTD_COMPLEX_MAPPINGS depends on MTD_COMPLEX_MAPPINGS
select MTD_PARTITIONS
help help
Map driver which allows flashes to be partially physically addressed Map driver which allows flashes to be partially physically addressed
and assisted by GPIOs. and assisted by GPIOs.
......
...@@ -155,9 +155,7 @@ static void gf_copy_to(struct map_info *map, unsigned long to, const void *from, ...@@ -155,9 +155,7 @@ static void gf_copy_to(struct map_info *map, unsigned long to, const void *from,
memcpy_toio(map->virt + (to % state->win_size), from, len); memcpy_toio(map->virt + (to % state->win_size), from, len);
} }
#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
#endif
/** /**
* gpio_flash_probe() - setup a mapping for a GPIO assisted flash * gpio_flash_probe() - setup a mapping for a GPIO assisted flash
...@@ -189,7 +187,7 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; ...@@ -189,7 +187,7 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
*/ */
static int __devinit gpio_flash_probe(struct platform_device *pdev) static int __devinit gpio_flash_probe(struct platform_device *pdev)
{ {
int ret; int nr_parts;
size_t i, arr_size; size_t i, arr_size;
struct physmap_flash_data *pdata; struct physmap_flash_data *pdata;
struct resource *memory; struct resource *memory;
...@@ -254,24 +252,21 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev) ...@@ -254,24 +252,21 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
#ifdef CONFIG_MTD_PARTITIONS nr_parts = parse_mtd_partitions(state->mtd, part_probe_types,
ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); &pdata->parts, 0);
if (ret > 0) { if (nr_parts > 0) {
pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n"); pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n");
add_mtd_partitions(state->mtd, pdata->parts, ret);
kfree(pdata->parts); kfree(pdata->parts);
} else if (pdata->nr_parts) { } else if (pdata->nr_parts) {
pr_devinit(KERN_NOTICE PFX "Using board partition definition\n"); pr_devinit(KERN_NOTICE PFX "Using board partition definition\n");
add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts); nr_parts = pdata->nr_parts;
} else {
} else
#endif
{
pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n"); pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n");
add_mtd_device(state->mtd); nr_parts = 0;
} }
mtd_device_register(state->mtd, pdata->parts, nr_parts);
return 0; return 0;
} }
...@@ -282,9 +277,7 @@ static int __devexit gpio_flash_remove(struct platform_device *pdev) ...@@ -282,9 +277,7 @@ static int __devexit gpio_flash_remove(struct platform_device *pdev)
do { do {
gpio_free(state->gpio_addrs[i]); gpio_free(state->gpio_addrs[i]);
} while (++i < state->gpio_count); } while (++i < state->gpio_count);
#ifdef CONFIG_MTD_PARTITIONS mtd_device_unregister(state->mtd);
del_mtd_partitions(state->mtd);
#endif
map_destroy(state->mtd); map_destroy(state->mtd);
kfree(state); kfree(state);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment