diff options
Diffstat (limited to 'drivers/mtd/maps/rbtx4939-flash.c')
-rw-r--r-- | drivers/mtd/maps/rbtx4939-flash.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 83ed64512c5e..761fb459d2c7 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -25,10 +25,8 @@ | |||
25 | struct rbtx4939_flash_info { | 25 | struct rbtx4939_flash_info { |
26 | struct mtd_info *mtd; | 26 | struct mtd_info *mtd; |
27 | struct map_info map; | 27 | struct map_info map; |
28 | #ifdef CONFIG_MTD_PARTITIONS | ||
29 | int nr_parts; | 28 | int nr_parts; |
30 | struct mtd_partition *parts; | 29 | struct mtd_partition *parts; |
31 | #endif | ||
32 | }; | 30 | }; |
33 | 31 | ||
34 | static int rbtx4939_flash_remove(struct platform_device *dev) | 32 | static int rbtx4939_flash_remove(struct platform_device *dev) |
@@ -41,28 +39,18 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
41 | platform_set_drvdata(dev, NULL); | 39 | platform_set_drvdata(dev, NULL); |
42 | 40 | ||
43 | if (info->mtd) { | 41 | if (info->mtd) { |
44 | #ifdef CONFIG_MTD_PARTITIONS | ||
45 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; | 42 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; |
46 | 43 | ||
47 | if (info->nr_parts) { | 44 | if (info->nr_parts) |
48 | del_mtd_partitions(info->mtd); | ||
49 | kfree(info->parts); | 45 | kfree(info->parts); |
50 | } else if (pdata->nr_parts) | 46 | mtd_device_unregister(info->mtd); |
51 | del_mtd_partitions(info->mtd); | ||
52 | else | ||
53 | del_mtd_device(info->mtd); | ||
54 | #else | ||
55 | del_mtd_device(info->mtd); | ||
56 | #endif | ||
57 | map_destroy(info->mtd); | 47 | map_destroy(info->mtd); |
58 | } | 48 | } |
59 | return 0; | 49 | return 0; |
60 | } | 50 | } |
61 | 51 | ||
62 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 52 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; |
63 | #ifdef CONFIG_MTD_PARTITIONS | ||
64 | static const char *part_probe_types[] = { "cmdlinepart", NULL }; | 53 | static const char *part_probe_types[] = { "cmdlinepart", NULL }; |
65 | #endif | ||
66 | 54 | ||
67 | static int rbtx4939_flash_probe(struct platform_device *dev) | 55 | static int rbtx4939_flash_probe(struct platform_device *dev) |
68 | { | 56 | { |
@@ -120,23 +108,21 @@ static int rbtx4939_flash_probe(struct platform_device *dev) | |||
120 | if (err) | 108 | if (err) |
121 | goto err_out; | 109 | goto err_out; |
122 | 110 | ||
123 | #ifdef CONFIG_MTD_PARTITIONS | ||
124 | err = parse_mtd_partitions(info->mtd, part_probe_types, | 111 | err = parse_mtd_partitions(info->mtd, part_probe_types, |
125 | &info->parts, 0); | 112 | &info->parts, 0); |
126 | if (err > 0) { | 113 | if (err > 0) { |
127 | add_mtd_partitions(info->mtd, info->parts, err); | 114 | mtd_device_register(info->mtd, info->parts, err); |
128 | info->nr_parts = err; | 115 | info->nr_parts = err; |
129 | return 0; | 116 | return 0; |
130 | } | 117 | } |
131 | 118 | ||
132 | if (pdata->nr_parts) { | 119 | if (pdata->nr_parts) { |
133 | pr_notice("Using rbtx4939 partition information\n"); | 120 | pr_notice("Using rbtx4939 partition information\n"); |
134 | add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts); | 121 | mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); |
135 | return 0; | 122 | return 0; |
136 | } | 123 | } |
137 | #endif | ||
138 | 124 | ||
139 | add_mtd_device(info->mtd); | 125 | mtd_device_register(info->mtd, NULL, 0); |
140 | return 0; | 126 | return 0; |
141 | 127 | ||
142 | err_out: | 128 | err_out: |