]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ata: libata-sata: Add link_power_management_supported sysfs attribute
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 28 Jul 2025 04:04:29 +0000 (13:04 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:36:35 +0000 (18:36 +0200)
commitb4f7089949b8a1000df7d54cfc3729a0e768c52a
treeb4edcd1b3d558ddc8275faad5ecac5f774085b9e
parent0757df22c2326c377b9b7190d9d25a6129dc0177
ata: libata-sata: Add link_power_management_supported sysfs attribute

commit 0060beec0bfa647c4b510df188b1c4673a197839 upstream.

A port link power management (LPM) policy can be controlled using the
link_power_management_policy sysfs host attribute. However, this
attribute exists also for hosts that do not support LPM and in such
case, attempting to change the LPM policy for the host (port) will fail
with -EOPNOTSUPP.

Introduce the new sysfs link_power_management_supported host attribute
to indicate to the user if a the port and the devices connected to the
port for the host support LPM, which implies that the
link_power_management_policy attribute can be used.

Since checking that a port and its devices support LPM is common between
the new ata_scsi_lpm_supported_show() function and the existing
ata_scsi_lpm_store() function, the new helper ata_scsi_lpm_supported()
is introduced.

Fixes: 413e800cadbf ("ata: libata-sata: Disallow changing LPM state if not supported")
Reported-by: Borah, Chaitanya Kumar <chaitanya.kumar.borah@intel.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202507251014.a5becc3b-lkp@intel.com
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/ata_piix.c
drivers/ata/libahci.c
drivers/ata/libata-sata.c
include/linux/libata.h