diff options
Diffstat (limited to 'drivers/mtd/devices/sst25l.c')
-rw-r--r-- | drivers/mtd/devices/sst25l.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c index 83e80c65d6e..d38ef3bffe8 100644 --- a/drivers/mtd/devices/sst25l.c +++ b/drivers/mtd/devices/sst25l.c | |||
@@ -52,8 +52,6 @@ struct sst25l_flash { | |||
52 | struct spi_device *spi; | 52 | struct spi_device *spi; |
53 | struct mutex lock; | 53 | struct mutex lock; |
54 | struct mtd_info mtd; | 54 | struct mtd_info mtd; |
55 | |||
56 | int partitioned; | ||
57 | }; | 55 | }; |
58 | 56 | ||
59 | struct flash_info { | 57 | struct flash_info { |
@@ -381,8 +379,6 @@ static int __devinit sst25l_probe(struct spi_device *spi) | |||
381 | struct sst25l_flash *flash; | 379 | struct sst25l_flash *flash; |
382 | struct flash_platform_data *data; | 380 | struct flash_platform_data *data; |
383 | int ret, i; | 381 | int ret, i; |
384 | struct mtd_partition *parts = NULL; | ||
385 | int nr_parts = 0; | ||
386 | 382 | ||
387 | flash_info = sst25l_match_device(spi); | 383 | flash_info = sst25l_match_device(spi); |
388 | if (!flash_info) | 384 | if (!flash_info) |
@@ -414,8 +410,7 @@ static int __devinit sst25l_probe(struct spi_device *spi) | |||
414 | dev_info(&spi->dev, "%s (%lld KiB)\n", flash_info->name, | 410 | dev_info(&spi->dev, "%s (%lld KiB)\n", flash_info->name, |
415 | (long long)flash->mtd.size >> 10); | 411 | (long long)flash->mtd.size >> 10); |
416 | 412 | ||
417 | DEBUG(MTD_DEBUG_LEVEL2, | 413 | pr_debug("mtd .name = %s, .size = 0x%llx (%lldMiB) " |
418 | "mtd .name = %s, .size = 0x%llx (%lldMiB) " | ||
419 | ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", | 414 | ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", |
420 | flash->mtd.name, | 415 | flash->mtd.name, |
421 | (long long)flash->mtd.size, (long long)(flash->mtd.size >> 20), | 416 | (long long)flash->mtd.size, (long long)(flash->mtd.size >> 20), |
@@ -423,37 +418,10 @@ static int __devinit sst25l_probe(struct spi_device *spi) | |||
423 | flash->mtd.numeraseregions); | 418 | flash->mtd.numeraseregions); |
424 | 419 | ||
425 | 420 | ||
426 | if (mtd_has_cmdlinepart()) { | 421 | ret = mtd_device_parse_register(&flash->mtd, NULL, 0, |
427 | static const char *part_probes[] = {"cmdlinepart", NULL}; | 422 | data ? data->parts : NULL, |
428 | 423 | data ? data->nr_parts : 0); | |
429 | nr_parts = parse_mtd_partitions(&flash->mtd, | 424 | if (ret) { |
430 | part_probes, | ||
431 | &parts, 0); | ||
432 | } | ||
433 | |||
434 | if (nr_parts <= 0 && data && data->parts) { | ||
435 | parts = data->parts; | ||
436 | nr_parts = data->nr_parts; | ||
437 | } | ||
438 | |||
439 | if (nr_parts > 0) { | ||
440 | for (i = 0; i < nr_parts; i++) { | ||
441 | DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = " | ||
442 | "{.name = %s, .offset = 0x%llx, " | ||
443 | ".size = 0x%llx (%lldKiB) }\n", | ||
444 | i, parts[i].name, | ||
445 | (long long)parts[i].offset, | ||
446 | (long long)parts[i].size, | ||
447 | (long long)(parts[i].size >> 10)); | ||
448 | } | ||
449 | |||
450 | flash->partitioned = 1; | ||
451 | return mtd_device_register(&flash->mtd, parts, | ||
452 | nr_parts); | ||
453 | } | ||
454 | |||
455 | ret = mtd_device_register(&flash->mtd, NULL, 0); | ||
456 | if (ret == 1) { | ||
457 | kfree(flash); | 425 | kfree(flash); |
458 | dev_set_drvdata(&spi->dev, NULL); | 426 | dev_set_drvdata(&spi->dev, NULL); |
459 | return -ENODEV; | 427 | return -ENODEV; |