summaryrefslogtreecommitdiff
path: root/include/linux/serdev.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2022-12-17 01:45:03 +0300
committerAndrew Morton <akpm@linux-foundation.org>2022-12-17 01:45:03 +0300
commit563a5423b7b75e1bee8b91caddf3181cca2a74bd (patch)
tree44fa2159392be20e96434588a866813dc08b11d7 /include/linux/serdev.h
parentf9eeef5918bbe1f2545d36280330dced25d6cf97 (diff)
parent77856d911a8c8724ee8e2b09d55979fc1de8f1c0 (diff)
downloadlinux-563a5423b7b75e1bee8b91caddf3181cca2a74bd.tar.xz
Merge branch 'master' into mm-nonmm-stable
Diffstat (limited to 'include/linux/serdev.h')
-rw-r--r--include/linux/serdev.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index 66f624fc618c..5f6bfe4f6d95 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -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)