summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2025-05-15 15:56:25 +0200
committerDamien Le Moal <dlemoal@kernel.org>2025-05-20 18:20:44 +0900
commit22cfba10dbfb3b4ded7038a543b74110d6d2de85 (patch)
tree5ac874fd0fcc7dd8c2a4582e66a7ae960f823fac
parent62eef53ab5ede2dba18ce4c5e7d031e05ab74025 (diff)
ata: libata-eh: Rename hipm and dipm variables
Rename the hipm and dipm variables to have a clearer name. Also fold in the usage of no_dipm, as that is required in order to give the dipm variable a more descriptive name. No functional change. Signed-off-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
-rw-r--r--drivers/ata/libata-eh.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 89b7b2139a16..dcb449edd315 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3455,22 +3455,23 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
* some devices misbehave when the host NACKs transition to SLUMBER.
*/
ata_for_each_dev(dev, link, ENABLED) {
- bool hipm = ata_id_has_hipm(dev->id);
- bool dipm = ata_id_has_dipm(dev->id) && !no_dipm;
+ bool dev_has_hipm = ata_id_has_hipm(dev->id);
+ bool dev_has_dipm = ata_id_has_dipm(dev->id);
/* find the first enabled and LPM enabled devices */
if (!link_dev)
link_dev = dev;
- if (!lpm_dev && (hipm || dipm))
+ if (!lpm_dev && (dev_has_hipm || (dev_has_dipm && !no_dipm)))
lpm_dev = dev;
hints &= ~ATA_LPM_EMPTY;
- if (!hipm)
+ if (!dev_has_hipm)
hints &= ~ATA_LPM_HIPM;
/* disable DIPM before changing link config */
- if (policy < ATA_LPM_MED_POWER_WITH_DIPM && dipm) {
+ if (policy < ATA_LPM_MED_POWER_WITH_DIPM &&
+ (dev_has_dipm && !no_dipm)) {
err_mask = ata_dev_set_feature(dev,
SETFEATURES_SATA_DISABLE, SATA_DIPM);
if (err_mask && err_mask != AC_ERR_DEV) {
@@ -3517,8 +3518,10 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
* ATA_LPM_MED_POWER_WITH_DIPM.
*/
ata_for_each_dev(dev, link, ENABLED) {
+ bool dev_has_dipm = ata_id_has_dipm(dev->id);
+
if (policy >= ATA_LPM_MED_POWER_WITH_DIPM && !no_dipm &&
- ata_id_has_dipm(dev->id)) {
+ dev_has_dipm) {
err_mask = ata_dev_set_feature(dev,
SETFEATURES_SATA_ENABLE, SATA_DIPM);
if (err_mask && err_mask != AC_ERR_DEV) {