Skip to contentSkip to conversation

libata: disable pdev on all suspend events

PATCH Applied Tejun Heo 2 participants 2 messages Feb 20, 2007 2 messages not in the archive libata

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Tejun Heo

author
#2 lore raw

PATCH 1/1 libata: disable pdev on all suspend events

libata used disable pdev only on PM_EVENT_SUSPEND while re-enable pdev unconditionally. This was okay before ref-counted pdev enable update but it now makes the pdev pinned after swsusp cycle (enabled twice but disabled only once) and devres sanity check whines about it.

Fix it by unconditionally disabling pdev on all suspend events.

---
Pavel, I took your advice and chose to disable unconditionally rather than recording the status separately, but I still think it would be nice if we can tell the status we're waking from from either the mesg itself (say, PM_EVENT_THAW) or recorded prev state.

Both STM and STD are tested. Please apply. Thanks.

drivers/ata/libata-core.c +2 -3
index 2cf8251..12bde4b 100644
@@ -6001,11 +6001,10 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
 void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 
-	if (mesg.event == PM_EVENT_SUSPEND) {
-		pci_disable_device(pdev);
+	if (mesg.event == PM_EVENT_SUSPEND)
 		pci_set_power_state(pdev, PCI_D3hot);
-	}
 }
 
 int ata_pci_device_do_resume(struct pci_dev *pdev)
Applied
#3 lore raw
Quoted 7 lines · Tejun Heo

libata used disable pdev only on PM_EVENT_SUSPEND while re-enable pdev unconditionally. This was okay before ref-counted pdev enable update but it now makes the pdev pinned after swsusp cycle (enabled twice but disabled only once) and devres sanity check whines about it.

Fix it by unconditionally disabling pdev on all suspend events.

Quoted 8 lines

---
Pavel, I took your advice and chose to disable unconditionally rather than recording the status separately, but I still think it would be nice if we can tell the status we're waking from from either the mesg itself (say, PM_EVENT_THAW) or recorded prev state.

Both STM and STD are tested. Please apply. Thanks.

applied