regmap-irq: Remove unused mask_invert flag
[sfrench/cifs-2.6.git] / include / linux / serdev.h
index 66f624fc618ca3bb4d216a8dba8615af84c911d1..5f6bfe4f6d9551ffd3dfe1bf364dcbd7d6f92b0d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/types.h>
 #include <linux/device.h>
+#include <linux/iopoll.h>
 #include <linux/uaccess.h>
 #include <linux/termios.h>
 #include <linux/delay.h>
@@ -279,18 +280,10 @@ static inline bool serdev_device_get_cts(struct serdev_device *serdev)
 
 static inline int serdev_device_wait_for_cts(struct serdev_device *serdev, bool state, int timeout_ms)
 {
-       unsigned long timeout;
        bool signal;
 
-       timeout = jiffies + msecs_to_jiffies(timeout_ms);
-       while (time_is_after_jiffies(timeout)) {
-               signal = serdev_device_get_cts(serdev);
-               if (signal == state)
-                       return 0;
-               usleep_range(1000, 2000);
-       }
-
-       return -ETIMEDOUT;
+       return readx_poll_timeout(serdev_device_get_cts, serdev, signal, signal == state,
+                                 2000, timeout_ms * 1000);
 }
 
 static inline int serdev_device_set_rts(struct serdev_device *serdev, bool enable)