PATCH:2.4:2.6:compile fails with outw_p() in :?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Because mips uses #define with do..while(0) for outw_p (and
not inline like other arches) herems.h fails to compile.  ?:
requires and expr and do..while(0) is a statement.  Here are
the compile errors followed by my proposed patches for both
2.4 and 2.6.

build errors with CONFIG_HERMES=y
hermes.h: In function `hermes_set_irqmask':
hermes.h:337: parse error before "do"
hermes.h:337: parse error before ';' token
hermes.h: In function `hermes_write_words':

2.4
Index: drivers/net/wireless/hermes.h
===================================================================
RCS file: /home/cvs/linux/drivers/net/wireless/hermes.h,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 hermes.h
--- drivers/net/wireless/hermes.h       13 Aug 2003 17:19:20 -0000      1.6.2.4
+++ drivers/net/wireless/hermes.h       27 Aug 2003 21:37:24 -0000
@@ -302,12 +302,14 @@
 #define hermes_read_reg(hw, off) ((hw)->io_space ? \
        inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
        readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
-#define hermes_write_reg(hw, off, val) ((hw)->io_space ? \
-       outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
-       writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )))
-
-#define hermes_read_regn(hw, name) (hermes_read_reg((hw), HERMES_##name))
-#define hermes_write_regn(hw, name, val) (hermes_write_reg((hw), HERMES_##name, (val)))
+#define hermes_write_reg(hw, off, val) do { \
+       if ( (hw)->io_space ) \
+               outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )); \
+       else \
+               writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )); \
+       } while (0)
+#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
+#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val))
 
 /* Function prototypes */
 void hermes_struct_init(hermes_t *hw, ulong address, int io_space, int reg_spacing);


2.6
Index: drivers/net/wireless/hermes.h
===================================================================
RCS file: /home/cvs/linux/drivers/net/wireless/hermes.h,v
retrieving revision 1.10
diff -u -r1.10 hermes.h
--- drivers/net/wireless/hermes.h       22 Jun 2003 23:09:54 -0000      1.10
+++ drivers/net/wireless/hermes.h       27 Aug 2003 21:46:20 -0000
@@ -302,12 +302,14 @@
 #define hermes_read_reg(hw, off) ((hw)->io_space ? \
        inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
        readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
-#define hermes_write_reg(hw, off, val) ((hw)->io_space ? \
-       outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
-       writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )))
-
-#define hermes_read_regn(hw, name) (hermes_read_reg((hw), HERMES_##name))
-#define hermes_write_regn(hw, name, val) (hermes_write_reg((hw), HERMES_##name, (val)))
+#define hermes_write_reg(hw, off, val) do { \
+       if ( (hw)->io_space ) \
+               outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )); \
+       else \
+               writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )); \
+       } while (0)
+#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
+#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val))
 
 /* Function prototypes */
 void hermes_struct_init(hermes_t *hw, ulong address, int io_space, int reg_spacing);


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux