From 3b1ea0996f83690695e06d11e0214110b6f7201f Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Wed, 22 Aug 2018 13:00:22 +0200 Subject: [PATCH] ar71xx: fix build error due to bad include While "rawnand.h" is available in kernel 4.14, the default for this target is kernel 4.9 in which "nand.h" should be used. Add an extra check to include the correct file depending on kernel version Fixes these build errors: drivers/mtd/nand/ar934x_nfc.c:16:10: fatal error: linux/mtd/rawnand.h: No such file or directory #include ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. Fixes: 318e19ba6755 ("ar71xx: add v4.14 support") Signed-off-by: Koen Vandeputte --- target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c | 6 +++++- target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c | 6 +++++- target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c | 6 +++++- target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c | 7 +++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c b/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c index 0b6ba1fcec5..26f14fdac69 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c @@ -8,17 +8,21 @@ * by the Free Software Foundation. */ +#include #include #include #include #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +#include +#else #include +#endif #include #include #include #include -#include #include diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c index 262e3fa09d2..717a94237c6 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c @@ -12,10 +12,15 @@ * by the Free Software Foundation. */ +#include #include #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +#include +#else #include +#endif #include #include #include @@ -23,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c index d12be88520b..74f7f2913ec 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c @@ -8,15 +8,19 @@ * by the Free Software Foundation. */ +#include #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +#include +#else #include +#endif #include #include #include #include #include -#include #include #include diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c index ac50b87fd5c..1f193f196c6 100644 --- a/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c +++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c @@ -8,18 +8,21 @@ * by the Free Software Foundation. */ +#include #include #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +#include +#else #include -#include +#endif#include #include #include #include #include #include #include -#include #include #include