From: Niklas Cassel <cassel@kernel.org>
To: dlemoal@kernel.org
Cc: linux-ide@vger.kernel.org, wolf@yoxt.cc,
Niklas Cassel <cassel@kernel.org>
Subject: [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute
Date: Mon, 12 Jan 2026 13:20:48 +0100 [thread overview]
Message-ID: <20260112122044.143637-11-cassel@kernel.org> (raw)
In-Reply-To: <20260112122044.143637-8-cassel@kernel.org>
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: 0060beec0bfa ("ata: libata-sata: Add link_power_management_supported sysfs attribute")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/ata/libata-sata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index b2817a2995d6..04e1e774645e 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -909,7 +909,7 @@ static bool ata_scsi_lpm_supported(struct ata_port *ap)
struct ata_link *link;
struct ata_device *dev;
- if (ap->flags & ATA_FLAG_NO_LPM)
+ if ((ap->flags & ATA_FLAG_NO_LPM) || !ap->ops->set_lpm)
return false;
ata_for_each_link(link, ap, EDGE) {
--
2.52.0
next prev parent reply other threads:[~2026-01-12 12:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 12:20 [PATCH v2 0/6] misc LPM related fixes Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 1/6] ata: ahci: Do not read the per port area for unimplemented ports Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 2/6] ata: libata: Call ata_dev_config_lpm() for ATAPI devices Niklas Cassel
2026-01-12 12:20 ` Niklas Cassel [this message]
2026-01-12 13:17 ` [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute Damien Le Moal
2026-01-12 14:39 ` Niklas Cassel
2026-01-12 15:05 ` Damien Le Moal
2026-01-12 15:08 ` Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 4/6] ata: libata: Add cpr_log to ata_dev_print_features() early return Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 5/6] ata: libata: Add DIPM and HIPM " Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 6/6] ata: libata: Print features also for ATAPI devices Niklas Cassel
2026-01-12 16:12 ` [PATCH v2 0/6] misc LPM related fixes wolf
2026-01-13 10:02 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260112122044.143637-11-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=wolf@yoxt.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox