Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 231703
b: refs/heads/master
c: 263a8c8
h: refs/heads/master
i:
  231701: fcf8fd8
  231699: 1f5abfc
  231695: 7e76724
v: v3
  • Loading branch information
Adrian Hunter authored and David Woodhouse committed Jan 6, 2011
1 parent bba62b7 commit 09b1a81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 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: b7b1a29d94c17e4341856381bccb4d17495bea60
refs/heads/master: 263a8c8635445c0ede3cb22c98a1a12da4672ebc
27 changes: 12 additions & 15 deletions trunk/drivers/mtd/onenand/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ struct omap2_onenand {
int (*setup)(void __iomem *base, int freq);
};

#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probes[] = { "cmdlinepart", NULL, };
#endif

static void omap2_onenand_dma_cb(int lch, u16 ch_status, void *data)
{
struct omap2_onenand *c = data;
Expand Down Expand Up @@ -730,13 +734,15 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
}

#ifdef CONFIG_MTD_PARTITIONS
if (pdata->parts != NULL)
r = add_mtd_partitions(&c->mtd, pdata->parts,
pdata->nr_parts);
r = parse_mtd_partitions(&c->mtd, part_probes, &c->parts, 0);
if (r > 0)
r = add_mtd_partitions(&c->mtd, c->parts, r);
else if (pdata->parts != NULL)
r = add_mtd_partitions(&c->mtd, pdata->parts, pdata->nr_parts);
else
#endif
r = add_mtd_device(&c->mtd);
if (r < 0)
if (r)
goto err_release_onenand;

platform_set_drvdata(pdev, c);
Expand All @@ -760,6 +766,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
err_free_cs:
gpmc_cs_free(c->gpmc_cs);
err_kfree:
kfree(c->parts);
kfree(c);

return r;
Expand All @@ -769,17 +776,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
{
struct omap2_onenand *c = dev_get_drvdata(&pdev->dev);

BUG_ON(c == NULL);

#ifdef CONFIG_MTD_PARTITIONS
if (c->parts)
del_mtd_partitions(&c->mtd);
else
del_mtd_device(&c->mtd);
#else
del_mtd_device(&c->mtd);
#endif

onenand_release(&c->mtd);
if (c->dma_channel != -1)
omap_free_dma(c->dma_channel);
Expand All @@ -792,6 +788,7 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
iounmap(c->onenand.base);
release_mem_region(c->phys_base, ONENAND_IO_SIZE);
gpmc_cs_free(c->gpmc_cs);
kfree(c->parts);
kfree(c);

return 0;
Expand Down

0 comments on commit 09b1a81

Please sign in to comment.