Skip to content

Commit ce83767

Browse files
floatiousdamien-lemoal
authored andcommitted
ata: libata-sata: Improve link_power_management_supported sysfs attribute
The link_power_management_supported sysfs attribute is currently set as true even for ata ports that lack a .set_lpm() callback, e.g. dummy ports. This is a bit silly, because while writing to the link_power_management_policy sysfs attribute will make ata_scsi_lpm_store() update ap->target_lpm_policy (thus sysfs will reflect the new value) and call ata_port_schedule_eh() for the port, it is essentially a no-op. This is because for a port without a .set_lpm() callback, once EH gets to run, the ata_eh_link_set_lpm() will simply return, since the port does not provide a .set_lpm() callback. Thus, make sure that the link_power_management_supported sysfs attribute is set to false for ports that lack a .set_lpm() callback. This way the link_power_management_policy sysfs attribute will no longer be writable, so we will no longer be misleading users to think that their sysfs write actually does something. Fixes: 0060bee ("ata: libata-sata: Add link_power_management_supported sysfs attribute") Signed-off-by: Niklas Cassel <cassel@kernel.org> Tested-by: Wolf <wolf@yoxt.cc> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
1 parent 8f3fb33 commit ce83767

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/ata/libata-sata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static bool ata_scsi_lpm_supported(struct ata_port *ap)
909909
struct ata_link *link;
910910
struct ata_device *dev;
911911

912-
if (ap->flags & ATA_FLAG_NO_LPM)
912+
if ((ap->flags & ATA_FLAG_NO_LPM) || !ap->ops->set_lpm)
913913
return false;
914914

915915
ata_for_each_link(link, ap, EDGE) {

0 commit comments

Comments
 (0)