2092cc28fd412662df5f646d139bb6021d1f80d6
[openwrt/staging/neocturne.git] /
1 From 4ac9222778478a00c7fc9d347b7ed1e0e595120d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 4 Jan 2018 08:05:34 +0100
4 Subject: [PATCH] mtd: ofpart: add of_match_table with "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 Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
21 ---
22 drivers/mtd/ofpart.c | 7 +++++++
23 1 file changed, 7 insertions(+)
24
25 --- a/drivers/mtd/ofpart.c
26 +++ b/drivers/mtd/ofpart.c
27 @@ -140,9 +140,16 @@ ofpart_none:
28 return ret;
29 }
30
31 +static const struct of_device_id parse_ofpart_match_table[] = {
32 + { .compatible = "fixed-partitions" },
33 + {},
34 +};
35 +MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);
36 +
37 static struct mtd_part_parser ofpart_parser = {
38 .parse_fn = parse_ofpart_partitions,
39 .name = "ofpart",
40 + .of_match_table = parse_ofpart_match_table,
41 };
42
43 static int parse_ofoldpart_partitions(struct mtd_info *master,