Skip to contentSkip to conversation

USB fixes for suspend issues

PATCH In review Greg KH 3 participants 4 messages Jun 23, 2006

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 USB fixes for suspend issues

Here are the two patches that fix the suspend issue and the USB oops issue in your current tree.

Please pull from:

	git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git/
or if master.kernel.org hasn't synced up yet:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6.git/

The full patches will be sent to the linux-kernel mailing list, if anyone wants to see them.

thanks,

greg k-h

 drivers/base/core.c    |   19 +++++++++++--------
 drivers/usb/core/usb.c |    2 ++
 2 files changed, 13 insertions(+), 8 deletions(-)

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

Greg Kroah-Hartman:
USB: get USB suspend to work again
Driver core: fix locking issues with the devices that are attached to classes

#1 lore raw

PATCH 1/2 USB: get USB suspend to work again

From: Greg Kroah-Hartman <[email protected]>

Yeah, it's a hack, but it is only temporary until Alan's patches reworking this area make it in. We really should not care what devices below us are doing, especially when we do not really know what type of devices they are. This patch relies on the fact that the endpoint devices do not have a driver assigned to us.

---
 drivers/usb/core/usb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/core/usb.c +2 -0
index 5153107..fb488c8 100644
@@ -991,6 +991,8 @@ void usb_buffer_unmap_sg (struct usb_dev
 
 static int verify_suspended(struct device *dev, void *unused)
 {
+	if (dev->driver == NULL)
+		return 0;
 	return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0;
 }
 
Signature · 1 line
1.4.0
#2 lore raw

PATCH 2/2 Driver core: fix locking issues with the devices that are attached to classes

From: Greg Kroah-Hartman <[email protected]>

Doh, that was foolish...

---
 drivers/base/core.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/base/core.c +11 -8
index d0f84ff..27c2176 100644
@@ -356,6 +356,13 @@ int device_add(struct device *dev)
 	if (parent)
 		klist_add_tail(&dev->knode_parent, &parent->klist_children);
 
+	if (dev->class) {
+		/* tie the class to the device */
+		down(&dev->class->sem);
+		list_add_tail(&dev->node, &dev->class->devices);
+		up(&dev->class->sem);
+	}
+
 	/* notify platform of device entry */
 	if (platform_notify)
 		platform_notify(dev);
@@ -455,6 +462,9 @@ void device_del(struct device * dev)
 		sysfs_remove_link(&dev->kobj, "device");
 		sysfs_remove_link(&dev->parent->kobj, class_name);
 		kfree(class_name);
+		down(&dev->class->sem);
+		list_del_init(&dev->node);
+		up(&dev->class->sem);
 	}
 	device_remove_file(dev, &dev->uevent_attr);
 
@@ -601,11 +611,6 @@ struct device *device_create(struct clas
 	if (retval)
 		goto error;
 
-	/* tie the class to the device */
-	down(&class->sem);
-	list_add_tail(&dev->node, &class->devices);
-	up(&class->sem);
-
 	return dev;
 
 error:
@@ -636,9 +641,7 @@ void device_destroy(struct class *class,
 	}
 	up(&class->sem);
 
-	if (dev) {
-		list_del_init(&dev->node);
+	if (dev)
 		device_unregister(dev);
-	}
 }
 EXPORT_SYMBOL_GPL(device_destroy);
Signature · 1 line
1.4.0
#3 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

Here are the two patches that fix the suspend issue and the USB oops issue in your current tree.

Ack. My box works again with this.

Linus