Skip to contentSkip to conversation

e1000e: Fix duplicate include guard

PATCH In review Tom Seewald 4 participants 5 messages Feb 22, 2021 – Mar 2, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 e1000e: Fix duplicate include guard

The include guard "_E1000_HW_H_" is used by header files in three different drivers (e1000/e1000_hw.h, e1000e/hw.h, and igb/e1000_hw.h). Using the same include guard macro in more than one header file may cause unexpected behavior from the compiler. Fix the duplicate include guard in the e1000e driver by renaming it.

Fixes bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
---
 drivers/net/ethernet/intel/e1000e/hw.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/hw.h +3 -3
index 69a2329ea463..db79c4e6413e 100644
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Copyright(c) 1999 - 2018 Intel Corporation. */
 
-#ifndef _E1000_HW_H_
-#define _E1000_HW_H_
+#ifndef _E1000E_HW_H_
+#define _E1000E_HW_H_
 
 #include "regs.h"
 #include "defines.h"
@@ -714,4 +714,4 @@ struct e1000_hw {
 #include "80003es2lan.h"
 #include "ich8lan.h"
 
-#endif
+#endif /* _E1000E_HW_H_ */
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 igb: Fix duplicate include guard

The include guard "_E1000_HW_H_" is used by two separate header files in two different drivers (e1000/e1000_hw.h and igb/e1000_hw.h). Using the same include guard macro in more than one header file may cause unexpected behavior from the compiler. Fix this by renaming the duplicate guard in the igb driver.

Fixes 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")
---
 drivers/net/ethernet/intel/igb/e1000_hw.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/igb/e1000_hw.h +3 -3
index 5d87957b2627..44111f65afc7 100644
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Copyright(c) 2007 - 2018 Intel Corporation. */
 
-#ifndef _E1000_HW_H_
-#define _E1000_HW_H_
+#ifndef _E1000_IGB_HW_H_
+#define _E1000_IGB_HW_H_
 
 #include <linux/types.h>
 #include <linux/delay.h>
@@ -551,4 +551,4 @@ s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
 
 void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
 void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
-#endif /* _E1000_HW_H_ */
+#endif /* _E1000_IGB_HW_H_ */
Signature · 1 line
2.20.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net 2/2] igb: Fix duplicate include guard

Quoted 8 lines · Tom Seewald

The include guard "_E1000_HW_H_" is used by two separate header files in two different drivers (e1000/e1000_hw.h and igb/e1000_hw.h). Using the same include guard macro in more than one header file may cause unexpected behavior from the compiler. Fix this by renaming the duplicate guard in the igb driver.

Fixes 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")

Change is simple and makes sense.

Tested-by on v1 1/2
#3 lore raw
In reply to Tom Seewald
Quoted 29 lines · Tom Seewald

The include guard "_E1000_HW_H_" is used by header files in three different drivers (e1000/e1000_hw.h, e1000e/hw.h, and igb/e1000_hw.h). Using the same include guard macro in more than one header file may cause unexpected behavior from the compiler. Fix the duplicate include guard in the e1000e driver by renaming it.

Fixes bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
---
  drivers/net/ethernet/intel/e1000e/hw.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/hw.h +2 -2
index 69a2329ea463..db79c4e6413e 100644
@@ -1,8 +1,8 @@
  /* SPDX-License-Identifier: GPL-2.0 */
  /* Copyright(c) 1999 - 2018 Intel Corporation. */
 
-#ifndef _E1000_HW_H_
-#define _E1000_HW_H_
+#ifndef _E1000E_HW_H_
+#define _E1000E_HW_H_
 
  #include "regs.h"
  #include "defines.h"

drivers/net/ethernet/intel/e1000e/hw.h struct e1000_hw { · line 717

Quoted 5 lines
drivers/net/ethernet/intel/e1000e/hw.h +1 -1
@@ -714,4 +714,4 @@ struct e1000_hw {
  #include "80003es2lan.h"
  #include "ich8lan.h"
 
-#endif
+#endif /* _E1000E_HW_H_ */
Acked-by on v1 1/2
#4 lore raw
In reply to Tom Seewald
Quoted 29 lines · Tom Seewald

The include guard "_E1000_HW_H_" is used by header files in three different drivers (e1000/e1000_hw.h, e1000e/hw.h, and igb/e1000_hw.h). Using the same include guard macro in more than one header file may cause unexpected behavior from the compiler. Fix the duplicate include guard in the e1000e driver by renaming it.

Fixes bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
---
  drivers/net/ethernet/intel/e1000e/hw.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/hw.h +2 -2
index 69a2329ea463..db79c4e6413e 100644
@@ -1,8 +1,8 @@
  /* SPDX-License-Identifier: GPL-2.0 */
  /* Copyright(c) 1999 - 2018 Intel Corporation. */
 
-#ifndef _E1000_HW_H_
-#define _E1000_HW_H_
+#ifndef _E1000E_HW_H_
+#define _E1000E_HW_H_
 
  #include "regs.h"
  #include "defines.h"

drivers/net/ethernet/intel/e1000e/hw.h struct e1000_hw { · line 717

Quoted 5 lines
drivers/net/ethernet/intel/e1000e/hw.h +1 -1
@@ -714,4 +714,4 @@ struct e1000_hw {
  #include "80003es2lan.h"
  #include "ich8lan.h"
 
-#endif
+#endif /* _E1000E_HW_H_ */