From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: linux-ide@vger.kernel.org, wolf@yoxt.cc
Subject: Re: [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute
Date: Mon, 12 Jan 2026 14:17:14 +0100 [thread overview]
Message-ID: <5b945fcf-059d-409c-9475-630483c14a5e@kernel.org> (raw)
In-Reply-To: <20260112122044.143637-11-cassel@kernel.org>
On 1/12/26 13:20, Niklas Cassel wrote:
> 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)
Can't we set ATA_FLAG_NO_LPM for ports that do not have set_lpm implemented
earlier when scanning ? That would be safer.
> return false;
>
> ata_for_each_link(link, ap, EDGE) {
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-01-12 13:17 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 ` [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute Niklas Cassel
2026-01-12 13:17 ` Damien Le Moal [this message]
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=5b945fcf-059d-409c-9475-630483c14a5e@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@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