On 9/26/23 07:51, Bart Van Assche wrote:
On 9/25/23 23:00, Damien Le Moal wrote:
But as mentioned before, these are PM internal and should not be
touched without the device lock held. So the little "suspended" flag
simplifies things a lot.
Hmm ... I think there is plenty of code in the Linux kernel that reads
variables that can be modified by another thread without using locking.
Hasn't the READ_ONCE() macro been introduced for this purpose? Anyway, I
don't have a strong opinion about whether to read directly from the
scsi_device->power data structure or whether to introduce the new
'suspended' member.
(replying to my own email)
I think we need the new 'suspended' flag. device_resume(), a function
executed during system-wide resume, executes the following code whether
or not resuming succeeds:
dev->power.is_suspended = false;
Bart.