08f048f42a18d095f3c28104f78fb74fb608913b
[librecmc/librecmc.git] /
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Thu, 4 Jan 2018 08:05:34 +0100
3 Subject: [PATCH V10 3/3] mtd: ofpart: add of_match_table with
4  "fixed-partitions"
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This allows using this parser with any flash driver that takes care of
10 setting of_node (using mtd_set_of_node helper) correctly. Up to now
11 support for "fixed-partitions" DT compatibility string was working only
12 with flash drivers that were specifying "ofpart" (manually or by letting
13 mtd use the default set of parsers).
14
15 This matches existing bindings documentation.
16
17 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
18 Reviewed-by: Brian Norris <computersforpeace@gmail.com>
19 Tested-by: Brian Norris <computersforpeace@gmail.com>
20 ---
21
22 --- a/drivers/mtd/ofpart.c
23 +++ b/drivers/mtd/ofpart.c
24 @@ -140,9 +140,16 @@ ofpart_none:
25         return ret;
26  }
27  
28 +static const struct of_device_id parse_ofpart_match_table[] = {
29 +       { .compatible = "fixed-partitions" },
30 +       {},
31 +};
32 +MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
33 +
34  static struct mtd_part_parser ofpart_parser = {
35         .parse_fn = parse_fixed_partitions,
36         .name = "fixed-partitions",
37 +       .of_match_table = parse_ofpart_match_table,
38  };
39  
40  static int parse_ofoldpart_partitions(struct mtd_info *master,