Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755230AbbLGCqI (ORCPT ); Sun, 6 Dec 2015 21:46:08 -0500 Received: from mail.kernel.org ([198.145.29.136]:50397 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755028AbbLGCqF (ORCPT ); Sun, 6 Dec 2015 21:46:05 -0500 MIME-Version: 1.0 In-Reply-To: <1449292763-129421-5-git-send-email-computersforpeace@gmail.com> References: <1449292763-129421-1-git-send-email-computersforpeace@gmail.com> <1449292763-129421-5-git-send-email-computersforpeace@gmail.com> From: Rob Herring Date: Sun, 6 Dec 2015 20:45:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 4/7] mtd: add of_match_mtd_parser() and of_mtd_match_mtd_parser() helpers To: Brian Norris Cc: "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Boris Brezillon , Linus Walleij , Geert Uytterhoeven , Simon Arlott , Jason Gunthorpe , Jonas Gorski , "devicetree@vger.kernel.org" , "devicetree-spec@vger.kernel.org" , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Hauke Mehrtens , Arnd Bergmann Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2340 Lines: 74 On Fri, Dec 4, 2015 at 11:19 PM, Brian Norris 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 > --- > 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 > #include > #include > +#include > #include > > /** > @@ -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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/