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

Merge back earlier material related to system sleep for 6.18

parents 449c9c02 be82483d
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -724,8 +724,20 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy
	if (dev->power.syscore || dev->power.direct_complete)
		goto Out;

	if (!dev->power.is_noirq_suspended)
	if (!dev->power.is_noirq_suspended) {
		/*
		 * This means that system suspend has been aborted in the noirq
		 * phase before invoking the noirq suspend callback for the
		 * device, so if device_suspend_late() has left it in suspend,
		 * device_resume_early() should leave it in suspend either in
		 * case the early resume of it depends on the noirq resume that
		 * has not run.
		 */
		if (dev_pm_skip_suspend(dev))
			dev->power.must_resume = false;

		goto Out;
	}

	if (!dpm_wait_for_superior(dev, async))
		goto Out;
+0 −1
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ int freeze_processes(void)
	if (!pm_freezing)
		static_branch_inc(&freezer_active);

	pm_wakeup_clear(0);
	pm_freezing = true;
	error = try_to_freeze_tasks(true);
	if (!error)
+1 −1
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ static void *chain_alloc(struct chain_allocator *ca, unsigned int size)
 *
 * One radix tree is represented by one struct mem_zone_bm_rtree. There are
 * two linked lists for the nodes of the tree, one for the inner nodes and
 * one for the leave nodes. The linked leave nodes are used for fast linear
 * one for the leaf nodes. The linked leaf nodes are used for fast linear
 * access of the memory bitmap.
 *
 * The struct rtree_node represents one node of the radix tree.
+1 −0
Original line number Diff line number Diff line
@@ -595,6 +595,7 @@ static int enter_state(suspend_state_t state)
	}

	pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
	pm_wakeup_clear(0);
	pm_suspend_clear_flags();
	error = suspend_prepare(state);
	if (error)
+3 −3
Original line number Diff line number Diff line
@@ -712,7 +712,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
		goto out_clean;
	}

	data = vzalloc(array_size(nr_threads, sizeof(*data)));
	data = vcalloc(nr_threads, sizeof(*data));
	if (!data) {
		pr_err("Failed to allocate %s data\n", hib_comp_algo);
		ret = -ENOMEM;
@@ -1225,14 +1225,14 @@ static int load_compressed_image(struct swap_map_handle *handle,
	nr_threads = num_online_cpus() - 1;
	nr_threads = clamp_val(nr_threads, 1, CMP_THREADS);

	page = vmalloc(array_size(CMP_MAX_RD_PAGES, sizeof(*page)));
	page = vmalloc_array(CMP_MAX_RD_PAGES, sizeof(*page));
	if (!page) {
		pr_err("Failed to allocate %s page\n", hib_comp_algo);
		ret = -ENOMEM;
		goto out_clean;
	}

	data = vzalloc(array_size(nr_threads, sizeof(*data)));
	data = vcalloc(nr_threads, sizeof(*data));
	if (!data) {
		pr_err("Failed to allocate %s data\n", hib_comp_algo);
		ret = -ENOMEM;