From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: linux-ide@vger.kernel.org
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
Subject: [PATCH 1/2] libata: add power_off policy for unoccupied ports
Date: Thu, 3 Mar 2011 10:21:17 -0800 [thread overview]
Message-ID: <1299176478-2999-2-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <1299176478-2999-1-git-send-email-kristen@linux.intel.com>
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
---
drivers/ata/libata-core.c | 4 ++++
drivers/ata/libata-eh.c | 5 +++++
drivers/ata/libata-scsi.c | 1 +
include/linux/libata.h | 1 +
4 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d4e52e2..c795466 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3622,6 +3622,10 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
/* no restrictions on LPM transitions */
scontrol &= ~(0x3 << 8);
break;
+ case ATA_LPM_POWER_OFF:
+ scontrol &= ~0xf;
+ scontrol |= (0x1 << 2);
+ break;
default:
WARN_ON(1);
}
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 17a6378..cfac236 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3754,6 +3754,11 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
config_lpm:
/* configure link power saving */
if (link->lpm_policy != ap->target_lpm_policy) {
+ /* refuse to power off occupied port */
+ if (ap->target_lpm_policy == ATA_LPM_POWER_OFF &&
+ (ata_link_nr_enabled(link) > 0))
+ goto out;
+
rc = ata_eh_set_lpm(link, ap->target_lpm_policy, &dev);
if (rc)
goto rest_fail;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 600f635..70f1c66 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -108,6 +108,7 @@ static const char *ata_lpm_policy_names[] = {
[ATA_LPM_MAX_POWER] = "max_performance",
[ATA_LPM_MED_POWER] = "medium_power",
[ATA_LPM_MIN_POWER] = "min_power",
+ [ATA_LPM_POWER_OFF] = "power_off",
};
static ssize_t ata_scsi_lpm_store(struct device *dev,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c9c5d7a..1ad44dd 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -473,6 +473,7 @@ enum ata_lpm_policy {
ATA_LPM_MAX_POWER,
ATA_LPM_MED_POWER,
ATA_LPM_MIN_POWER,
+ ATA_LPM_POWER_OFF,
};
enum ata_lpm_hints {
--
1.7.3.1
next prev parent reply other threads:[~2011-03-03 18:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 18:21 [PATCH 0/2] Power off empty ports Kristen Carlson Accardi
2011-03-03 18:21 ` Kristen Carlson Accardi [this message]
2011-03-03 18:21 ` [PATCH 2/2] Documentation: document new link power management policy option Kristen Carlson Accardi
2011-03-04 9:06 ` [PATCH 0/2] Power off empty ports Tejun Heo
2011-03-04 18:24 ` [PATCH] libata: " Kristen Carlson Accardi
2011-03-04 18:38 ` Tejun Heo
2011-03-04 18:47 ` Kristen Carlson Accardi
2011-03-05 8:01 ` Tejun Heo
2011-03-07 17:37 ` Kristen Carlson Accardi
2011-03-07 17:48 ` Tejun Heo
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=1299176478-2999-2-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--cc=linux-ide@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).