diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 02:09:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 02:09:42 -0400 |
commit | 5fa21d821f6972e70942f2c555ec29dde962bdb2 (patch) | |
tree | fbe0a083ce7fc7ddb58cd452d5598662acac325b | |
parent | 8542e5893c2b10b4f6c80149e7dc3fdd2dc38bc6 (diff) | |
parent | 5d9fd169c9fbdaecdc430431e59bf94ff40b93d3 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6:
[PATCH] Driver core: fix locking issues with the devices that are attached to classes
[PATCH] USB: get USB suspend to work again
-rw-r--r-- | drivers/base/core.c | 19 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 2 |
2 files changed, 13 insertions, 8 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index d0f84ff78776..27c2176895de 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -356,6 +356,13 @@ int device_add(struct device *dev) | |||
356 | if (parent) | 356 | if (parent) |
357 | klist_add_tail(&dev->knode_parent, &parent->klist_children); | 357 | klist_add_tail(&dev->knode_parent, &parent->klist_children); |
358 | 358 | ||
359 | if (dev->class) { | ||
360 | /* tie the class to the device */ | ||
361 | down(&dev->class->sem); | ||
362 | list_add_tail(&dev->node, &dev->class->devices); | ||
363 | up(&dev->class->sem); | ||
364 | } | ||
365 | |||
359 | /* notify platform of device entry */ | 366 | /* notify platform of device entry */ |
360 | if (platform_notify) | 367 | if (platform_notify) |
361 | platform_notify(dev); | 368 | platform_notify(dev); |
@@ -455,6 +462,9 @@ void device_del(struct device * dev) | |||
455 | sysfs_remove_link(&dev->kobj, "device"); | 462 | sysfs_remove_link(&dev->kobj, "device"); |
456 | sysfs_remove_link(&dev->parent->kobj, class_name); | 463 | sysfs_remove_link(&dev->parent->kobj, class_name); |
457 | kfree(class_name); | 464 | kfree(class_name); |
465 | down(&dev->class->sem); | ||
466 | list_del_init(&dev->node); | ||
467 | up(&dev->class->sem); | ||
458 | } | 468 | } |
459 | device_remove_file(dev, &dev->uevent_attr); | 469 | device_remove_file(dev, &dev->uevent_attr); |
460 | 470 | ||
@@ -601,11 +611,6 @@ struct device *device_create(struct class *class, struct device *parent, | |||
601 | if (retval) | 611 | if (retval) |
602 | goto error; | 612 | goto error; |
603 | 613 | ||
604 | /* tie the class to the device */ | ||
605 | down(&class->sem); | ||
606 | list_add_tail(&dev->node, &class->devices); | ||
607 | up(&class->sem); | ||
608 | |||
609 | return dev; | 614 | return dev; |
610 | 615 | ||
611 | error: | 616 | error: |
@@ -636,9 +641,7 @@ void device_destroy(struct class *class, dev_t devt) | |||
636 | } | 641 | } |
637 | up(&class->sem); | 642 | up(&class->sem); |
638 | 643 | ||
639 | if (dev) { | 644 | if (dev) |
640 | list_del_init(&dev->node); | ||
641 | device_unregister(dev); | 645 | device_unregister(dev); |
642 | } | ||
643 | } | 646 | } |
644 | EXPORT_SYMBOL_GPL(device_destroy); | 647 | EXPORT_SYMBOL_GPL(device_destroy); |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 515310751303..fb488c8a860c 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -991,6 +991,8 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | |||
991 | 991 | ||
992 | static int verify_suspended(struct device *dev, void *unused) | 992 | static int verify_suspended(struct device *dev, void *unused) |
993 | { | 993 | { |
994 | if (dev->driver == NULL) | ||
995 | return 0; | ||
994 | return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0; | 996 | return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0; |
995 | } | 997 | } |
996 | 998 | ||