public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* fix suspend/resume irq request free for yenta..
@ 2005-07-22 22:33 Dave Airlie
  2005-07-22 23:16 ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Airlie @ 2005-07-22 22:33 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 265 bytes --]


Without this patch my laptop fails to resume from suspend to RAM...

It applies against a pretty recent 2.6.13-rc3 from git..

Dave.

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
Linux kernel - DRI, VAX / pam_smb / ILUG

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1875 bytes --]

diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -872,10 +872,20 @@ static irqreturn_t yenta_probe_handler(i
 	return IRQ_NONE;
 }
 
+static int yenta_request_irq(struct yenta_socket *socket)
+{
+	if (request_irq(socket->cb_irq, yenta_probe_handler, SA_SHIRQ, "yenta", socket)) {
+		printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n");
+		return -1;
+	}
+	return 0;
+}
+
 /* probes the PCI interrupt, use only on override functions */
 static int yenta_probe_cb_irq(struct yenta_socket *socket)
 {
 	u16 bridge_ctrl;
+	int ret;
 
 	if (!socket->cb_irq)
 		return -1;
@@ -887,10 +897,9 @@ static int yenta_probe_cb_irq(struct yen
 	bridge_ctrl &= ~CB_BRIDGE_INTR;
 	config_writew(socket, CB_BRIDGE_CONTROL, bridge_ctrl);
 
-	if (request_irq(socket->cb_irq, yenta_probe_handler, SA_SHIRQ, "yenta", socket)) {
-		printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n");
-		return -1;
-	}
+	ret = yenta_request_irq(socket);
+	if (ret==-1)
+		return ret;
 
 	/* generate interrupt, wait */
 	exca_writeb(socket, I365_CSCINT, I365_CSC_STSCHG);
@@ -1101,6 +1110,7 @@ static int yenta_dev_suspend (struct pci
 		if (socket->type && socket->type->save_state)
 			socket->type->save_state(socket);
 
+		free_irq(dev->irq, 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]);
@@ -1131,6 +1141,7 @@ static int yenta_dev_resume (struct pci_
 		pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
 		pci_enable_device(dev);
 		pci_set_master(dev);
+		yenta_request_irq(socket);
 
 		if (socket->type && socket->type->restore_state)
 			socket->type->restore_state(socket);

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: fix suspend/resume irq request free for yenta..
@ 2005-07-23 23:46 Daniel Ritz
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Ritz @ 2005-07-23 23:46 UTC (permalink / raw)
  To: Dave Airlie; +Cc: linux-kernel, Dominik Brodowski

hi

the patch is wrong. yenta_request_irq() registers the wrong handler.
plus yenta_probe_cb_irq() has nothing to do with suspend/resume
(besides it frees the irq in the very same function). correct patch below.

somebody cares to explain me why the free_irq() is necessary before
a suspend?

rgds
-daniel

---------------

[PATCH] yenta: free_irq() on suspend.

Resume doesn't seem to work without.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>

diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1107,6 +1107,8 @@ static int yenta_dev_suspend (struct pci
 		pci_read_config_dword(dev, 17*4, &socket->saved_state[1]);
 		pci_disable_device(dev);
 
+		free_irq(dev->irq, socket);
+
 		/*
 		 * Some laptops (IBM T22) do not like us putting the Cardbus
 		 * bridge into D3.  At a guess, some other laptop will
@@ -1132,6 +1134,13 @@ static int yenta_dev_resume (struct pci_
 		pci_enable_device(dev);
 		pci_set_master(dev);
 
+		if (socket->cb_irq)
+			if (request_irq(socket->cb_irq, yenta_interrupt,
+			                SA_SHIRQ, "yenta", socket)) {
+				printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n");
+				socket->cb_irq = 0;
+			}
+
 		if (socket->type && socket->type->restore_state)
 			socket->type->restore_state(socket);
 	}

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: fix suspend/resume irq request free for yenta..
@ 2005-07-26  5:44 Brown, Len
  0 siblings, 0 replies; 9+ messages in thread
From: Brown, Len @ 2005-07-26  5:44 UTC (permalink / raw)
  To: Russell King, Pavel Machek
  Cc: Dmitry Torokhov, linux-kernel, Dave Airlie, Li, Shaohua

>On Sat, Jul 23, 2005 at 02:29:24AM +0200, Pavel Machek wrote:
>> > Is it necessary to do free_irq for suspend? Shouldn't disable_irq
>> > be enough?
>> 
>> Due to recent changes in ACPI, yes, it is neccessary.
>
>What if some other driver is sharing the IRQ, and requires IRQs to be
>enabled for the resume to complete?

IRQ sharing is an excellent example, not a counter-example,
of why it is necessary to disable devices and free IRQs
on suspend, and acquire them again on resume.

eg. if a device is suspended, but the hardware still causes
an interrupt on a shared IRQ, another device can
suffer a screaming IRQ failure.

Documentation/power/pci.txt has as much as we know about
how to address this -- but I'm certainly open to suggestions
on how to be less invasive to the drivers while having some
chance of being robust.

thanks,
-Len


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-07-26  5:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 22:33 fix suspend/resume irq request free for yenta Dave Airlie
2005-07-22 23:16 ` Dmitry Torokhov
2005-07-23  0:29   ` Pavel Machek
2005-07-23  7:40     ` Russell King
2005-07-23 15:41       ` Zwane Mwaikambo
2005-07-23 22:40         ` Dave Airlie
2005-07-24  8:19           ` Russell King
  -- strict thread matches above, loose matches on Subject: below --
2005-07-23 23:46 Daniel Ritz
2005-07-26  5:44 Brown, Len

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox