usb: ueagle-atm: Use wait_event_freezable_timeout() in uea_wait()

JIRA: https://issues.redhat.com/browse/RHEL-34114

commit 738ec5ab7acca7ee5856e36a5a6a0c41201fe88f
Author: Kevin Hao <haokexin@gmail.com>
Date: Mon, 18 Dec 2023 15:47:30 +0800

  A freezable kernel thread can enter frozen state during freezing by
  either calling try_to_freeze() or using wait_event_freezable() and its
  variants. So for the following snippet of code in a kernel thread loop:
    wait_event_interruptible_timeout();
    try_to_freeze();

  We can change it to a simple wait_event_freezable_timeout() and
  then eliminate a function call.

  Signed-off-by: Kevin Hao <haokexin@gmail.com>
  Link: https://lore.kernel.org/r/20231218074730.1898699-1-haokexin@gmail.com
  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
This commit is contained in:
Desnes Nunes 2024-05-17 12:00:09 -03:00
parent 752ebaf8bd
commit 0dc5772a56
1 changed files with 1 additions and 2 deletions

View File

@ -546,7 +546,7 @@ MODULE_PARM_DESC(annex,
#define uea_wait(sc, cond, timeo) \
({ \
int _r = wait_event_interruptible_timeout(sc->sync_q, \
int _r = wait_event_freezable_timeout(sc->sync_q, \
(cond) || kthread_should_stop(), timeo); \
if (kthread_should_stop()) \
_r = -ENODEV; \
@ -1896,7 +1896,6 @@ static int uea_kthread(void *data)
ret = sc->stat(sc);
if (ret != -EAGAIN)
uea_wait(sc, 0, msecs_to_jiffies(1000));
try_to_freeze();
}
uea_leaves(INS_TO_USBDEV(sc));
return ret;