PM: sleep: core: Drop racy and redundant checks from device_prepare()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 29 Mar 2020 14:11:18 +0000 (16:11 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 1 Apr 2020 09:38:49 +0000 (11:38 +0200)
commitb5252a6cbbdaefb2648abe8807beda8a28ec7603
tree15d9a5b183e146696dc2ca542b00e918cdd30edb
parent3704a6a445790e6621c19be25d85dfadbeb16a69
PM: sleep: core: Drop racy and redundant checks from device_prepare()

Alan Stern points out that the WARN_ON() check in device_prepare()
is racy (because the PM-runtime API can be disabled briefly for any
device at any time and system suspend can start at any time too) and
the pm_runtime_suspended() check in the computation of the
direct_complete flag value is redundant (because it will be
repeated later anyway).

Drop both these checks accordingly.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/main.c