All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v3] mtd: maps: Leave assigned complex mappings
@ 2018-11-27 20:53 Linus Walleij
  2018-11-27 20:53 ` [PATCH 2/2 v3] mtd: physmap_of_gemini: Handle pin control Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Linus Walleij @ 2018-11-27 20:53 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, linux-mtd
  Cc: Linus Walleij

The simple_map_init() may need to be called with some
function pointers already assigned for complex mappings,
just bail out if complex handlers have already been
assigned.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Move check for pre-initialized simple map into
  physmap-core.c
ChangeLog v1->v2:
- Rebase on latest MTD development branch
- Use a new approach as the code changed under me
---
 drivers/mtd/maps/physmap-core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
index e8c3b250d842..ecca7784de06 100644
--- a/drivers/mtd/maps/physmap-core.c
+++ b/drivers/mtd/maps/physmap-core.c
@@ -514,10 +514,16 @@ 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]);
 		}
 
+		/*
+		 * 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]);
+
 		if (info->probe_type) {
 			info->mtds[i] = do_map_probe(info->probe_type,
 						     &info->maps[i]);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-07  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 20:53 [PATCH 1/2 v3] mtd: maps: Leave assigned complex mappings Linus Walleij
2018-11-27 20:53 ` [PATCH 2/2 v3] mtd: physmap_of_gemini: Handle pin control Linus Walleij
2018-12-07  9:10   ` [2/2,v3] " Boris Brezillon
2018-12-02  8:47 ` [PATCH 1/2 v3] mtd: maps: Leave assigned complex mappings Boris Brezillon
2018-12-04 13:09   ` Linus Walleij
2018-12-07  9:10 ` [1/2,v3] " Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.