diff mbox series

[OpenWrt-Devel,1/2] kernel: add DT binding support to AVM EVA parser

Message ID 20181201015135.21314-1-mail@david-bauer.net
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,1/2] kernel: add DT binding support to AVM EVA parser | expand

Commit Message

David Bauer Dec. 1, 2018, 1:51 a.m. UTC
It allows selecting split-firmware parser directly by
specifying image-format in the device-tree.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 .../generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

John Crispin Dec. 3, 2018, 6:24 a.m. UTC | #1
On 01/12/2018 02:51, David Bauer wrote:
> It allows selecting split-firmware parser directly by
> specifying image-format in the device-tree.
>
> Signed-off-by: David Bauer <mail@david-bauer.net>
> ---
>   .../generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
> index 746944ee2e..399263ccca 100644
> --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
> +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
> @@ -14,6 +14,7 @@
>   #include <linux/slab.h>
>   #include <linux/mtd/mtd.h>
>   #include <linux/mtd/partitions.h>
> +#include <linux/version.h>
>   #include <linux/byteorder/generic.h>
>   
>   #include "mtdsplit.h"
> @@ -79,9 +80,19 @@ static int mtdsplit_parse_eva(struct mtd_info *master,
>   	return EVA_NR_PARTS;
>   }
>   
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)

Hi,

the kernel version check is not required and can be dropped i believe

    John



> +static const struct of_device_id mtdsplit_eva_of_match_table[] = {
> +	{ .compatible = "avm,eva-firmware" },
> +	{},
> +};
> +#endif
> +
>   static struct mtd_part_parser mtdsplit_eva_parser = {
>   	.owner = THIS_MODULE,
>   	.name = "eva-fw",
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
> +	.of_match_table = mtdsplit_eva_of_match_table,
> +#endif
>   	.parse_fn = mtdsplit_parse_eva,
>   	.type = MTD_PARSER_TYPE_FIRMWARE,
>   };
David Bauer Dec. 3, 2018, 1 p.m. UTC | #2
Hello John,

On 03.12.18 07:24, John Crispin wrote:
>> @@ -79,9 +80,19 @@ static int mtdsplit_parse_eva(struct mtd_info *master,
>>       return EVA_NR_PARTS;
>>   }
>> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
> 
> Hi,
> 
> the kernel version check is not required and can be dropped i believe
> 
>     John
> 

You are right, eva_mtdsplit is only used by ar71xx, ath79 and lantiq 
target, all K4.14 targets.

I will remove the version check in the next version.

Best wishes
David
diff mbox series

Patch

diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
index 746944ee2e..399263ccca 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_eva.c
@@ -14,6 +14,7 @@ 
 #include <linux/slab.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/version.h>
 #include <linux/byteorder/generic.h>
 
 #include "mtdsplit.h"
@@ -79,9 +80,19 @@  static int mtdsplit_parse_eva(struct mtd_info *master,
 	return EVA_NR_PARTS;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+static const struct of_device_id mtdsplit_eva_of_match_table[] = {
+	{ .compatible = "avm,eva-firmware" },
+	{},
+};
+#endif
+
 static struct mtd_part_parser mtdsplit_eva_parser = {
 	.owner = THIS_MODULE,
 	.name = "eva-fw",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+	.of_match_table = mtdsplit_eva_of_match_table,
+#endif
 	.parse_fn = mtdsplit_parse_eva,
 	.type = MTD_PARSER_TYPE_FIRMWARE,
 };