[RESEND,4/4] mtd: ofpart: add of_match_table with "fixed-partitions"

Submitted by Rafał Miłecki on April 20, 2017, 1:57 p.m.

Details

Message ID 20170420135731.13272-5-zajec5@gmail.com
State Superseded
Headers show

Commit Message

Rafał Miłecki April 20, 2017, 1:57 p.m.
From: Rafał Miłecki <rafal@milecki.pl>

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>
---
 drivers/mtd/ofpart.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Brian Norris April 21, 2017, 12:11 a.m.
On Thu, Apr 20, 2017 at 03:57:31PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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>
> ---

Seems OK to me. I think this means we can even get away without putting
"ofpart" in the "probe type" arrays in drivers now, if we don't care
about the legacy binding. Probably not gonna happen for existing
drivers, but at least it helps going forward. And of course, it provides
a starting example for new partition-parser compatible properties, if
that's the way we go.

Reviewed-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Brian Norris <computersforpeace@gmail.com>

>  drivers/mtd/ofpart.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> index 2861c7079d7b..fb6f3df40e94 100644
> --- a/drivers/mtd/ofpart.c
> +++ b/drivers/mtd/ofpart.c
> @@ -140,9 +140,16 @@ static int parse_ofpart_partitions(struct mtd_info *master,
>  	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_ofpart_partitions,
>  	.name = "ofpart",
> +	.of_match_table = parse_ofpart_match_table,
>  };
>  
>  static int parse_ofoldpart_partitions(struct mtd_info *master,
> -- 
> 2.11.0
>

Patch hide | download patch | download mbox

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 2861c7079d7b..fb6f3df40e94 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -140,9 +140,16 @@  static int parse_ofpart_partitions(struct mtd_info *master,
 	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_ofpart_partitions,
 	.name = "ofpart",
+	.of_match_table = parse_ofpart_match_table,
 };
 
 static int parse_ofoldpart_partitions(struct mtd_info *master,