diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2018-11-27 23:53:57 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-12-06 18:57:13 +0300 |
commit | b3dd93030c3cdd3f191aa170ccafc2b4d316f4cc (patch) | |
tree | 0ecdf1c3a734defbaa55d01aff9d76febf34c50f /drivers | |
parent | c78f59d7145e7f729c8df58fa7f99ecf66225ddc (diff) | |
download | linux-b3dd93030c3cdd3f191aa170ccafc2b4d316f4cc.tar.xz |
mtd: maps: physmap: Leave assigned complex mappings
SoC-specific drivers might provide their own map->xxx()
implementations, and calling simple_map_init() unconditionally will
override those implementations.
Make sure map->read is NULL before calling simple_map_init().
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/maps/physmap-core.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index e8c3b250d842..d9a3e4bebe5d 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -514,10 +514,20 @@ static int physmap_flash_probe(struct platform_device *dev) err = physmap_addr_gpios_map_init(&info->maps[i]); if (err) goto err_out; - } else { - simple_map_init(&info->maps[i]); } +#ifdef CONFIG_MTD_COMPLEX_MAPPINGS + /* + * Only use the simple_map implementation if map hooks are not + * implemented. Since map->read() is mandatory checking for its + * presence is enough. + */ + if (!info->maps[i].read) + simple_map_init(&info->maps[i]); +#else + simple_map_init(&info->maps[i]); +#endif + if (info->probe_type) { info->mtds[i] = do_map_probe(info->probe_type, &info->maps[i]); |