Fix inclusion guards
Subsystems (6)
cover Fix inclusion guards
A patch by Sam [1] reminded me to check for misspelled inclusion guards. I wrote some crude tool, with a high false positive rate, and was able to find some other occurences where the "#ifndef" and "#define" parts were not matching.
Those patches fix those preprocessor symbols. One header wasn't actually used anymore, so just remove that whole file.
Cheers,
Andre
[1] https://lore.kernel.org/u-boot/[email protected]/
Andre Przywara (5):
imx: fix header inclusion guards
arm: uniphier: fix header inclusion guard
freescale: fix header inclusion guard
exynos: fix header inclusion guard
faraday: remove orphaned header file
arch/arm/include/asm/arch-imx8m/sys_proto.h | 2 +- arch/arm/include/asm/arch-imx8ulp/sys_proto.h | 2 +- arch/arm/include/asm/arch-imx9/sys_proto.h | 2 +- arch/arm/mach-uniphier/dram/ddrphy-init.h | 2 +- board/freescale/common/vsc3316_3308.h | 2 +- drivers/pinctrl/exynos/pinctrl-exynos.h | 2 +- include/faraday/ftahbc020s.h | 46 ------------------- include/imx_sip.h | 2 +- 8 files changed, 7 insertions(+), 53 deletions(-) delete mode 100644 include/faraday/ftahbc020s.h
Signature · 1 line
2.25.1
PATCH 1/5 imx: fix header inclusion guards
It seems like the header inclusion guards for some IMX related headers were misspelled or got out of sync.
Make the preprocessor symbols for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
--- arch/arm/include/asm/arch-imx8m/sys_proto.h | 2 +- arch/arm/include/asm/arch-imx8ulp/sys_proto.h | 2 +- arch/arm/include/asm/arch-imx9/sys_proto.h | 2 +- include/imx_sip.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-imx8m/sys_proto.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef __ARCH_IMX8M_SYS_PROTO_H -#define __ARCH_NMX8M_SYS_PROTO_H +#define __ARCH_IMX8M_SYS_PROTO_H#include <asm/mach-imx/sys_proto.h> #include <asm/arch/imx-regs.h>
arch/arm/include/asm/arch-imx8ulp/sys_proto.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef __ARCH_IMX8ULP_SYS_PROTO_H -#define __ARCH_NMX8ULP_SYS_PROTO_H +#define __ARCH_IMX8ULP_SYS_PROTO_H#include <asm/mach-imx/sys_proto.h>
arch/arm/include/asm/arch-imx9/sys_proto.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef __ARCH_IMX9_SYS_PROTO_H -#define __ARCH_NMX9_SYS_PROTO_H +#define __ARCH_IMX9_SYS_PROTO_H#include <asm/mach-imx/sys_proto.h>
include/imx_sip.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef _IMX_SIP_H__ -#define _IMX_SIP_H_ +#define _IMX_SIP_H__#define IMX_SIP_GPC 0xC2000000#define IMX_SIP_GPC_PM_DOMAIN 0x03
Signature · 1 line
2.25.1
Re: [PATCH 1/5] imx: fix header inclusion guards
Quoted 7 lines · Andre Przywara
It seems like the header inclusion guards for some IMX related headers were misspelled or got out of sync.
Make the preprocessor symbols for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>
Signature · 1 line
Tom
PATCH 2/5 arm: uniphier: fix header inclusion guard
In reply to Andre PrzywaraIt seems like the header inclusion guard for some Uniphier DDR PHY header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
--- arch/arm/mach-uniphier/dram/ddrphy-init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-uniphier/dram/ddrphy-init.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef ARCH_DDRPHY_INIT_H -#define ARCH_DDRPHY_INTT_H +#define ARCH_DDRPHY_INIT_H #include <linux/compiler.h> #include <linux/types.h>
Signature · 1 line
2.25.1
Re: [PATCH 2/5] arm: uniphier: fix header inclusion guard
Quoted 7 lines · Andre Przywara
It seems like the header inclusion guard for some Uniphier DDR PHY header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>
Signature · 1 line
Tom
PATCH 3/5 freescale: fix header inclusion guard
In reply to Andre PrzywaraIt seems like the header inclusion guard for some Freescale crosspoint switch header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
--- board/freescale/common/vsc3316_3308.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/vsc3316_3308.h +1 -1
@@ -4,7 +4,7 @@*/ #ifndef __VSC_CROSSBAR_H_ -#define __VSC_CROSSBAR_H 1_ +#define __VSC_CROSSBAR_H_#include <common.h> #include <i2c.h>
Signature · 1 line
2.25.1
Fabio Estevam
reviewerRe: [PATCH 3/5] freescale: fix header inclusion guard
H Andre,
Quoted 17 lines · Andre Przywara
It seems like the header inclusion guard for some Freescale crosspoint switch header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>--- board/freescale/common/vsc3316_3308.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/freescale/common/vsc3316_3308.h +0
-0
board/freescale/common/vsc3316_3308.h line 7
Quoted 5 lines
board/freescale/common/vsc3316_3308.h +1
-1@@ -4,7 +4,7 @@*/ #ifndef __VSC_CROSSBAR_H_ -#define __VSC_CROSSBAR_H 1_ +#define __VSC_CROSSBAR_H_
The change is correct, but it does not match the Subject/commit log.
Re: [PATCH 3/5] freescale: fix header inclusion guard
On Mon, 15 May 2023 11:17:14 -0300
Fabio Estevam <[email protected]> wrote:
Hi Fabio,
Quoted 20 lines · Andre Przywara
Quoted 19 lines
It seems like the header inclusion guard for some Freescale crosspoint switch header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>--- board/freescale/common/vsc3316_3308.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/freescale/common/vsc3316_3308.h +0
-0@@ -4,7 +4,7 @@*/
Quoted 5 lines
board/freescale/common/vsc3316_3308.h line 7
Quoted 3 lines
board/freescale/common/vsc3316_3308.h +1
-1#ifndef __VSC_CROSSBAR_H_ -#define __VSC_CROSSBAR_H 1_ +#define __VSC_CROSSBAR_H_The change is correct, but it does not match the Subject/commit log.
What do you mean, exactly?
To put *some* context into the commit message, I tried to find out what this "vsc" device is about, and found "crosspoint switch" somewhere (doc/README.VSC3316-3308). Is that not what it is about? Or is not a Freescale device, but just used by Freescale SoCs? Some T208 hardware seems to be the only user, though.
Can you suggest a better description?
Cheers,
Andre
Fabio Estevam
reviewerRe: [PATCH 3/5] freescale: fix header inclusion guard
Hi Andre,
Quoted 6 lines
What do you mean, exactly?
To put *some* context into the commit message, I tried to find out what this "vsc" device is about, and found "crosspoint switch" somewhere (doc/README.VSC3316-3308). Is that not what it is about? Or is not a Freescale device, but just used by Freescale SoCs? Some T208 hardware seems to be the only user, though.
The VSC3316 is a switch manufactured by Microchip:
https://www.microsemi.com/product-directory/digital-crosspoint-switches/3998-vsc3316
Quoted 1 line
Can you suggest a better description?
What about:
Subject: freescale: vsc3316_3308: fix header inclusion guard
It seems like the header inclusion guard for the vsc3316_3308 switch header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Re: [PATCH 3/5] freescale: fix header inclusion guard
In reply to Andre PrzywaraQuoted 7 lines · Andre Przywara
It seems like the header inclusion guard for some Freescale crosspoint switch header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>
Signature · 1 line
Tom
PATCH 4/5 exynos: fix header inclusion guard
In reply to Andre PrzywaraIt seems like the header inclusion guard for the Exynos pinctrl header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
--- drivers/pinctrl/exynos/pinctrl-exynos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/exynos/pinctrl-exynos.h +1 -1
@@ -6,7 +6,7 @@*/ #ifndef __PINCTRL_EXYNOS_H_ -#define __PINCTRL_EXYNOS__H_ +#define __PINCTRL_EXYNOS_H_#define PIN_CON 0x00/* Offset of pin function register */ #define PIN_DAT 0x04/* Offset of pin data register */
Signature · 1 line
2.25.1
Re: [PATCH 4/5] exynos: fix header inclusion guard
Quoted 7 lines · Andre Przywara
It seems like the header inclusion guard for the Exynos pinctrl header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>
Signature · 1 line
Tom
Re: [PATCH 4/5] exynos: fix header inclusion guard
In reply to Andre PrzywaraQuoted 8 lines · Andre Przywara
It seems like the header inclusion guard for the Exynos pinctrl header was misspelled.
Make the preprocessor symbol for the #ifndef and #define lines the same, so that the double inclusion protection works as expected.
Signed-off-by Andre Przywara <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 5/5 faraday: remove orphaned header file
In reply to Andre PrzywaraCommit 11232139e399 ("nds32: Remove the architecture") removed the nds32 architecture, and with it the last user of the Faraday AHB controller header file.
Consequently remove that header file as well.
This was found because the inclusion guard was misspelled.
--- include/faraday/ftahbc020s.h | 46 ------------------------------------ 1 file changed, 46 deletions(-) delete mode 100644 include/faraday/ftahbc020s.h
include/faraday/ftahbc020s.h deleted +0 -46
@@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* Copyright (C) 2011 Andes Technology Corporation -* Macpaul Lin, Andes Technology Corporation <[email protected]> -*/ - -/* FTAHBC020S - AHB Controller (Arbiter/Decoder) definitions */ -#ifndef __FTAHBC020S_H -#define __FTAHBC202S_H - -/* Registers Offsets */ - -/* -* AHB Slave BSR, offset: n * 4, n=0~31 -*/ -#ifndef __ASSEMBLY__ -struct ftahbc02s { -unsigned int s_bsr[32 ];/* 0x00-0x7c - Slave n Base/Size Reg */ -unsigned int pcr;/* 0x80 - Priority Ctrl Reg */ -unsigned int tcrg;/* 0x84 - Transfer Ctrl Reg */ -unsigned int cr;/* 0x88 - Ctrl Reg */ -}; -#endif /* __ASSEMBLY__ */ - -/* -* FTAHBC020S_SLAVE_BSR - Slave n Base / Size Register -*/ -#define FTAHBC020S_SLAVE_BSR_BASE (x) (((x) & 0xfff) << 20) -#define FTAHBC020S_SLAVE_BSR_SIZE (x) (((x) & 0xf) << 16) -/* The value of b(16:19)SLAVE_BSR_SIZE: 1M-2048M, must be power of 2 */ -#define FTAHBC020S_BSR_SIZE (x) (ffs(x) - 1)/* size of Addr Space */ - -/* -* FTAHBC020S_PCR - Priority Control Register -*/ -#define FTAHBC020S_PCR_PLEVEL_ (x) (1 << (x))/* x: 1-15 */ - -/* -* FTAHBC020S_CR - Interrupt Control Register -*/ -#define FTAHBC020S_CR_INTSTS (1 << 24) -#define FTAHBC020S_CR_RESP (x) (((x) & 0x3) << 20) -#define FTAHBC020S_CR_INTSMASK (1 << 16) -#define FTAHBC020S_CR_REMAP (1 << 0) - -#endif /* __FTAHBC020S_H */
Signature · 1 line
2.25.1
Re: [PATCH 5/5] faraday: remove orphaned header file
Quoted 9 lines · Andre Przywara
Commit
11232139e399("nds32: Remove the architecture") removed the nds32 architecture, and with it the last user of the Faraday AHB controller header file.Consequently remove that header file as well.
This was found because the inclusion guard was misspelled.
Signed-off-by Andre Przywara <[email protected]>
Signature · 1 line
Tom
Re: [PATCH 5/5] faraday: remove orphaned header file
In reply to Andre PrzywaraQuoted 10 lines · Andre Przywara
Commit
11232139e399("nds32: Remove the architecture") removed the nds32 architecture, and with it the last user of the Faraday AHB controller header file.Consequently remove that header file as well.
This was found because the inclusion guard was misspelled.
Signed-off-by Andre Przywara <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
Quoted 7 lines · Andre Przywara
A patch by Sam [1] reminded me to check for misspelled inclusion guards. I wrote some crude tool, with a high false positive rate, and was able to find some other occurences where the "#ifndef" and "#define" parts were not matching.
Those patches fix those preprocessor symbols. One header wasn't actually used anymore, so just remove that whole file.
This got me to do a related quick check and I see a handful of unused include files. I'll follow up with that.
Signature · 1 line
Tom