Skip to contentSkip to conversation

UEAGLE : be suspend friendly

PATCH In review matthieu castet 4 participants 8 messages Oct 3, 2006 – Oct 6, 2006

Subsystems (3)
lore
Share & tools
lore

matthieu castet

author maintainer
#0 lore raw

PATCH 1/3 UEAGLE : be suspend friendly

Hi,

this patch avoid that the kernel thread block the suspend process. Some work is still need to recover after a resume.

this patch avoid that the kernel thread block the suspend process. Some work is still need to recover after a resume.

drivers/usb/atm/ueagle-atm.c +3 -0
Index: linux/drivers/usb/atm/ueagle-atm.c
===================================================================
@@ -1177,6 +1177,9 @@
 			ret = uea_stat(sc);
 		if (ret != -EAGAIN)
 			msleep(1000);
+ 		if (try_to_freeze())
+			uea_err(INS_TO_USBDEV(sc), "suspend/resume not supported, "
+				"please unplug/replug your modem\n");
 	}
 	uea_leaves(INS_TO_USBDEV(sc));
 	return ret;
#1 lore raw

Hi!

You marked all the patches as 1/3, btw.

Quoted 16 lines

this patch avoid that the kernel thread block the suspend process. Some work is still need to recover after a resume.

this patch avoid that the kernel thread block the suspend process. Some work is still need to recover after a resume.

Index: linux/drivers/usb/atm/ueagle-atm.c
===================================================================

drivers/usb/atm/ueagle-atm.c line 1182

Quoted 6 lines
drivers/usb/atm/ueagle-atm.c +3 -0
@@ -1177,6 +1177,9 @@
 			ret = uea_stat(sc);
 		if (ret != -EAGAIN)
 			msleep(1000);
+ 		if (try_to_freeze())
+			uea_err(INS_TO_USBDEV(sc), "suspend/resume not supported, "
+				"please unplug/replug your modem\n");

Plug/unplug should be easy enough to simulate from usb driver, no?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw

Hi Pavel,

Quoted 6 lines
Quoted 6 lines

Index: linux/drivers/usb/atm/ueagle-atm.c
===================================================================

drivers/usb/atm/ueagle-atm.c +0 -0
@@ -1177,6 +1177,9 @@
Quoted 8 lines

drivers/usb/atm/ueagle-atm.c line 1182

Quoted 6 lines
drivers/usb/atm/ueagle-atm.c +3 -0
 			ret = uea_stat(sc);
 		if (ret != -EAGAIN)
 			msleep(1000);
+ 		if (try_to_freeze())
+			uea_err(INS_TO_USBDEV(sc), "suspend/resume not supported, "
+				"please unplug/replug your modem\n");

Plug/unplug should be easy enough to simulate from usb driver, no?

if a USB driver doesn't define suspend/resume methods, then the core simply unplugs it on suspend, and replugs on resume (IIRC). Maybe Matthieu is trying for something better - hopefully he will explain. Since this is a modem, it would be nice if the internet connection sprang back to life on resume, which requires more work than unplug/plug. I've no idea what needs to be done to achieve this. These modems use the ATM networking layer by the way, I don't know if that makes things easier or harder.

Ciao,

Duncan.

#3 lore raw
Quoted 4 lines · Duncan Sands
Quoted 1 line

Plug/unplug should be easy enough to simulate from usb driver, no?

if a USB driver doesn't define suspend/resume methods, then the core simply unplugs it on suspend, and replugs on resume (IIRC).

No longer true, and IIRC it never was. All that happens is that URB submissions fail with -EHOSTUNREACH once the device is suspended.

Alan Stern

#4 lore raw

Hi!

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Plug/unplug should be easy enough to simulate from usb driver, no?

if a USB driver doesn't define suspend/resume methods, then the core simply unplugs it on suspend, and replugs on resume (IIRC).

No longer true, and IIRC it never was. All that happens is that URB submissions fail with -EHOSTUNREACH once the device is suspended.

Could we get "old" behaviour for devices like this? "printk("please unplug/replug me\n")" is not a good solution.
Pavel

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

Hi!

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Plug/unplug should be easy enough to simulate from usb driver, no?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

if a USB driver doesn't define suspend/resume methods, then the core simply unplugs it on suspend, and replugs on resume (IIRC).

No longer true, and IIRC it never was. All that happens is that URB submissions fail with -EHOSTUNREACH once the device is suspended.

Could we get "old" behaviour for devices like this? "printk("please unplug/replug me\n")" is not a good solution.

I would much rather see this fixed in the driver itself.

For the time being, a "dummy" suspend routine could look like this:

static int foo_suspend(struct usb_interface *intf, pm_message_t msg)

{
	up(&intf->dev.sem);
	device_release_driver(&intf->dev);
	down(&intf->dev.sem);
	return 0;
}

Getting reprobed during resume would be more difficult; it would need help from userspace.

Maybe UEAGLE can do something a little more sensible...

Alan Stern

#6 lore raw
Quoted 1 line

Maybe UEAGLE can do something a little more sensible...

What is the modem supposed to do if it receives a packet to transmit after it has been told to suspend? This is a real question, I'm not pretending! I've never thought about or read about suspend/resume and have no idea how it is supposed to work. Should it just reject it, or should it wake the modem up?

Ciao,

Duncan.

#7 lore raw
Quoted 8 lines · Duncan Sands
Quoted 1 line

Maybe UEAGLE can do something a little more sensible...

What is the modem supposed to do if it receives a packet to transmit after it has been told to suspend? This is a real question, I'm not pretending! I've never thought about or read about suspend/resume and have no idea how it is supposed to work. Should it just reject it, or should it wake the modem up?

It depends on the context in which the modem was suspended. If this was a regular system sleep transition, or some other suspend request coming from outside the driver, then packets should be dropped.

But if the suspend originated within the driver itself, as a power-saving measure while the connection was idle, then new packets should cause the driver to wake the modem up. That is, self-originated suspends should be transparent. Outside-originated suspends are someone else's problem.

Alan Stern