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

mtd: mtd_dataflash.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.
Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent f8214b80
...@@ -637,8 +637,6 @@ add_dataflash_otp(struct spi_device *spi, char *name, ...@@ -637,8 +637,6 @@ add_dataflash_otp(struct spi_device *spi, char *name,
struct flash_platform_data *pdata = spi->dev.platform_data; struct flash_platform_data *pdata = spi->dev.platform_data;
char *otp_tag = ""; char *otp_tag = "";
int err = 0; int err = 0;
struct mtd_partition *parts;
int nr_parts = 0;
priv = kzalloc(sizeof *priv, GFP_KERNEL); priv = kzalloc(sizeof *priv, GFP_KERNEL);
if (!priv) if (!priv)
...@@ -677,23 +675,10 @@ add_dataflash_otp(struct spi_device *spi, char *name, ...@@ -677,23 +675,10 @@ add_dataflash_otp(struct spi_device *spi, char *name,
pagesize, otp_tag); pagesize, otp_tag);
dev_set_drvdata(&spi->dev, priv); dev_set_drvdata(&spi->dev, priv);
nr_parts = parse_mtd_partitions(device, NULL, &parts, 0); err = mtd_device_parse_register(device, NULL, 0,
pdata ? pdata->parts : NULL,
pdata ? pdata->nr_parts : 0);
if (nr_parts <= 0 && pdata && pdata->parts) {
parts = pdata->parts;
nr_parts = pdata->nr_parts;
}
if (nr_parts > 0) {
priv->partitioned = 1;
err = mtd_device_register(device, parts, nr_parts);
goto out;
}
if (mtd_device_register(device, NULL, 0) == 1)
err = -ENODEV;
out:
if (!err) if (!err)
return 0; return 0;
......
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