public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: [patch 30/30] PM / yenta: Fix cardbus suspend/resume regression
Date: Thu, 01 Oct 2009 16:31:46 -0700	[thread overview]
Message-ID: <20091001233323.256648044@mini.kroah.org> (raw)
In-Reply-To: <20091001233504.GA17709@kroah.com>

[-- Attachment #1: pm-yenta-fix-cardbus-suspend-resume-regression.patch --]
[-- Type: text/plain, Size: 4873 bytes --]

2.6.30-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Rafael J. Wysocki <rjw@sisk.pl>

commit 0c570cdeb8fdfcb354a3e9cd81bfc6a09c19de0c upstream.

Since 2.6.29 the PCI PM core have been restoring the standard
configuration registers of PCI devices in the early phase of
resume.  In particular, PCI devices without drivers have been handled
this way since commit 355a72d75b3b4f4877db4c9070c798238028ecb5
(PCI: Rework default handling of suspend and resume).  Unfortunately,
this leads to post-resume problems with CardBus devices which cannot
be accessed in the early phase of resume, because the sockets they
are on have not been woken up yet at that point.

To solve this problem, move the yenta socket resume to the early
phase of resume and, analogously, move the suspend of it to the late
phase of suspend.  Additionally, remove some unnecessary PCI code
from the yenta socket's resume routine.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13092, which is a
post-2.6.28 regression.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Florian <fs-kernelbugzilla@spline.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pcmcia/yenta_socket.c |   92 ++++++++++++++++++++++--------------------
 1 file changed, 50 insertions(+), 42 deletions(-)

--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1225,60 +1225,71 @@ static int __devinit yenta_probe (struct
 }
 
 #ifdef CONFIG_PM
-static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
+static int yenta_dev_suspend_noirq(struct device *dev)
 {
-	struct yenta_socket *socket = pci_get_drvdata(dev);
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct yenta_socket *socket = pci_get_drvdata(pdev);
 	int ret;
 
-	ret = pcmcia_socket_dev_suspend(&dev->dev);
+	ret = pcmcia_socket_dev_suspend(dev);
 
-	if (socket) {
-		if (socket->type && socket->type->save_state)
-			socket->type->save_state(socket);
-
-		/* FIXME: pci_save_state needs to have a better interface */
-		pci_save_state(dev);
-		pci_read_config_dword(dev, 16*4, &socket->saved_state[0]);
-		pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
-		pci_disable_device(dev);
-
-		/*
-		 * Some laptops (IBM T22) do not like us putting the Cardbus
-		 * bridge into D3.  At a guess, some other laptop will
-		 * probably require this, so leave it commented out for now.
-		 */
-		/* pci_set_power_state(dev, 3); */
-	}
+	if (!socket)
+		return ret;
+
+	if (socket->type && socket->type->save_state)
+		socket->type->save_state(socket);
+
+	pci_save_state(pdev);
+	pci_read_config_dword(pdev, 16*4, &socket->saved_state[0]);
+	pci_read_config_dword(pdev, 17*4, &socket->saved_state[1]);
+	pci_disable_device(pdev);
+
+	/*
+	 * Some laptops (IBM T22) do not like us putting the Cardbus
+	 * bridge into D3.  At a guess, some other laptop will
+	 * probably require this, so leave it commented out for now.
+	 */
+	/* pci_set_power_state(dev, 3); */
 
 	return ret;
 }
 
-
-static int yenta_dev_resume (struct pci_dev *dev)
+static int yenta_dev_resume_noirq(struct device *dev)
 {
-	struct yenta_socket *socket = pci_get_drvdata(dev);
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct yenta_socket *socket = pci_get_drvdata(pdev);
+	int ret;
 
-	if (socket) {
-		int rc;
+	if (!socket)
+		return 0;
 
-		pci_set_power_state(dev, 0);
-		/* FIXME: pci_restore_state needs to have a better interface */
-		pci_restore_state(dev);
-		pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
-		pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
+	pci_write_config_dword(pdev, 16*4, socket->saved_state[0]);
+	pci_write_config_dword(pdev, 17*4, socket->saved_state[1]);
 
-		rc = pci_enable_device(dev);
-		if (rc)
-			return rc;
+	ret = pci_enable_device(pdev);
+	if (ret)
+		return ret;
 
-		pci_set_master(dev);
+	pci_set_master(pdev);
 
-		if (socket->type && socket->type->restore_state)
-			socket->type->restore_state(socket);
-	}
+	if (socket->type && socket->type->restore_state)
+		socket->type->restore_state(socket);
 
-	return pcmcia_socket_dev_resume(&dev->dev);
+	return pcmcia_socket_dev_resume(dev);
 }
+
+static struct dev_pm_ops yenta_pm_ops = {
+	.suspend_noirq = yenta_dev_suspend_noirq,
+	.resume_noirq = yenta_dev_resume_noirq,
+	.freeze_noirq = yenta_dev_suspend_noirq,
+	.thaw_noirq = yenta_dev_resume_noirq,
+	.poweroff_noirq = yenta_dev_suspend_noirq,
+	.restore_noirq = yenta_dev_resume_noirq,
+};
+
+#define YENTA_PM_OPS	(&yenta_pm_ops)
+#else
+#define YENTA_PM_OPS	NULL
 #endif
 
 #define CB_ID(vend,dev,type)				\
@@ -1376,10 +1387,7 @@ static struct pci_driver yenta_cardbus_d
 	.id_table	= yenta_table,
 	.probe		= yenta_probe,
 	.remove		= __devexit_p(yenta_close),
-#ifdef CONFIG_PM
-	.suspend	= yenta_dev_suspend,
-	.resume		= yenta_dev_resume,
-#endif
+	.driver.pm	= YENTA_PM_OPS,
 };
 
 



  parent reply	other threads:[~2009-10-01 23:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091001233116.947658905@mini.kroah.org>
2009-10-01 23:35 ` [patch 00/30] 2.6.30.9-stable review Greg KH
2009-10-01 23:31   ` [patch 01/30] ACPI: pci_slot.ko wants a 64-bit _SUN Greg KH
2009-10-01 23:31   ` [patch 02/30] fs: make sure data stored into inode is properly seen before unlocking new inode Greg KH
2009-10-01 23:31   ` [patch 03/30] kallsyms: fix segfault in prefix_underscores_count() Greg KH
2009-10-01 23:31   ` [patch 04/30] nilfs2: fix missing zero-fill initialization of btree node cache Greg KH
2009-10-01 23:31   ` [patch 05/30] p54usb: add Zcomax XG-705A usbid Greg KH
2009-10-01 23:31   ` [patch 06/30] [CIFS] Re-enable Lanman security Greg KH
2009-10-01 23:31   ` [patch 07/30] KVM: VMX: Check cpl before emulating debug register access Greg KH
2009-10-01 23:31   ` [patch 08/30] KVM: VMX: Fix cr8 exiting control clobbering by EPT Greg KH
2009-10-01 23:31   ` [patch 09/30] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list Greg KH
2009-10-01 23:31   ` [patch 10/30] KVM: x86: Disallow hypercalls for guest callers in rings > 0 Greg KH
2009-10-01 23:31   ` [patch 11/30] KVM: MMU: fix missing locking in alloc_mmu_pages Greg KH
2009-10-01 23:31   ` [patch 12/30] KVM: MMU: fix bogus alloc_mmu_pages assignment Greg KH
2009-10-01 23:31   ` [patch 13/30] KVM: limit lapic periodic timer frequency Greg KH
2009-10-01 23:31   ` [patch 14/30] KVM guest: fix bogus wallclock physical address calculation Greg KH
2009-10-01 23:31   ` [patch 15/30] KVM: fix cpuid E2BIG handling for extended request types Greg KH
2009-10-01 23:31   ` [patch 16/30] Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs" Greg KH
2009-10-01 23:31   ` [patch 17/30] ahci: restore pci_intx() handling Greg KH
2009-10-01 23:31   ` [patch 18/30] net ax25: Fix signed comparison in the sockopt handler Greg KH
2009-10-01 23:31   ` [patch 19/30] net: Make the copy length in af_packet sockopt handler unsigned Greg KH
2009-10-01 23:31   ` [patch 20/30] [CPUFREQ] Fix NULL ptr regression in powernow-k8 Greg KH
2009-10-01 23:31   ` [patch 21/30] netfilter: bridge: refcount fix Greg KH
2009-10-01 23:31   ` [patch 22/30] netfilter: ebt_ulog: fix checkentry return value Greg KH
2009-10-01 23:31   ` [patch 23/30] netfilter: nf_nat: fix inverted logic for persistent NAT mappings Greg KH
2009-10-01 23:31   ` [patch 24/30] Fix idle time field in /proc/uptime Greg KH
2009-10-01 23:31   ` [patch 25/30] hugetlb: restore interleaving of bootmem huge pages (2.6.31) Greg KH
2009-10-01 23:31   ` [patch 26/30] powerpc/8xx: Fix regression introduced by cache coherency rewrite Greg KH
2009-10-01 23:31   ` [patch 27/30] powerpc: Fix incorrect setting of __HAVE_ARCH_PTE_SPECIAL Greg KH
2009-10-01 23:31   ` [patch 28/30] /proc/kcore: work around a BUG() Greg KH
2009-10-01 23:31   ` [patch 29/30] PM / PCMCIA: Drop second argument of pcmcia_socket_dev_suspend() Greg KH
2009-10-01 23:31   ` Greg KH [this message]
2009-10-02  2:43   ` [patch 00/30] 2.6.30.9-stable review Henrique de Moraes Holschuh
2009-10-02 14:20     ` [stable] " Greg KH
2009-10-03 14:39       ` Henrique de Moraes Holschuh
2009-10-02 16:42   ` [31/30] thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM Greg KH
2009-10-02 17:20   ` [patch 32/30] mm: fix anonymous dirtying Greg KH
2009-10-02 17:21   ` [patch 33/30] mmap: avoid unnecessary anon_vma lock acquisition in vma_adjust() Greg KH
2009-10-02 17:23   ` [patch 00/30] 2.6.30.9-stable review Greg KH

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=20091001233323.256648044@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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