2020-08-18 11:36:07

by Youling Tang

[permalink] [raw]
Subject: [PATCH] MIPS: Loongson64: Fix build error about redeclaration of enumerator 'VIRTUAL' and "CONFIG_DM_THIN_PROVISIONING"

After commit 39c1485c8baa (MIPS: KVM: Add kvm guestsupport for Loongson-3)

Fix the following build error:

drivers/md/dm-thin.c:116:2: error: redeclaration of enumerator ‘VIRTUAL’
VIRTUAL,
^
In file included from ./arch/mips/include/asm/mach-loongson64/mmzone.h:12:0,
from ./arch/mips/include/asm/mmzone.h:12,
from ./include/linux/mmzone.h:962,
from ./include/linux/gfp.h:6,
from ./include/linux/slab.h:15,
from ./include/linux/genhd.h:16,
from ./include/linux/blkdev.h:8,
from drivers/md/persistent-data/dm-block-manager.h:11,
from drivers/md/dm-thin-metadata.h:10,
from drivers/md/dm-thin.c:7:
./arch/mips/include/asm/mach-loongson64/boot_param.h:198:2: note: previous
definition of ‘VIRTUAL’ was here VIRTUAL = 3
^
scripts/Makefile.build:283: recipe for target 'drivers/md/dm-thin.o' failed
make[2]: *** [drivers/md/dm-thin.o] Error 1

