aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-12-06 16:12:50 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-06 16:12:50 -0500
commit2e8e89e392c62636ee33532358607baef2863173 (patch)
treed995a25c68eef57dea580b0f06ba8af76758775a /drivers
parent0c6aebe31861c470c8cfbfdfdfd72d1369a6440b (diff)
parentd310310cbff18ec385c6ab4d58f33b100192a96a (diff)
Merge branch 'pm-freezer' into pm-sleep
* pm-freezer: (26 commits) Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer Freezer: fix more fallout from the thaw_process rename freezer: fix wait_event_freezable/__thaw_task races freezer: kill unused set_freezable_with_signal() dmatest: don't use set_freezable_with_signal() usb_storage: don't use set_freezable_with_signal() freezer: remove unused @sig_only from freeze_task() freezer: use lock_task_sighand() in fake_signal_wake_up() freezer: restructure __refrigerator() freezer: fix set_freezable[_with_signal]() race freezer: remove should_send_signal() and update frozen() freezer: remove now unused TIF_FREEZE freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE cgroup_freezer: prepare for removal of TIF_FREEZE freezer: clean up freeze_processes() failure path freezer: kill PF_FREEZING freezer: test freezable conditions while holding freezer_lock freezer: make freezing indicate freeze condition in effect freezer: use dedicated lock instead of task_lock() + memory barrier freezer: don't distinguish nosig tasks on thaw ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/btmrvl_main.c2
-rw-r--r--drivers/dma/dmatest.c46
-rw-r--r--drivers/mfd/twl6030-irq.c2
-rw-r--r--drivers/net/irda/stir4200.c2
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c15
-rw-r--r--drivers/staging/rts_pstor/rtsx.c2
-rw-r--r--drivers/usb/storage/usb.c13
7 files changed, 41 insertions, 41 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index a88a78c86162..6c3defa50845 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -475,8 +475,6 @@ static int btmrvl_service_main_thread(void *data)
475 475
476 init_waitqueue_entry(&wait, current); 476 init_waitqueue_entry(&wait, current);
477 477
478 current->flags |= PF_NOFREEZE;
479
480 for (;;) { 478 for (;;) {
481 add_wait_queue(&thread->wait_q, &wait); 479 add_wait_queue(&thread->wait_q, &wait);
482 480
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index eb1d8641cf5c..2b8661b54eaf 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -214,9 +214,18 @@ static unsigned int dmatest_verify(u8 **bufs, unsigned int start,
214 return error_count; 214 return error_count;
215} 215}
216 216
217static void dmatest_callback(void *completion) 217/* poor man's completion - we want to use wait_event_freezable() on it */
218struct dmatest_done {
219 bool done;
220 wait_queue_head_t *wait;
221};
222
223static void dmatest_callback(void *arg)
218{ 224{
219 complete(completion); 225 struct dmatest_done *done = arg;
226
227 done->done = true;
228 wake_up_all(done->wait);
220} 229}
221 230
222/* 231/*
@@ -235,7 +244,9 @@ static void dmatest_callback(void *completion)
235 */ 244 */
236static int dmatest_func(void *data) 245static int dmatest_func(void *data)
237{ 246{
247 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_wait);
238 struct dmatest_thread *thread = data; 248 struct dmatest_thread *thread = data;
249 struct dmatest_done done = { .wait = &done_wait };
239 struct dma_chan *chan; 250 struct dma_chan *chan;
240 const char *thread_name; 251 const char *thread_name;
241 unsigned int src_off, dst_off, len; 252 unsigned int src_off, dst_off, len;
@@ -252,7 +263,7 @@ static int dmatest_func(void *data)
252 int i; 263 int i;
253 264
254 thread_name = current->comm; 265 thread_name = current->comm;
255 set_freezable_with_signal(); 266 set_freezable();
256 267
257 ret = -ENOMEM; 268 ret = -ENOMEM;
258 269
@@ -306,9 +317,6 @@ static int dmatest_func(void *data)
306 struct dma_async_tx_descriptor *tx = NULL; 317 struct dma_async_tx_descriptor *tx = NULL;
307 dma_addr_t dma_srcs[src_cnt]; 318 dma_addr_t dma_srcs[src_cnt];
308 dma_addr_t dma_dsts[dst_cnt]; 319 dma_addr_t dma_dsts[dst_cnt];
309 struct completion cmp;
310 unsigned long start, tmo, end = 0 /* compiler... */;
311 bool reload = true;
312 u8 align = 0; 320 u8 align = 0;
313 321
314 total_tests++; 322 total_tests++;
@@ -391,9 +399,9 @@ static int dmatest_func(void *data)
391 continue; 399 continue;
392 } 400 }
393 401
394 init_completion(&cmp); 402 done.done = false;
395 tx->callback = dmatest_callback; 403 tx->callback = dmatest_callback;
396 tx->callback_param = &cmp; 404 tx->callback_param = &done;
397 cookie = tx->tx_submit(tx); 405 cookie = tx->tx_submit(tx);
398 406
399 if (dma_submit_error(cookie)) { 407 if (dma_submit_error(cookie)) {
@@ -407,20 +415,20 @@ static int dmatest_func(void *data)
407 } 415 }
408 dma_async_issue_pending(chan); 416 dma_async_issue_pending(chan);
409 417
410 do { 418 wait_event_freezable_timeout(done_wait, done.done,
411 start = jiffies; 419 msecs_to_jiffies(timeout));
412 if (reload)
413 end = start + msecs_to_jiffies(timeout);
414 else if (end <= start)
415 end = start + 1;
416 tmo = wait_for_completion_interruptible_timeout(&cmp,
417 end - start);
418 reload = try_to_freeze();
419 } while (tmo == -ERESTARTSYS);
420 420
421 status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); 421 status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
422 422
423 if (tmo == 0) { 423 if (!done.done) {
424 /*
425 * We're leaving the timed out dma operation with
426 * dangling pointer to done_wait. To make this
427 * correct, we'll need to allocate wait_done for
428 * each test iteration and perform "who's gonna
429 * free it this time?" dancing. For now, just
430 * leave it dangling.
431 */
424 pr_warning("%s: #%u: test timed out\n", 432 pr_warning("%s: #%u: test timed out\n",
425 thread_name, total_tests - 1); 433 thread_name, total_tests - 1);
426 failed_tests++; 434 failed_tests++;
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index 3eee45ffb096..c6b456ad7342 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -138,8 +138,6 @@ static int twl6030_irq_thread(void *data)
138 static const unsigned max_i2c_errors = 100; 138 static const unsigned max_i2c_errors = 100;
139 int ret; 139 int ret;
140 140
141 current->flags |= PF_NOFREEZE;
142
143 while (!kthread_should_stop()) { 141 while (!kthread_should_stop()) {
144 int i; 142 int i;
145 union { 143 union {
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 41c96b3d8152..e880c79d7bd8 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -750,7 +750,7 @@ static int stir_transmit_thread(void *arg)
750 750
751 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD); 751 write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
752 752
753 refrigerator(); 753 try_to_freeze();
754 754
755 if (change_speed(stir, stir->speed)) 755 if (change_speed(stir, stir->speed))
756 break; 756 break;
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 7b828680b21d..4b11fc91fa7d 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2456,8 +2456,9 @@ static int hotkey_kthread(void *data)
2456 u32 poll_mask, event_mask; 2456 u32 poll_mask, event_mask;
2457 unsigned int si, so; 2457 unsigned int si, so;
2458 unsigned long t; 2458 unsigned long t;
2459 unsigned int change_detector, must_reset; 2459 unsigned int change_detector;
2460 unsigned int poll_freq; 2460 unsigned int poll_freq;
2461 bool was_frozen;
2461 2462
2462 mutex_lock(&hotkey_thread_mutex); 2463 mutex_lock(&hotkey_thread_mutex);
2463 2464
@@ -2488,14 +2489,14 @@ static int hotkey_kthread(void *data)
2488 t = 100; /* should never happen... */ 2489 t = 100; /* should never happen... */
2489 } 2490 }
2490 t = msleep_interruptible(t); 2491 t = msleep_interruptible(t);
2491 if (unlikely(kthread_should_stop())) 2492 if (unlikely(kthread_freezable_should_stop(&was_frozen)))
2492 break; 2493 break;
2493 must_reset = try_to_freeze(); 2494
2494 if (t > 0 && !must_reset) 2495 if (t > 0 && !was_frozen)
2495 continue; 2496 continue;
2496 2497
2497 mutex_lock(&hotkey_thread_data_mutex); 2498 mutex_lock(&hotkey_thread_data_mutex);
2498 if (must_reset || hotkey_config_change != change_detector) { 2499 if (was_frozen || hotkey_config_change != change_detector) {
2499 /* forget old state on thaw or config change */ 2500 /* forget old state on thaw or config change */
2500 si = so; 2501 si = so;
2501 t = 0; 2502 t = 0;
@@ -2528,10 +2529,6 @@ exit:
2528static void hotkey_poll_stop_sync(void) 2529static void hotkey_poll_stop_sync(void)
2529{ 2530{
2530 if (tpacpi_hotkey_task) { 2531 if (tpacpi_hotkey_task) {
2531 if (frozen(tpacpi_hotkey_task) ||
2532 freezing(tpacpi_hotkey_task))
2533 thaw_process(tpacpi_hotkey_task);
2534
2535 kthread_stop(tpacpi_hotkey_task); 2532 kthread_stop(tpacpi_hotkey_task);
2536 tpacpi_hotkey_task = NULL; 2533 tpacpi_hotkey_task = NULL;
2537 mutex_lock(&hotkey_thread_mutex); 2534 mutex_lock(&hotkey_thread_mutex);
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c
index 480b0ed2e4de..8a7803cf88d2 100644
--- a/drivers/staging/rts_pstor/rtsx.c
+++ b/drivers/staging/rts_pstor/rtsx.c
@@ -466,8 +466,6 @@ static int rtsx_control_thread(void *__dev)
466 struct rtsx_chip *chip = dev->chip; 466 struct rtsx_chip *chip = dev->chip;
467 struct Scsi_Host *host = rtsx_to_host(dev); 467 struct Scsi_Host *host = rtsx_to_host(dev);
468 468
469 current->flags |= PF_NOFREEZE;
470
471 for (;;) { 469 for (;;) {
472 if (wait_for_completion_interruptible(&dev->cmnd_ready)) 470 if (wait_for_completion_interruptible(&dev->cmnd_ready))
473 break; 471 break;
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c325e69415a1..aa84b3d77274 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -831,7 +831,8 @@ static int usb_stor_scan_thread(void * __us)
831 831
832 dev_dbg(dev, "device found\n"); 832 dev_dbg(dev, "device found\n");
833 833
834 set_freezable_with_signal(); 834 set_freezable();
835
835 /* 836 /*
836 * Wait for the timeout to expire or for a disconnect 837 * Wait for the timeout to expire or for a disconnect
837 * 838 *
@@ -839,16 +840,16 @@ static int usb_stor_scan_thread(void * __us)
839 * fail to freeze, but we can't be non-freezable either. Nor can 840 * fail to freeze, but we can't be non-freezable either. Nor can
840 * khubd freeze while waiting for scanning to complete as it may 841 * khubd freeze while waiting for scanning to complete as it may
841 * hold the device lock, causing a hang when suspending devices. 842 * hold the device lock, causing a hang when suspending devices.
842 * So we request a fake signal when freezing and use 843 * So instead of using wait_event_freezable(), explicitly test
843 * interruptible sleep to kick us out of our wait early when 844 * for (DONT_SCAN || freezing) in interruptible wait and proceed
844 * freezing happens. 845 * if any of DONT_SCAN, freezing or timeout has happened.
845 */ 846 */
846 if (delay_use > 0) { 847 if (delay_use > 0) {
847 dev_dbg(dev, "waiting for device to settle " 848 dev_dbg(dev, "waiting for device to settle "
848 "before scanning\n"); 849 "before scanning\n");
849 wait_event_interruptible_timeout(us->delay_wait, 850 wait_event_interruptible_timeout(us->delay_wait,
850 test_bit(US_FLIDX_DONT_SCAN, &us->dflags), 851 test_bit(US_FLIDX_DONT_SCAN, &us->dflags) ||
851 delay_use * HZ); 852 freezing(current), delay_use * HZ);
852 } 853 }
853 854
854 /* If the device is still connected, perform the scanning */ 855 /* If the device is still connected, perform the scanning */