On 9/25/23 23:00, Damien Le Moal wrote:
It seems that you are suggesting that we should use some information from the scsi_device->power structure to detect the suspended state...
Yes, that's indeed what I'm suggesting.
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. Thanks, Bart.