mtd: ofpart: add of_match_table with "fixed-partitions"
authorRafał Miłecki <rafal@milecki.pl>
Wed, 14 Mar 2018 12:10:44 +0000 (13:10 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 27 Mar 2018 07:11:31 +0000 (09:11 +0200)
This allows using this parser with any flash driver that takes care of
setting of_node (using mtd_set_of_node helper) correctly. Up to now
support for "fixed-partitions" DT compatibility string was working only
with flash drivers that were specifying "ofpart" (manually or by letting
mtd use the default set of parsers).

This matches existing bindings documentation.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/ofpart.c

index 9f497315e65d4a8eeabbdcb175c38465dacd528c..615f8c173162cb2a7e48301f365fbbfc667db81c 100644 (file)
@@ -140,9 +140,16 @@ ofpart_none:
        return ret;
 }
 
+static const struct of_device_id parse_ofpart_match_table[] = {
+       { .compatible = "fixed-partitions" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
+
 static struct mtd_part_parser ofpart_parser = {
        .parse_fn = parse_fixed_partitions,
        .name = "fixed-partitions",
+       .of_match_table = parse_ofpart_match_table,
 };
 
 static int parse_ofoldpart_partitions(struct mtd_info *master,