[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqLV1mDpW9tD0XjWRxZSSsYuDiqHbuADQmBUtACgYiHJ+w@mail.gmail.com>
Date: Sun, 6 Dec 2015 20:45:40 -0600
From: Rob Herring <robh+dt@...nel.org>
To: Brian Norris <computersforpeace@...il.com>
Cc: "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
Linus Walleij <linus.walleij@...aro.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Simon Arlott <simon@...e.lp0.eu>,
Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
Jonas Gorski <jogo@...nwrt.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"devicetree-spec@...r.kernel.org" <devicetree-spec@...r.kernel.org>,
Rafał Miłecki <zajec5@...il.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC PATCH 4/7] mtd: add of_match_mtd_parser() and
of_mtd_match_mtd_parser() helpers
On Fri, Dec 4, 2015 at 11:19 PM, Brian Norris
<computersforpeace@...il.com> wrote:
> Like the corresponding OF-based device/driver matching infrascture,
typo.
> let's begin to support a mtd/partition-parser matching infrastructure.
>
> Signed-off-by: Brian Norris <computersforpeace@...il.com>
> ---
> drivers/of/of_mtd.c | 33 +++++++++++++++++++++++++++++++++
BTW, this file should be moved to drivers/mtd/ at some point.
> include/linux/mtd/partitions.h | 2 ++
> include/linux/of_mtd.h | 13 +++++++++++++
> 3 files changed, 48 insertions(+)
>
> diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c
> index b7361ed70537..169d7500af5d 100644
> --- a/drivers/of/of_mtd.c
> +++ b/drivers/of/of_mtd.c
> @@ -9,6 +9,7 @@
> #include <linux/kernel.h>
> #include <linux/of_mtd.h>
> #include <linux/mtd/nand.h>
> +#include <linux/mtd/partitions.h>
> #include <linux/export.h>
>
> /**
> @@ -117,3 +118,35 @@ bool of_get_nand_on_flash_bbt(struct device_node *np)
> return of_property_read_bool(np, "nand-on-flash-bbt");
> }
> EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt);
> +
> +static const struct of_device_id *of_match_mtd_parser(
This function name and the only caller's function name are very
similar. Why not just move this function inline.
> + struct mtd_part_parser *parser, struct device_node *np)
> +{
> + if (!parser || !np)
> + return NULL;
> +
> + return of_match_node(parser->of_match_table, np);
> +}
> +
> +static struct device_node *mtd_get_partitions_of_node(struct mtd_info *master)
> +{
> + struct device_node *np = mtd_get_of_node(master);
> +
> + if (!np)
> + return NULL;
> +
> + return of_get_child_by_name(np, "partitions");
> +}
> +
> +bool of_mtd_match_mtd_parser(struct mtd_info *mtd,
> + struct mtd_part_parser *parser)
> +{
> + struct device_node *np = mtd_get_partitions_of_node(mtd);
> + bool ret;
> +
> + ret = of_match_mtd_parser(parser, np) != NULL;
> + of_node_put(np);
> +
> + return ret;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists