powerpc/mpc83xx: Use wait_event_freezable() for freezable kthread
authorKevin Hao <haokexin@gmail.com>
Thu, 21 Dec 2023 04:45:09 +0000 (12:45 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Dec 2023 11:10:16 +0000 (22:10 +1100)
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();
  try_to_freeze();

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

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231221044510.1802429-3-haokexin@gmail.com
arch/powerpc/platforms/83xx/suspend.c

index eed325ed08ccc375673098febb68cb4c309b11b8..c9664e46b03d701901107870db4ddc612b381c72 100644 (file)
@@ -264,8 +264,7 @@ static int agent_thread_fn(void *data)
        set_freezable();
 
        while (1) {
-               wait_event_interruptible(agent_wq, pci_pm_state >= 2);
-               try_to_freeze();
+               wait_event_freezable(agent_wq, pci_pm_state >= 2);
 
                if (signal_pending(current) || pci_pm_state < 2)
                        continue;