Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PM: runtime: Stop checking pm_runtime_barrier() return code

Apparently this test is the only code that checks the return code from
pm_runtime_barrier(), and it turns out that's for good reason -- it's
inherently racy, and a bad idea. We're going to make
pm_runtime_barrier() return void, so prepare for that by dropping any
return code checks.

This resolves some test failures seen like the following:

[ 34.559694] # pm_runtime_error_test: EXPECTATION FAILED at drivers/base/power/runtime-test.c:177
[ 34.559694] Expected 1 == pm_runtime_barrier(dev), but
[ 34.559694] pm_runtime_barrier(dev) == 0 (0x0)
[ 34.563604] # pm_runtime_error_test: pass:0 fail:1 skip:0 total:1

Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/lkml/93259f2b-7017-4096-a31b-cabbf6152e9b@roeck-us.net/
Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20251202193129.1411419-1-briannorris@chromium.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Brian Norris and committed by
Rafael J. Wysocki
3df2470a d348c223

+2 -6
+2 -6
drivers/base/power/runtime-test.c
··· 38 38 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); 39 39 40 40 pm_runtime_get_noresume(dev); 41 - KUNIT_EXPECT_EQ(test, 0, pm_runtime_barrier(dev)); /* no wakeup needed */ 42 - pm_runtime_put(dev); 43 - 44 - pm_runtime_get_noresume(dev); 45 41 KUNIT_EXPECT_EQ(test, 1, pm_runtime_put_sync(dev)); 46 42 47 43 KUNIT_EXPECT_EQ(test, 1, pm_runtime_suspend(dev)); ··· 170 174 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); 171 175 172 176 KUNIT_EXPECT_EQ(test, 0, pm_runtime_get(dev)); 173 - KUNIT_EXPECT_EQ(test, 1, pm_runtime_barrier(dev)); /* resume was pending */ 177 + pm_runtime_barrier(dev); 174 178 pm_runtime_put(dev); 175 179 pm_runtime_suspend(dev); /* flush the put(), to suspend */ 176 180 KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev)); ··· 221 225 KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev)); 222 226 223 227 /* Nothing to flush. We stay active. */ 224 - KUNIT_EXPECT_EQ(test, 0, pm_runtime_barrier(dev)); 228 + pm_runtime_barrier(dev); 225 229 KUNIT_EXPECT_TRUE(test, pm_runtime_active(dev)); 226 230 227 231 /* Ask for idle? Now we suspend. */