Commit f8214b80 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy

mtd: onenand/samsung.c: use mtd_device_parse_register

Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

Axel Lin <axel.lin@gmail.com>: fixed build error.
Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 7d010d2e
...@@ -147,7 +147,6 @@ struct s3c_onenand { ...@@ -147,7 +147,6 @@ struct s3c_onenand {
struct resource *dma_res; struct resource *dma_res;
unsigned long phys_base; unsigned long phys_base;
struct completion complete; struct completion complete;
struct mtd_partition *parts;
}; };
#define CMD_MAP_00(dev, addr) (dev->cmd_map(MAP_00, ((addr) << 1))) #define CMD_MAP_00(dev, addr) (dev->cmd_map(MAP_00, ((addr) << 1)))
...@@ -1015,13 +1014,9 @@ static int s3c_onenand_probe(struct platform_device *pdev) ...@@ -1015,13 +1014,9 @@ static int s3c_onenand_probe(struct platform_device *pdev)
if (s3c_read_reg(MEM_CFG_OFFSET) & ONENAND_SYS_CFG1_SYNC_READ) if (s3c_read_reg(MEM_CFG_OFFSET) & ONENAND_SYS_CFG1_SYNC_READ)
dev_info(&onenand->pdev->dev, "OneNAND Sync. Burst Read enabled\n"); dev_info(&onenand->pdev->dev, "OneNAND Sync. Burst Read enabled\n");
err = parse_mtd_partitions(mtd, NULL, &onenand->parts, 0); err = mtd_device_parse_register(mtd, NULL, 0,
if (err > 0) pdata ? pdata->parts : NULL,
mtd_device_register(mtd, onenand->parts, err); pdata ? pdata->nr_parts : 0);
else if (err <= 0 && pdata && pdata->parts)
mtd_device_register(mtd, pdata->parts, pdata->nr_parts);
else
err = mtd_device_register(mtd, NULL, 0);
platform_set_drvdata(pdev, mtd); platform_set_drvdata(pdev, mtd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment