diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-05-29 13:32:33 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:10 -0400 |
commit | d26c87d64eff271146b40b66c7de8cfeaf956707 (patch) | |
tree | 7ca79171866e124522212cd92256016db6b8fecf /drivers/mtd/ofpart.c | |
parent | c7975330154af17aecc167b33ca866b6b3d98918 (diff) |
mtd: prepare to convert of_mtd_parse_partitions to partition parser
Prepare to convert of_mtd_parse_partitions() to usual partitions parser:
1) Register ofpart parser
2) Internally don't use passed device for error printing
3) Add device_node to mtd_part_parser_data struct
4) Move of_mtd_parse_partitions from __devinit to common text section
5) add ofpart to the default list of partition parsers
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Diffstat (limited to 'drivers/mtd/ofpart.c')
-rw-r--r-- | drivers/mtd/ofpart.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c index a996718fa6b0..7c2c926e0bd7 100644 --- a/drivers/mtd/ofpart.c +++ b/drivers/mtd/ofpart.c | |||
@@ -20,7 +20,17 @@ | |||
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | 22 | ||
23 | int __devinit of_mtd_parse_partitions(struct device *dev, | 23 | static int parse_ofpart_partitions(struct mtd_info *master, |
24 | struct mtd_partition **pparts, | ||
25 | struct mtd_part_parser_data *data) | ||
26 | { | ||
27 | if (!data || !data->of_node) | ||
28 | return 0; | ||
29 | |||
30 | return of_mtd_parse_partitions(NULL, data->of_node, pparts); | ||
31 | } | ||
32 | |||
33 | int of_mtd_parse_partitions(struct device *dev, | ||
24 | struct device_node *node, | 34 | struct device_node *node, |
25 | struct mtd_partition **pparts) | 35 | struct mtd_partition **pparts) |
26 | { | 36 | { |
@@ -69,7 +79,7 @@ int __devinit of_mtd_parse_partitions(struct device *dev, | |||
69 | 79 | ||
70 | if (!i) { | 80 | if (!i) { |
71 | of_node_put(pp); | 81 | of_node_put(pp); |
72 | dev_err(dev, "No valid partition found on %s\n", node->full_name); | 82 | pr_err("No valid partition found on %s\n", node->full_name); |
73 | kfree(*pparts); | 83 | kfree(*pparts); |
74 | *pparts = NULL; | 84 | *pparts = NULL; |
75 | return -EINVAL; | 85 | return -EINVAL; |
@@ -79,4 +89,17 @@ int __devinit of_mtd_parse_partitions(struct device *dev, | |||
79 | } | 89 | } |
80 | EXPORT_SYMBOL(of_mtd_parse_partitions); | 90 | EXPORT_SYMBOL(of_mtd_parse_partitions); |
81 | 91 | ||
92 | static struct mtd_part_parser ofpart_parser = { | ||
93 | .owner = THIS_MODULE, | ||
94 | .parse_fn = parse_ofpart_partitions, | ||
95 | .name = "ofpart", | ||
96 | }; | ||
97 | |||
98 | static int __init ofpart_parser_init(void) | ||
99 | { | ||
100 | return register_mtd_parser(&ofpart_parser); | ||
101 | } | ||
102 | |||
103 | module_init(ofpart_parser_init); | ||
104 | |||
82 | MODULE_LICENSE("GPL"); | 105 | MODULE_LICENSE("GPL"); |