summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6655/upc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6655/upc.h')
-rw-r--r--drivers/staging/vt6655/upc.h187
1 files changed, 89 insertions, 98 deletions
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 9596fdef0e3c..155e66439073 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -34,39 +34,35 @@
/*--------------------- Export Definitions -------------------------*/
-
//
// For IO mapped
//
#ifdef IO_MAP
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
-
-
-#define VNSvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
-
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
+#define VNSvInPortB(dwIOAddress, pbyData) \
+do { \
+ *(pbyData) = inb(dwIOAddress); \
+} while (0)
+#define VNSvInPortW(dwIOAddress, pwData) \
+do { \
+ *(pwData) = inw(dwIOAddress); \
+} while (0)
-#define VNSvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
+#define VNSvInPortD(dwIOAddress, pdwData) \
+do { \
+ *(pdwData) = inl(dwIOAddress); \
+} while (0)
+#define VNSvOutPortB(dwIOAddress, byData) \
+ outb(byData, dwIOAddress)
-#define VNSvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
+#define VNSvOutPortW(dwIOAddress, wData) \
+ outw(wData, dwIOAddress)
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
+#define VNSvOutPortD(dwIOAddress, dwData) \
+ outl(dwData, dwIOAddress)
#else
@@ -74,84 +70,83 @@
// For memory mapped IO
//
-
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- volatile unsigned char * pbyAddr = ((unsigned char *)(dwIOAddress)); \
- *(pbyData) = readb(pbyAddr); \
-}
-
-
-#define VNSvInPortW(dwIOAddress, pwData) { \
- volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
- *(pwData) = readw(pwAddr); \
-}
-
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
- *(pdwData) = readl(pdwAddr); \
-}
-
-
-#define VNSvOutPortB(dwIOAddress, byData) { \
- volatile unsigned char * pbyAddr = ((unsigned char *)(dwIOAddress)); \
- writeb((unsigned char)byData, pbyAddr); \
-}
-
-
-#define VNSvOutPortW(dwIOAddress, wData) { \
- volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
- writew((unsigned short)wData, pwAddr); \
-}
-
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
- writel((unsigned long)dwData, pdwAddr); \
-}
+#define VNSvInPortB(dwIOAddress, pbyData) \
+do { \
+ volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
+ *(pbyData) = readb(pbyAddr); \
+} while (0)
+
+#define VNSvInPortW(dwIOAddress, pwData) \
+do { \
+ volatile unsigned short *pwAddr = (unsigned short *)(dwIOAddress); \
+ *(pwData) = readw(pwAddr); \
+} while (0)
+
+#define VNSvInPortD(dwIOAddress, pdwData) \
+do { \
+ 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 VNSvOutPortW(dwIOAddress, wData) \
+do { \
+ volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
+ writew((unsigned short)wData, pwAddr); \
+} while (0)
+
+#define VNSvOutPortD(dwIOAddress, dwData) \
+do { \
+ volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \
+ writel((unsigned long)dwData, pdwAddr); \
+} while (0)
#endif
-
//
// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
//
-#define PCBvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
-
-#define PCBvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
-
-#define PCBvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
-
-#define PCBvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
-
-#define PCBvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
-
-#define PCBvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
-
-
-#define PCAvDelayByIO(uDelayUnit) { \
- unsigned char byData; \
- unsigned long ii; \
- \
- if (uDelayUnit <= 50) { \
- udelay(uDelayUnit); \
- } \
- else { \
- for (ii = 0; ii < (uDelayUnit); ii++) \
- byData = inb(0x61); \
- } \
-}
-
+#define PCBvInPortB(dwIOAddress, pbyData) \
+do { \
+ *(pbyData) = inb(dwIOAddress); \
+} while (0)
+
+#define PCBvInPortW(dwIOAddress, pwData) \
+do { \
+ *(pwData) = inw(dwIOAddress); \
+} while (0)
+
+#define PCBvInPortD(dwIOAddress, pdwData) \
+do { \
+ *(pdwData) = inl(dwIOAddress); \
+} while (0)
+
+#define PCBvOutPortB(dwIOAddress, byData) \
+ outb(byData, dwIOAddress)
+
+#define PCBvOutPortW(dwIOAddress, wData) \
+ outw(wData, dwIOAddress)
+
+#define PCBvOutPortD(dwIOAddress, dwData) \
+ outl(dwData, dwIOAddress)
+
+#define PCAvDelayByIO(uDelayUnit) \
+do { \
+ unsigned char byData; \
+ unsigned long ii; \
+ \
+ if (uDelayUnit <= 50) { \
+ udelay(uDelayUnit); \
+ } else { \
+ for (ii = 0; ii < (uDelayUnit); ii++) \
+ byData = inb(0x61); \
+ } \
+} while (0)
/*--------------------- Export Classes ----------------------------*/
@@ -159,8 +154,4 @@
/*--------------------- Export Functions --------------------------*/
-
-
-
#endif // __UPC_H__
-