Signed-off-by: Youling Tang <[email protected]>
---
arch/mips/include/asm/mach-loongson64/boot_param.h | 2 +-
arch/mips/loongson64/env.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index afc92b7..a4ef4ac 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -195,7 +195,7 @@ struct boot_params {
enum loongson_bridge_type {
LS7A = 1,
RS780E = 2,
- VIRTUAL = 3
+ VIRT = 3
};

struct loongson_system_configuration {
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 134cb8e..623b3f1 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -180,8 +180,8 @@ void __init prom_init_env(void)
loongson_sysconf.early_config = rs780e_early_config;
break;
default:
- pr_info("The bridge chip is VIRTUAL\n");
- loongson_sysconf.bridgetype = VIRTUAL;
+ pr_info("The bridge chip is VIRT\n");
+ loongson_sysconf.bridgetype = VIRT;
loongson_sysconf.early_config = virtual_early_config;
loongson_fdt_blob = __dtb_loongson64v_4core_virtio_begin;
break;
--
2.1.0


2020-08-18 12:45:53

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH] MIPS: Loongson64: Fix build error about redeclaration of enumerator 'VIRTUAL' and "CONFIG_DM_THIN_PROVISIONING"

Hi, Youling,

On Tue, Aug 18, 2020 at 7:35 PM Youling Tang <[email protected]> wrote:
>
> After commit 39c1485c8baa (MIPS: KVM: Add kvm guestsupport for Loongson-3)
>
> Fix the following build error:
>
> drivers/md/dm-thin.c:116:2: error: redeclaration of enumerator ‘VIRTUAL’
> VIRTUAL,
> ^
> In file included from ./arch/mips/include/asm/mach-loongson64/mmzone.h:12:0,
> from ./arch/mips/include/asm/mmzone.h:12,
> from ./include/linux/mmzone.h:962,
> from ./include/linux/gfp.h:6,
> from ./include/linux/slab.h:15,
> from ./include/linux/genhd.h:16,
> from ./include/linux/blkdev.h:8,
> from drivers/md/persistent-data/dm-block-manager.h:11,
> from drivers/md/dm-thin-metadata.h:10,
> from drivers/md/dm-thin.c:7:
> ./arch/mips/include/asm/mach-loongson64/boot_param.h:198:2: note: previous
> definition of ‘VIRTUAL’ was here VIRTUAL = 3
> ^
> scripts/Makefile.build:283: recipe for target 'drivers/md/dm-thin.o' failed
> make[2]: *** [drivers/md/dm-thin.o] Error 1
>
> Signed-off-by: Youling Tang <[email protected]>
> ---
> arch/mips/include/asm/mach-loongson64/boot_param.h | 2 +-
> arch/mips/loongson64/env.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index afc92b7..a4ef4ac 100644
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -195,7 +195,7 @@ struct boot_params {
> enum loongson_bridge_type {
> LS7A = 1,
> RS780E = 2,
> - VIRTUAL = 3
> + VIRT = 3
> };
Thank you for your patch, but I think this problem is because of
invalid .h file inclusion (arch-dependent .h file should not be
included in drivers), and Xuerui Wang has investigated it for some
time. He has a draft patch (haven't sent yet) which I think is a
better way. So, please wait some time.

Huacai
>
> struct loongson_system_configuration {
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index 134cb8e..623b3f1 100644
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -180,8 +180,8 @@ void __init prom_init_env(void)
> loongson_sysconf.early_config = rs780e_early_config;
> break;
> default:
> - pr_info("The bridge chip is VIRTUAL\n");
> - loongson_sysconf.bridgetype = VIRTUAL;
> + pr_info("The bridge chip is VIRT\n");
> + loongson_sysconf.bridgetype = VIRT;
> loongson_sysconf.early_config = virtual_early_config;
> loongson_fdt_blob = __dtb_loongson64v_4core_virtio_begin;
> break;
> --
> 2.1.0
>

2020-08-19 05:49:21

by WANG Xuerui

[permalink] [raw]
Subject: Re: [PATCH] MIPS: Loongson64: Fix build error about redeclaration of enumerator 'VIRTUAL' and "CONFIG_DM_THIN_PROVISIONING"

Hi Youling,


On 2020/8/18 19:32, Youling Tang wrote:
> After commit 39c1485c8baa (MIPS: KVM: Add kvm guestsupport for Loongson-3)
>
> Fix the following build error:
>
> drivers/md/dm-thin.c:116:2: error: redeclaration of enumerator ‘VIRTUAL’
> VIRTUAL,
> ^
> In file included from ./arch/mips/include/asm/mach-loongson64/mmzone.h:12:0,
> from ./arch/mips/include/asm/mmzone.h:12,
> from ./include/linux/mmzone.h:962,
> from ./include/linux/gfp.h:6,
> from ./include/linux/slab.h:15,
> from ./include/linux/genhd.h:16,
> from ./include/linux/blkdev.h:8,
> from drivers/md/persistent-data/dm-block-manager.h:11,
> from drivers/md/dm-thin-metadata.h:10,
> from drivers/md/dm-thin.c:7:
> ./arch/mips/include/asm/mach-loongson64/boot_param.h:198:2: note: previous
> definition of ‘VIRTUAL’ was here VIRTUAL = 3
> ^
> scripts/Makefile.build:283: recipe for target 'drivers/md/dm-thin.o' failed
> make[2]: *** [drivers/md/dm-thin.o] Error 1
>
> Signed-off-by: Youling Tang <[email protected]>
> ---
> arch/mips/include/asm/mach-loongson64/boot_param.h | 2 +-
> arch/mips/loongson64/env.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index afc92b7..a4ef4ac 100644
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -195,7 +195,7 @@ struct boot_params {
> enum loongson_bridge_type {
> LS7A = 1,
> RS780E = 2,
> - VIRTUAL = 3
> + VIRT = 3

I believe this is only masking the root cause, which is redundant
#include directives inside mach-specific headers. I'll send my version
of fix shortly.

Anyway, thanks for your help!

> };
>
> struct loongson_system_configuration {
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index 134cb8e..623b3f1 100644
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -180,8 +180,8 @@ void __init prom_init_env(void)
> loongson_sysconf.early_config = rs780e_early_config;
> break;
> default:
> - pr_info("The bridge chip is VIRTUAL\n");
> - loongson_sysconf.bridgetype = VIRTUAL;
> + pr_info("The bridge chip is VIRT\n");
> + loongson_sysconf.bridgetype = VIRT;
> loongson_sysconf.early_config = virtual_early_config;
> loongson_fdt_blob = __dtb_loongson64v_4core_virtio_begin;
> break;