summaryrefslogtreecommitdiff
path: root/drivers/staging/octeon-usb
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2015-03-28 22:24:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-03 14:57:28 +0300
commit203d77621405345c1f3ffc4c1db3f7ff89571b58 (patch)
treead3bca575d3358f821e7435cf23d0999380e4088 /drivers/staging/octeon-usb
parent6068e81879c81f83b1e3dcaa02746b20be2af0c0 (diff)
downloadlinux-203d77621405345c1f3ffc4c1db3f7ff89571b58.tar.xz
staging: octeon-usb: make CVMX_WAIT_FOR_FIELD32 to take condition expression
Make CVMX_WAIT_FOR_FIELD32 to take full condition expression. This should make the usage simpler, and the macro more readable. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/octeon-usb')
-rw-r--r--drivers/staging/octeon-usb/octeon-hcd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 3e89265d10d8..9e5476e352b4 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -393,8 +393,8 @@ struct octeon_hcd {
struct cvmx_usb_state usb;
};
-/* This macro spins on a field waiting for it to reach a value */
-#define CVMX_WAIT_FOR_FIELD32(address, _union, field, op, value, timeout_usec)\
+/* This macro spins on a register waiting for it to reach a condition. */
+#define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec) \
({int result; \
do { \
uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \
@@ -403,7 +403,8 @@ struct octeon_hcd {
\
while (1) { \
c.u32 = cvmx_usb_read_csr32(usb, address); \
- if (c.s.field op (value)) { \
+ \
+ if (cond) { \
result = 0; \
break; \
} else if (cvmx_get_cycle() > done) { \
@@ -652,11 +653,11 @@ static void cvmx_fifo_setup(struct cvmx_usb_state *usb)
USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
cvmx_usbcx_grstctl, txfflsh, 1);
CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
- cvmx_usbcx_grstctl, txfflsh, ==, 0, 100);
+ cvmx_usbcx_grstctl, c.s.txfflsh == 0, 100);
USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
cvmx_usbcx_grstctl, rxfflsh, 1);
CVMX_WAIT_FOR_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
- cvmx_usbcx_grstctl, rxfflsh, ==, 0, 100);
+ cvmx_usbcx_grstctl, c.s.rxfflsh == 0, 100);
}
/**