Commit bda2a44e authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: vt6655: Fix macro definitions

Macros should be able to be used in if/else
without braces.

Convert macros to use do {} while (0) instead
of bare braces where appropriate.

Convert macros to use single line macro definitions
where appropriate.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a7307538
...@@ -72,14 +72,10 @@ ...@@ -72,14 +72,10 @@
/*--------------------- Export Macros ------------------------------*/ /*--------------------- Export Macros ------------------------------*/
#define BBvClearFOE(dwIoBase) \ #define BBvClearFOE(dwIoBase) \
{ \ BBbWriteEmbedded(dwIoBase, 0xB1, 0)
BBbWriteEmbedded(dwIoBase, 0xB1, 0); \
}
#define BBvSetFOE(dwIoBase) \ #define BBvSetFOE(dwIoBase) \
{ \ BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C)
BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C); \
}
/*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Classes ----------------------------*/
......
...@@ -83,13 +83,14 @@ typedef enum _chip_type { ...@@ -83,13 +83,14 @@ typedef enum _chip_type {
#ifdef VIAWET_DEBUG #ifdef VIAWET_DEBUG
#define ASSERT(x) { \ #define ASSERT(x) \
if (!(x)) { \ do { \
printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x, \ if (!(x)) { \
__FUNCTION__, __LINE__); \ printk(KERN_ERR "assertion %s failed: file %s line %d\n", \
*(int *)0 = 0; \ #x, __func__, __LINE__); \
} \ *(int *)0 = 0; \
} } \
} while (0)
#define DBG_PORT80(value) outb(value, 0x80) #define DBG_PORT80(value) outb(value, 0x80)
#else #else
#define ASSERT(x) #define ASSERT(x)
......
This diff is collapsed.
...@@ -41,32 +41,29 @@ ...@@ -41,32 +41,29 @@
#ifdef IO_MAP #ifdef IO_MAP
#define VNSvInPortB(dwIOAddress, pbyData) { \ #define VNSvInPortB(dwIOAddress, pbyData) \
*(pbyData) = inb(dwIOAddress); \ do { \
} *(pbyData) = inb(dwIOAddress); \
} while (0)
#define VNSvInPortW(dwIOAddress, pwData) \
do { \
*(pwData) = inw(dwIOAddress); \
} while (0)
#define VNSvInPortW(dwIOAddress, pwData) { \ #define VNSvInPortD(dwIOAddress, pdwData) \
*(pwData) = inw(dwIOAddress); \ do { \
} *(pdwData) = inl(dwIOAddress); \
} while (0)
#define VNSvInPortD(dwIOAddress, pdwData) { \ #define VNSvOutPortB(dwIOAddress, byData) \
*(pdwData) = inl(dwIOAddress); \ outb(byData, dwIOAddress)
}
#define VNSvOutPortW(dwIOAddress, wData) \
outw(wData, dwIOAddress)
#define VNSvOutPortB(dwIOAddress, byData) { \ #define VNSvOutPortD(dwIOAddress, dwData) \
outb(byData, dwIOAddress); \ outl(dwData, dwIOAddress)
}
#define VNSvOutPortW(dwIOAddress, wData) { \
outw(wData, dwIOAddress); \
}
#define VNSvOutPortD(dwIOAddress, dwData) { \
outl(dwData, dwIOAddress); \
}
#else #else
...@@ -75,38 +72,43 @@ ...@@ -75,38 +72,43 @@
// //
#define VNSvInPortB(dwIOAddress, pbyData) { \ #define VNSvInPortB(dwIOAddress, pbyData) \
volatile unsigned char *pbyAddr = ((unsigned char *)(dwIOAddress)); \ do { \
*(pbyData) = readb(pbyAddr); \ volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
} *(pbyData) = readb(pbyAddr); \
} while (0)
#define VNSvInPortW(dwIOAddress, pwData) { \ #define VNSvInPortW(dwIOAddress, pwData) \
volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \ do { \
*(pwData) = readw(pwAddr); \ volatile unsigned short *pwAddr = (unsigned short *)(dwIOAddress); \
} *(pwData) = readw(pwAddr); \
} while (0)
#define VNSvInPortD(dwIOAddress, pdwData) { \ #define VNSvInPortD(dwIOAddress, pdwData) \
volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \ do { \
*(pdwData) = readl(pdwAddr); \ volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \
} *(pdwData) = readl(pdwAddr); \
} while (0)
#define VNSvOutPortB(dwIOAddress, byData) \
do { \
volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
writeb((unsigned char)byData, pbyAddr); \
} while (0)
#define VNSvOutPortB(dwIOAddress, byData) { \
volatile unsigned char *pbyAddr = ((unsigned char *)(dwIOAddress)); \
writeb((unsigned char)byData, pbyAddr); \
}
#define VNSvOutPortW(dwIOAddress, wData) \
do { \
volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
writew((unsigned short)wData, pwAddr); \
} while (0)
#define VNSvOutPortW(dwIOAddress, wData) { \ #define VNSvOutPortD(dwIOAddress, dwData) \
volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \ do { \
writew((unsigned short)wData, pwAddr); \ volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \
} writel((unsigned long)dwData, pdwAddr); \
} while (0)
#define VNSvOutPortD(dwIOAddress, dwData) { \
volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
writel((unsigned long)dwData, pdwAddr); \
}
#endif #endif
...@@ -114,43 +116,42 @@ ...@@ -114,43 +116,42 @@
// //
// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment // ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
// //
#define PCBvInPortB(dwIOAddress, pbyData) { \ #define PCBvInPortB(dwIOAddress, pbyData) \
*(pbyData) = inb(dwIOAddress); \ do { \
} *(pbyData) = inb(dwIOAddress); \
} while (0)
#define PCBvInPortW(dwIOAddress, pwData) { \
*(pwData) = inw(dwIOAddress); \ #define PCBvInPortW(dwIOAddress, pwData) \
} do { \
*(pwData) = inw(dwIOAddress); \
#define PCBvInPortD(dwIOAddress, pdwData) { \ } while (0)
*(pdwData) = inl(dwIOAddress); \
} #define PCBvInPortD(dwIOAddress, pdwData) \
do { \
#define PCBvOutPortB(dwIOAddress, byData) { \ *(pdwData) = inl(dwIOAddress); \
outb(byData, dwIOAddress); \ } while (0)
}
#define PCBvOutPortB(dwIOAddress, byData) \
#define PCBvOutPortW(dwIOAddress, wData) { \ outb(byData, dwIOAddress)
outw(wData, dwIOAddress); \
} #define PCBvOutPortW(dwIOAddress, wData) \
outw(wData, dwIOAddress)
#define PCBvOutPortD(dwIOAddress, dwData) { \
outl(dwData, dwIOAddress); \ #define PCBvOutPortD(dwIOAddress, dwData) \
} outl(dwData, dwIOAddress)
#define PCAvDelayByIO(uDelayUnit) \
#define PCAvDelayByIO(uDelayUnit) { \ do { \
unsigned char byData; \ unsigned char byData; \
unsigned long ii; \ unsigned long ii; \
\ \
if (uDelayUnit <= 50) { \ if (uDelayUnit <= 50) { \
udelay(uDelayUnit); \ udelay(uDelayUnit); \
} \ } else { \
else { \ for (ii = 0; ii < (uDelayUnit); ii++) \
for (ii = 0; ii < (uDelayUnit); ii++) \ byData = inb(0x61); \
byData = inb(0x61); \ } \
} \ } while (0)
}
/*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Classes ----------------------------*/
......
...@@ -83,12 +83,13 @@ ...@@ -83,12 +83,13 @@
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) \
if ((uVar) >= ((uModulo) - 1)) \ do { \
(uVar) = 0; \ if ((uVar) >= ((uModulo) - 1)) \
else \ (uVar) = 0; \
(uVar)++; \ else \
} (uVar)++; \
} while (0)
/*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Classes ----------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment