Skip to contentSkip to conversation

ricoh_mmc: Use suspend/resume_noirq (resend)

PATCH In review [email protected] 2 participants 3 messages Dec 1, 2008 – Dec 3, 2008 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ricoh_mmc: Use suspend/resume_noirq (resend)

If ricoh_mmc suspends before sdhci_pci, it will pull the card out from under the controller, which could leave the system in a very confused state.

Using suspend/resume_noirq ensures that sdhci_pci suspends first and resumes second.

---

  ricoh_mmc.c |   20 ++++++++++++++++----
  1 file changed, 16 insertions(+), 4 deletions(-)
drivers/mmc/host/ricoh_mmc.c +16 -4
index be9e7b3..34064d2 100644
@@ -196,10 +196,14 @@ static void __devexit ricoh_mmc_remove(struct pci_dev *pdev)
 	pci_set_drvdata(pdev, NULL);
 }
 
-static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state)
+static int ricoh_mmc_suspend_noirq(struct device *dev)
 {
+	struct pci_dev *pdev = NULL;
 	struct pci_dev *fw_dev = NULL;
 
+	pdev = to_pci_dev(dev);
+	BUG_ON(pdev == NULL);
+
 	fw_dev = pci_get_drvdata(pdev);
 	BUG_ON(fw_dev == NULL);
 
@@ -210,10 +214,14 @@ static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state)
 	return 0;
 }
 
-static int ricoh_mmc_resume(struct pci_dev *pdev)
+static int ricoh_mmc_resume_noirq(struct device *dev)
 {
+	struct pci_dev *pdev = NULL;
 	struct pci_dev *fw_dev = NULL;
 
+	pdev = to_pci_dev(dev);
+	BUG_ON(pdev == NULL);
+
 	fw_dev = pci_get_drvdata(pdev);
 	BUG_ON(fw_dev == NULL);
 
@@ -224,13 +232,17 @@ static int ricoh_mmc_resume(struct pci_dev *pdev)
 	return 0;
 }
 
+static struct pm_ext_ops ricoh_mmc_pm_ext_opts = {
+	.suspend_noirq =	ricoh_mmc_suspend_noirq,
+	.resume_noirq =		ricoh_mmc_resume_noirq,
+};
+
 static struct pci_driver ricoh_mmc_driver = {
 	.name = 	DRIVER_NAME,
 	.id_table =	pci_ids,
 	.probe = 	ricoh_mmc_probe,
 	.remove =	__devexit_p(ricoh_mmc_remove),
-	.suspend =	ricoh_mmc_suspend,
-	.resume =	ricoh_mmc_resume,
+	.pm =		&ricoh_mmc_pm_ext_opts,
 };
 
 /*****************************************************************************\
#1 lore raw

drivers/mmc/host/ricoh_mmc.c static int ricoh_mmc_resume(struct pci_dev *pdev) · line 238

Quoted 4 lines · On Sun, 30 Nov 2008 20:28:40 -0500 (EST) [email protected] wrote:
drivers/mmc/host/ricoh_mmc.c +4 -0
+static struct pm_ext_ops ricoh_mmc_pm_ext_opts = {
+	.suspend_noirq =	ricoh_mmc_suspend_noirq,
+	.resume_noirq =		ricoh_mmc_resume_noirq,
+};

pm_ext_ops got deleted from linux-next.

commit 481617dc3d1e6c52e35172ab49e655f74a1591b6

Author: Rafael J. Wysocki <[email protected]>
Date:   Mon Oct 6 22:46:05 2008 +0200

PM: Simplify the new suspend/hibernation framework for devices

#2 lore raw
Quoted 8 lines · Andrew Morton

drivers/mmc/host/ricoh_mmc.c static int ricoh_mmc_resume(struct pci_dev *pdev) · line 238

Quoted 4 lines · On Sun, 30 Nov 2008 20:28:40 -0500 (EST) [email protected] wrote:
drivers/mmc/host/ricoh_mmc.c +4 -0
+static struct pm_ext_ops ricoh_mmc_pm_ext_opts = {
+	.suspend_noirq =	ricoh_mmc_suspend_noirq,
+	.resume_noirq =		ricoh_mmc_resume_noirq,
+};

pm_ext_ops got deleted from linux-next.

Not in Pierre's tree :-P

I've sent an updated diff against linux-next.

--phil