Skip to contentSkip to conversation

power_state: get rid of write-only variable in SATA

PATCH Applied Pavel Machek 4 participants 5 messages Feb 21, 2008 – Feb 24, 2008 libata

lore
Share & tools
lore
#0 lore raw

power_state is scheduled for removal, and libata uses it in write-only mode. Remove it.

drivers/ata/libata-core.c +0 -3
index b4985bc..a31572d 100644
@@ -6542,8 +6542,6 @@ int ata_host_suspend(struct ata_host *ho
 	ata_lpm_enable(host);
 
 	rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
-	if (rc == 0)
-		host->dev->power.power_state = mesg;
 	return rc;
 }
 
@@ -6562,7 +6560,6 @@ void ata_host_resume(struct ata_host *ho
 {
 	ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
 			    ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
-	host->dev->power.power_state = PMSG_ON;
 
 	/* reenable link pm */
 	ata_lpm_disable(host);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 19 lines · Pavel Machek

power_state is scheduled for removal, and libata uses it in write-only mode. Remove it.

drivers/ata/libata-core.c +0 -2
index b4985bc..a31572d 100644
@@ -6542,8 +6542,6 @@ int ata_host_suspend(struct ata_host *ho
 	ata_lpm_enable(host);
 
 	rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
-	if (rc == 0)
-		host->dev->power.power_state = mesg;
 	return rc;
 }
 

drivers/ata/libata-core.c void ata_host_resume(struct ata_host *ho · line 6565

Quoted 7 lines
drivers/ata/libata-core.c +0 -1
@@ -6562,7 +6560,6 @@ void ata_host_resume(struct ata_host *ho
 {
 	ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
 			    ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
-	host->dev->power.power_state = PMSG_ON;
 
 	/* reenable link pm */
 	ata_lpm_disable(host);

libata uses it under the assumption that "other parts" of the system are aware of this variable.

May I assume that the API has changed such that this is no longer necessary?

Jeff

#2 lore raw
Quoted 4 lines

libata uses it under the assumption that "other parts" of the system are aware of this variable.

May I assume that the API has changed such that this is no longer necessary?

Yes. The original motivation for dev->power.power_state was to let the writes to /sys/devices/.../power/state support a PCI-specific policy for device power state transition. And the motivation for any driver (or framework) to modify that was that the PM core didn't update it in all the relevant code paths (it wan't clear how to do that either), which mean those sysfs files could make trouble.

That file is gone; everything supporting its usage can now go away. (And the PCI-specific policy -- "only transitions to/from D0 are allowed" -- can be managed by PCI drivers, and ignored by others on more flexible hardware.)

The minor problem removing it is that there's some code which has used fields in power_state for some driver state. But if all that usage is write-only in the drivers (is that true now for SATA?), then it's safe to remove the /sys/devices/.../power/state support from framework code and elsewhere.

- Dave

#3 lore raw
Quoted 2 lines · David Brownell
Quoted 2 lines

libata uses it under the assumption that "other parts" of the system are aware of this variable.

There are no other relevant parts, except one debug printk that is getting removed.

Quoted 3 lines
Quoted 1 line

May I assume that the API has changed such that this is no longer necessary?

Yes. The original motivation for dev->power.power_state was to let

ACK.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Applied
#4 lore raw
In reply to Pavel Machek
Quoted 19 lines · Pavel Machek

power_state is scheduled for removal, and libata uses it in write-only mode. Remove it.

drivers/ata/libata-core.c +0 -2
index b4985bc..a31572d 100644
@@ -6542,8 +6542,6 @@ int ata_host_suspend(struct ata_host *ho
 	ata_lpm_enable(host);
 
 	rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
-	if (rc == 0)
-		host->dev->power.power_state = mesg;
 	return rc;
 }
 

drivers/ata/libata-core.c void ata_host_resume(struct ata_host *ho · line 6563

Quoted 5 lines
drivers/ata/libata-core.c +0 -1
@@ -6562,7 +6560,6 @@ void ata_host_resume(struct ata_host *ho
 {
 	ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
 			    ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
-	host->dev->power.power_state = PMSG_ON;
 

applied