[PATCH] fix eeh.h compile warnings

Nathan Lynch ntl at pobox.com
Thu Mar 3 14:37:57 EST 2005


On Wed, Mar 02, 2005 at 07:41:13PM -0600, Nishanth Aravamudan wrote:
> 
> While building 2.6.11 for a G5, I noticed the following errors being
> spit out (gcc 3.3.5):
> 
> include/asm/eeh.h: In function `eeh_memcpy_fromio':
> include/asm/eeh.h:265: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insb':
> include/asm/eeh.h:353: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insw_ns':
> include/asm/eeh.h:360: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insl_ns':
> include/asm/eeh.h:367: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_memcpy_fromio':
> include/asm/eeh.h:265: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insb':
> include/asm/eeh.h:353: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insw_ns':
> include/asm/eeh.h:360: warning: statement with no effect
> include/asm/eeh.h: In function `eeh_insl_ns':
> include/asm/eeh.h:367: warning: statement with no effect
> 
> These warnings are emitted for pretty much every driver. It looks like
> it is becuase with CONFIG_EEH undefined (it's a pSeries thing? -- my
> interpretation from looking at the ppc64 Kconfig), eeh_check_failure()
> becomes #define'd to simply it's second parameter, which in the case of
> assignment statements ia statement with no effect

I don't have a toolchain readily available which gives these warnings,
but does this fix them?

Use static inlines instead of #defines for stub functions when
CONFIG_EEH=n.

Signed-off-by: Nathan Lynch <ntl at pobox.com>

Index: linux-2.6.11/include/asm-ppc64/eeh.h
===================================================================
--- linux-2.6.11.orig/include/asm-ppc64/eeh.h	2005-03-02 07:38:38.000000000 +0000
+++ linux-2.6.11/include/asm-ppc64/eeh.h	2005-03-03 01:39:25.000000000 +0000
@@ -104,17 +104,30 @@ int eeh_unregister_notifier(struct notif
  */
 #define EEH_IO_ERROR_VALUE(size)	(~0U >> ((4 - (size)) * 8))
 
-#else
-#define eeh_init()
-#define eeh_check_failure(token, val) (val)
-#define eeh_dn_check_failure(dn, dev) (0)
-#define pci_addr_cache_build()
-#define eeh_add_device_early(dn)
-#define eeh_add_device_late(dev)
-#define eeh_remove_device(dev)
+#else /* !CONFIG_EEH */
+static inline void eeh_init(void) { }
+
+static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
+{
+	return val;
+}
+
+static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
+{
+	return 0;
+}
+
+static inline void pci_addr_cache_build(void) { }
+
+static inline void eeh_add_device_early(struct device_node *dn) { }
+
+static inline void eeh_add_device_late(struct pci_dev *dev) { }
+
+static inline void eeh_remove_device(struct pci_dev *dev) { }
+
 #define EEH_POSSIBLE_ERROR(val, type) (0)
 #define EEH_IO_ERROR_VALUE(size) (-1UL)
-#endif
+#endif /* CONFIG_EEH */
 
 /* 
  * MMIO read/write operations with EEH support.



More information about the Linuxppc64-dev mailing list