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

Commit 71be2114 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

PM / freezer: Clean up code after recent fixes



Clean up the code in process.c after recent changes to get rid of
unnecessary labels and goto statements.

Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a28e785a
Loading
Loading
Loading
Loading
+16 −15
Original line number Original line Diff line number Diff line
@@ -108,25 +108,27 @@ static int try_to_freeze_tasks(bool user_only)
	return todo ? -EBUSY : 0;
	return todo ? -EBUSY : 0;
}
}


static bool __check_frozen_processes(void)
{
	struct task_struct *g, *p;

	for_each_process_thread(g, p)
		if (p != current && !freezer_should_skip(p) && !frozen(p))
			return false;

	return true;
}

/*
/*
 * Returns true if all freezable tasks (except for current) are frozen already
 * Returns true if all freezable tasks (except for current) are frozen already
 */
 */
static bool check_frozen_processes(void)
static bool check_frozen_processes(void)
{
{
	struct task_struct *g, *p;
	bool ret;
	bool ret = true;


	read_lock(&tasklist_lock);
	read_lock(&tasklist_lock);
	for_each_process_thread(g, p) {
	ret = __check_frozen_processes();
		if (p != current && !freezer_should_skip(p) &&
		    !frozen(p)) {
			ret = false;
			goto done;
		}
	}
done:
	read_unlock(&tasklist_lock);
	read_unlock(&tasklist_lock);

	return ret;
	return ret;
}
}


@@ -171,11 +173,10 @@ int freeze_processes(void)
			__usermodehelper_set_disable_depth(UMH_ENABLED);
			__usermodehelper_set_disable_depth(UMH_ENABLED);
			printk("OOM in progress.");
			printk("OOM in progress.");
			error = -EBUSY;
			error = -EBUSY;
			goto done;
		} else {
		}
			printk("done.");
			printk("done.");
		}
		}
done:
	}
	printk("\n");
	printk("\n");
	BUG_ON(in_atomic());
	BUG_ON(in_atomic());