aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libahci.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-09-01 11:50:04 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-10-21 20:21:04 -0400
commitc93b263e0d4fa8ce5fec0142a98196d1a127e845 (patch)
tree6495053b65f7a79d1e5c11aaea77dd25e4082a84 /drivers/ata/libahci.c
parentc43d559f0423816bb2918d892131d21c51816c3d (diff)
libata: clean up lpm related symbols and sysfs show/store functions
Link power management related symbols are in confusing state w/ mixed usages of lpm, ipm and pm. This patch cleans up lpm related symbols and sysfs show/store functions as follows. * lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and ATA_LPM_{MIN|MAX|MED}_POWER. * Pre/postfixes are unified to lpm. * sysfs show/store functions for link_power_management_policy were curiously named get/put and unnecessarily complex. Renamed to show/store and simplified. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libahci.c')
-rw-r--r--drivers/ata/libahci.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 8eea309ea212..ed7803f2b4f1 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -56,8 +56,7 @@ MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)
56module_param_named(ignore_sss, ahci_ignore_sss, int, 0444); 56module_param_named(ignore_sss, ahci_ignore_sss, int, 0444);
57MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)"); 57MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)");
58 58
59static int ahci_enable_alpm(struct ata_port *ap, 59static int ahci_enable_alpm(struct ata_port *ap, enum ata_lpm_policy policy);
60 enum link_pm policy);
61static void ahci_disable_alpm(struct ata_port *ap); 60static void ahci_disable_alpm(struct ata_port *ap);
62static ssize_t ahci_led_show(struct ata_port *ap, char *buf); 61static ssize_t ahci_led_show(struct ata_port *ap, char *buf);
63static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, 62static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
@@ -649,7 +648,7 @@ static void ahci_disable_alpm(struct ata_port *ap)
649 u32 cmd; 648 u32 cmd;
650 struct ahci_port_priv *pp = ap->private_data; 649 struct ahci_port_priv *pp = ap->private_data;
651 650
652 /* IPM bits should be disabled by libata-core */ 651 /* LPM bits should be disabled by libata-core */
653 /* get the existing command bits */ 652 /* get the existing command bits */
654 cmd = readl(port_mmio + PORT_CMD); 653 cmd = readl(port_mmio + PORT_CMD);
655 654
@@ -691,8 +690,7 @@ static void ahci_disable_alpm(struct ata_port *ap)
691 */ 690 */
692} 691}
693 692
694static int ahci_enable_alpm(struct ata_port *ap, 693static int ahci_enable_alpm(struct ata_port *ap, enum ata_lpm_policy policy)
695 enum link_pm policy)
696{ 694{
697 struct ahci_host_priv *hpriv = ap->host->private_data; 695 struct ahci_host_priv *hpriv = ap->host->private_data;
698 void __iomem *port_mmio = ahci_port_base(ap); 696 void __iomem *port_mmio = ahci_port_base(ap);
@@ -705,21 +703,21 @@ static int ahci_enable_alpm(struct ata_port *ap,
705 return -EINVAL; 703 return -EINVAL;
706 704
707 switch (policy) { 705 switch (policy) {
708 case MAX_PERFORMANCE: 706 case ATA_LPM_MAX_POWER:
709 case NOT_AVAILABLE: 707 case ATA_LPM_UNKNOWN:
710 /* 708 /*
711 * if we came here with NOT_AVAILABLE, 709 * if we came here with ATA_LPM_UNKNOWN,
712 * it just means this is the first time we 710 * it just means this is the first time we
713 * have tried to enable - default to max performance, 711 * have tried to enable - default to max performance,
714 * and let the user go to lower power modes on request. 712 * and let the user go to lower power modes on request.
715 */ 713 */
716 ahci_disable_alpm(ap); 714 ahci_disable_alpm(ap);
717 return 0; 715 return 0;
718 case MIN_POWER: 716 case ATA_LPM_MIN_POWER:
719 /* configure HBA to enter SLUMBER */ 717 /* configure HBA to enter SLUMBER */
720 asp = PORT_CMD_ASP; 718 asp = PORT_CMD_ASP;
721 break; 719 break;
722 case MEDIUM_POWER: 720 case ATA_LPM_MED_POWER:
723 /* configure HBA to enter PARTIAL */ 721 /* configure HBA to enter PARTIAL */
724 asp = 0; 722 asp = 0;
725 break; 723 break;
@@ -762,7 +760,7 @@ static int ahci_enable_alpm(struct ata_port *ap,
762 writel(cmd, port_mmio + PORT_CMD); 760 writel(cmd, port_mmio + PORT_CMD);
763 cmd = readl(port_mmio + PORT_CMD); 761 cmd = readl(port_mmio + PORT_CMD);
764 762
765 /* IPM bits should be set by libata-core */ 763 /* LPM bits should be set by libata-core */
766 return 0; 764 return 0;
767} 765}
768 766