From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/2 v2] mtd: maps: Leave assigned complex mappings
Date: Tue, 20 Nov 2018 14:43:17 +0100 [thread overview]
Message-ID: <20181120144317.4661d57f@bbrezillon> (raw)
In-Reply-To: <20181112210729.23580-1-linus.walleij@linaro.org>
Hi Linus,
On Mon, 12 Nov 2018 22:07:28 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:
> 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 v1->v2:
> - Rebase on latest MTD development branch
> - Use a new approach as the code changed under me
> ---
> drivers/mtd/maps/map_funcs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/maps/map_funcs.c b/drivers/mtd/maps/map_funcs.c
> index 3f268370eeca..60e132293e1c 100644
> --- a/drivers/mtd/maps/map_funcs.c
> +++ b/drivers/mtd/maps/map_funcs.c
> @@ -31,6 +31,10 @@ static void __xipram simple_map_copy_to(struct map_info *map, unsigned long to,
>
> void simple_map_init(struct map_info *map)
> {
> + /* Complex map functions already assigned */
> + if (map->read)
> + return;
> +
> BUG_ON(!map_bankwidth_supported(map->bankwidth));
>
> map->read = simple_map_read;
Can we move that to the physmap driver?
--->8---
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
index e8c3b250d842..043c7de39757 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 (map->read)
+ simple_map_init(&info->maps[i]);
+
if (info->probe_type) {
info->mtds[i] = do_map_probe(info->probe_type,
&info->maps[i]);
prev parent reply other threads:[~2018-11-20 13:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 21:07 [PATCH 1/2 v2] mtd: maps: Leave assigned complex mappings Linus Walleij
2018-11-12 21:07 ` [PATCH 2/2 v2] mtd: physmap_of_gemini: Handle pin control Linus Walleij
2018-11-20 14:36 ` Boris Brezillon
2018-11-22 14:10 ` Linus Walleij
2018-11-30 11:17 ` Boris Brezillon
2018-11-30 15:14 ` Linus Walleij
2018-11-20 13:43 ` Boris Brezillon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181120144317.4661d57f@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linus.walleij@linaro.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox