Commit 3a7cbd50 authored by Tejun Heo's avatar Tejun Heo

freezer: don't unnecessarily set PF_NOFREEZE explicitly

Some drivers set PF_NOFREEZE in their kthread functions which is
completely unnecessary and racy - some part of freezer code doesn't
consider cases where PF_NOFREEZE is set asynchronous to freezer
operations.

In general, there's no reason to allow setting PF_NOFREEZE explicitly.
Remove them and change the documentation to note that setting
PF_NOFREEZE directly isn't allowed.

-v2: Dropped change to twl4030-irq.c as it no longer uses PF_NOFREEZE.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatar"Gustavo F. Padovan" <padovan@profusion.mobi>
Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: wwang <wei_wang@realsil.com.cn>
parent 50fb4f7f
...@@ -67,7 +67,7 @@ III. Which kernel threads are freezable? ...@@ -67,7 +67,7 @@ III. Which kernel threads are freezable?
Kernel threads are not freezable by default. However, a kernel thread may clear Kernel threads are not freezable by default. However, a kernel thread may clear
PF_NOFREEZE for itself by calling set_freezable() (the resetting of PF_NOFREEZE PF_NOFREEZE for itself by calling set_freezable() (the resetting of PF_NOFREEZE
directly is strongly discouraged). From this point it is regarded as freezable directly is not allowed). From this point it is regarded as freezable
and must call try_to_freeze() in a suitable place. and must call try_to_freeze() in a suitable place.
IV. Why do we do that? IV. Why do we do that?
......
...@@ -475,8 +475,6 @@ static int btmrvl_service_main_thread(void *data) ...@@ -475,8 +475,6 @@ static int btmrvl_service_main_thread(void *data)
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
current->flags |= PF_NOFREEZE;
for (;;) { for (;;) {
add_wait_queue(&thread->wait_q, &wait); add_wait_queue(&thread->wait_q, &wait);
......
...@@ -138,8 +138,6 @@ static int twl6030_irq_thread(void *data) ...@@ -138,8 +138,6 @@ static int twl6030_irq_thread(void *data)
static const unsigned max_i2c_errors = 100; static const unsigned max_i2c_errors = 100;
int ret; int ret;
current->flags |= PF_NOFREEZE;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
int i; int i;
union { union {
......
...@@ -466,8 +466,6 @@ static int rtsx_control_thread(void *__dev) ...@@ -466,8 +466,6 @@ static int rtsx_control_thread(void *__dev)
struct rtsx_chip *chip = dev->chip; struct rtsx_chip *chip = dev->chip;
struct Scsi_Host *host = rtsx_to_host(dev); struct Scsi_Host *host = rtsx_to_host(dev);
current->flags |= PF_NOFREEZE;
for (;;) { for (;;) {
if (wait_for_completion_interruptible(&dev->cmnd_ready)) if (wait_for_completion_interruptible(&dev->cmnd_ready))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment