Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e42837bc authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds
Browse files

freezer: introduce freezer-friendly waiting macros



Introduce freezer-friendly wrappers around wait_event_interruptible() and
wait_event_interruptible_timeout(), originally defined in <linux/wait.h>, to
be used in freezable kernel threads.  Make some of the freezable kernel
threads use them.

This is necessary for the freezer to stop sending signals to kernel threads,
which is implemented in the next patch.

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2e131895
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -448,9 +448,8 @@ static int gameport_thread(void *nothing)
	set_freezable();
	do {
		gameport_handle_event();
		wait_event_interruptible(gameport_wait,
		wait_event_freezable(gameport_wait,
			kthread_should_stop() || !list_empty(&gameport_event_list));
		try_to_freeze();
	} while (!kthread_should_stop());

	printk(KERN_DEBUG "gameport: kgameportd exiting\n");
+1 −2
Original line number Diff line number Diff line
@@ -387,9 +387,8 @@ static int serio_thread(void *nothing)
	set_freezable();
	do {
		serio_handle_event();
		wait_event_interruptible(serio_wait,
		wait_event_freezable(serio_wait,
			kthread_should_stop() || !list_empty(&serio_event_list));
		try_to_freeze();
	} while (!kthread_should_stop());

	printk(KERN_DEBUG "serio: kseriod exiting\n");
+1 −2
Original line number Diff line number Diff line
@@ -333,10 +333,9 @@ static int ucb1400_ts_thread(void *_ucb)
			timeout = msecs_to_jiffies(10);
		}

		wait_event_interruptible_timeout(ucb->ts_wait,
		wait_event_freezable_timeout(ucb->ts_wait,
			ucb->irq_pending || ucb->ts_restart || kthread_should_stop(),
			timeout);
		try_to_freeze();
	}

	/* Send the "pen off" if we are stopping with the pen still active */
+2 −1
Original line number Diff line number Diff line
@@ -527,7 +527,8 @@ static int dvb_frontend_thread(void *data)
		up(&fepriv->sem);	    /* is locked when we enter the thread... */
restart:
		timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
			dvb_frontend_should_wakeup(fe) || kthread_should_stop(),
			dvb_frontend_should_wakeup(fe) || kthread_should_stop()
				|| freezing(current),
			fepriv->delay);

		if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
+1 −2
Original line number Diff line number Diff line
@@ -2870,10 +2870,9 @@ static int hub_thread(void *__unused)
	set_freezable();
	do {
		hub_events();
		wait_event_interruptible(khubd_wait,
		wait_event_freezable(khubd_wait,
				!list_empty(&hub_event_list) ||
				kthread_should_stop());
		try_to_freeze();
	} while (!kthread_should_stop() || !list_empty(&hub_event_list));

	pr_debug("%s: khubd exiting\n", usbcore_name);
Loading