diff options
| author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-05-29 17:02:26 -0400 |
|---|---|---|
| committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:11 -0400 |
| commit | 2cd9ea5256ecf2bc795d476598ac7f43f4b83a97 (patch) | |
| tree | b492b7ceacda2fb9e2f3f9bc92cf616fbb3aabb0 | |
| parent | 9d7948c50055e74b693ce9e99a709b2e5bbc1942 (diff) | |
mtd: socrates_nand: use ofpart through generic parsing
Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
| -rw-r--r-- | drivers/mtd/nand/socrates_nand.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index 9023ac833fc..f4f79ecb5ba 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c | |||
| @@ -166,6 +166,7 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) | |||
| 166 | int res; | 166 | int res; |
| 167 | struct mtd_partition *partitions = NULL; | 167 | struct mtd_partition *partitions = NULL; |
| 168 | int num_partitions = 0; | 168 | int num_partitions = 0; |
| 169 | struct mtd_part_parser_data ppdata; | ||
| 169 | 170 | ||
| 170 | /* Allocate memory for the device structure (and zero it) */ | 171 | /* Allocate memory for the device structure (and zero it) */ |
| 171 | host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); | 172 | host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); |
| @@ -191,6 +192,7 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) | |||
| 191 | mtd->name = "socrates_nand"; | 192 | mtd->name = "socrates_nand"; |
| 192 | mtd->owner = THIS_MODULE; | 193 | mtd->owner = THIS_MODULE; |
| 193 | mtd->dev.parent = &ofdev->dev; | 194 | mtd->dev.parent = &ofdev->dev; |
| 195 | ppdata.of_node = ofdev->dev.of_node; | ||
| 194 | 196 | ||
| 195 | /*should never be accessed directly */ | 197 | /*should never be accessed directly */ |
| 196 | nand_chip->IO_ADDR_R = (void *)0xdeadbeef; | 198 | nand_chip->IO_ADDR_R = (void *)0xdeadbeef; |
| @@ -223,22 +225,12 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) | |||
| 223 | goto out; | 225 | goto out; |
| 224 | } | 226 | } |
| 225 | 227 | ||
| 226 | num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, 0); | 228 | num_partitions = parse_mtd_partitions(mtd, NULL, &partitions, &ppdata); |
| 227 | if (num_partitions < 0) { | 229 | if (num_partitions < 0) { |
| 228 | res = num_partitions; | 230 | res = num_partitions; |
| 229 | goto release; | 231 | goto release; |
| 230 | } | 232 | } |
| 231 | 233 | ||
| 232 | if (num_partitions == 0) { | ||
| 233 | num_partitions = of_mtd_parse_partitions(&ofdev->dev, | ||
| 234 | ofdev->dev.of_node, | ||
| 235 | &partitions); | ||
| 236 | if (num_partitions < 0) { | ||
| 237 | res = num_partitions; | ||
| 238 | goto release; | ||
| 239 | } | ||
| 240 | } | ||
| 241 | |||
| 242 | res = mtd_device_register(mtd, partitions, num_partitions); | 234 | res = mtd_device_register(mtd, partitions, num_partitions); |
| 243 | if (!res) | 235 | if (!res) |
| 244 | return res; | 236 | return res; |
