Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252542
b: refs/heads/master
c: 0987711
h: refs/heads/master
v: v3
  • Loading branch information
Jamie Iles authored and David Woodhouse committed May 25, 2011
1 parent 65b6961 commit 697d331
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a17f7ca510035beee7527f352b3a46fe5dcabce1
refs/heads/master: 098771158813fb391dd6c1c8b907599db91fb0c7
51 changes: 21 additions & 30 deletions trunk/drivers/mtd/nand/davinci_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
int ret;
uint32_t val;
nand_ecc_modes_t ecc_mode;
struct mtd_partition *mtd_parts = NULL;
int mtd_parts_nb = 0;

/* insist on board-specific configuration */
if (!pdata)
Expand Down Expand Up @@ -749,41 +751,33 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
if (ret < 0)
goto err_scan;

if (mtd_has_partitions()) {
struct mtd_partition *mtd_parts = NULL;
int mtd_parts_nb = 0;
if (mtd_has_cmdlinepart()) {
static const char *probes[] __initconst = {
"cmdlinepart", NULL
};

if (mtd_has_cmdlinepart()) {
static const char *probes[] __initconst =
{ "cmdlinepart", NULL };

mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
&mtd_parts, 0);
}

if (mtd_parts_nb <= 0) {
mtd_parts = pdata->parts;
mtd_parts_nb = pdata->nr_parts;
}
mtd_parts_nb = parse_mtd_partitions(&info->mtd, probes,
&mtd_parts, 0);
}

/* Register any partitions */
if (mtd_parts_nb > 0) {
ret = add_mtd_partitions(&info->mtd,
mtd_parts, mtd_parts_nb);
if (ret == 0)
info->partitioned = true;
}
if (mtd_parts_nb <= 0) {
mtd_parts = pdata->parts;
mtd_parts_nb = pdata->nr_parts;
}

} else if (pdata->nr_parts) {
dev_warn(&pdev->dev, "ignoring %d default partitions on %s\n",
pdata->nr_parts, info->mtd.name);
/* Register any partitions */
if (mtd_parts_nb > 0) {
ret = mtd_device_register(&info->mtd, mtd_parts,
mtd_parts_nb);
if (ret == 0)
info->partitioned = true;
}

/* If there's no partition info, just package the whole chip
* as a single MTD device.
*/
if (!info->partitioned)
ret = add_mtd_device(&info->mtd) ? -ENODEV : 0;
ret = mtd_device_register(&info->mtd, NULL, 0) ? -ENODEV : 0;

if (ret < 0)
goto err_scan;
Expand Down Expand Up @@ -824,10 +818,7 @@ static int __exit nand_davinci_remove(struct platform_device *pdev)
struct davinci_nand_info *info = platform_get_drvdata(pdev);
int status;

if (mtd_has_partitions() && info->partitioned)
status = del_mtd_partitions(&info->mtd);
else
status = del_mtd_device(&info->mtd);
status = mtd_device_unregister(&info->mtd);

spin_lock_irq(&davinci_nand_lock);
if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
Expand Down

0 comments on commit 697d331

Please sign in to comment.