Re: [PATCH 2/4] libata: don't wake sleeping disk during system suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/5/24 07:39, Phillip Susi wrote:
> When suspending the system, libata puts the drive in standby mode to
> prepare it to lose power.  If the drive is in SLEEP mode, this spins it up
> only to spin it back down again.  Don't do that.
> ---
>  drivers/ata/libata-core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index a2d8cc0097a8..1244da8f77e2 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -2030,6 +2030,10 @@ void ata_dev_power_set_standby(struct ata_device *dev)
>  	    system_entering_hibernation())
>  		return;
>  
> +	/* no need to standby if it is alreqady sleeping */

s/alreqady/already

The comment should also be improved. It is more than a "no need" given that a
sleeping disk will not respond to any command... So something like:

	/*
	 * If the devices is in SLEEP state, issuing a STANDBY IMMEDIATE
	 * command will fail. But given that the drive is already in a low
	 * power state, we do not need to do anything.
	 */

> +	if (dev->flags & ATA_DFLAG_SLEEPING)
> +		return;
> +
>  	/* Issue STANDBY IMMEDIATE command only if supported by the device */
>  	if (!ata_dev_power_init_tf(dev, &tf, false))
>  		return;

Other than the above comments, this looks OK. And this probably should go first
in the series with a fixes tag.

-- 
Damien Le Moal
Western Digital Research





[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux