Skip to contentSkip to conversation

scheduler: wait: Added missing include freezer.h

PATCH In review Carmeli Tamir 2 participants 2 messages Oct 26, 2018 – Oct 29, 2018 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scheduler: wait: Added missing include freezer.h

The function 'wait_event_freezable' calls '__wait_event_freezable' that uses 'try_to_freeze', which is defined in freezer.h.
This causes a compilation error for callers of 'wait_event_freezables', forcing them to include also freezer.h.

---
 include/linux/wait.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/wait.h +1 -0
index ed7c122..75061ee 100644
@@ -4,6 +4,7 @@
 /*
  * Linux wait queue related types and methods
  */
+#include <linux/freezer.h>
 #include <linux/list.h>
 #include <linux/stddef.h>
 #include <linux/spinlock.h>
Signature · 1 line
2.7.4
#1 lore raw
Quoted 15 lines · Carmeli Tamir

The function 'wait_event_freezable' calls '__wait_event_freezable' that uses 'try_to_freeze', which is defined in freezer.h.
This causes a compilation error for callers of 'wait_event_freezables', forcing them to include also freezer.h.

---
 include/linux/wait.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/wait.h +0 -0
index ed7c122..75061ee 100644

include/linux/wait.h line 10

Quoted 7 lines
include/linux/wait.h +1 -0
@@ -4,6 +4,7 @@
 /*
  * Linux wait queue related types and methods
  */
+#include <linux/freezer.h>
 #include <linux/list.h>
 #include <linux/stddef.h>
 #include <linux/spinlock.h>

I don't think we should do this, because freezer.h then includes <linux/sched.h> - while much of the point of <linux/wait.h> was to not include the huge chain of dependencies that sched.h invokes...

BTW., another way this could be solved is to uninline try_to_freeze(), it seems a bit large at first sight to be inlined - but I could be wrong.

Once it's not inline we could just add this to wait.h:

  extern bool try_to_freeze(void);

or so. This decouples wait.h from freezer.h.

Thanks,

Ingo