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
This commit is contained in:
commit
5fa21d821f
2 changed files with 13 additions and 8 deletions
|
@ -356,6 +356,13 @@ int device_add(struct device *dev)
|
||||||
if (parent)
|
if (parent)
|
||||||
klist_add_tail(&dev->knode_parent, &parent->klist_children);
|
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 */
|
/* notify platform of device entry */
|
||||||
if (platform_notify)
|
if (platform_notify)
|
||||||
platform_notify(dev);
|
platform_notify(dev);
|
||||||
|
@ -455,6 +462,9 @@ void device_del(struct device * dev)
|
||||||
sysfs_remove_link(&dev->kobj, "device");
|
sysfs_remove_link(&dev->kobj, "device");
|
||||||
sysfs_remove_link(&dev->parent->kobj, class_name);
|
sysfs_remove_link(&dev->parent->kobj, class_name);
|
||||||
kfree(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);
|
device_remove_file(dev, &dev->uevent_attr);
|
||||||
|
|
||||||
|
@ -601,11 +611,6 @@ struct device *device_create(struct class *class, struct device *parent,
|
||||||
if (retval)
|
if (retval)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* tie the class to the device */
|
|
||||||
down(&class->sem);
|
|
||||||
list_add_tail(&dev->node, &class->devices);
|
|
||||||
up(&class->sem);
|
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -636,9 +641,7 @@ void device_destroy(struct class *class, dev_t devt)
|
||||||
}
|
}
|
||||||
up(&class->sem);
|
up(&class->sem);
|
||||||
|
|
||||||
if (dev) {
|
if (dev)
|
||||||
list_del_init(&dev->node);
|
|
||||||
device_unregister(dev);
|
device_unregister(dev);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(device_destroy);
|
EXPORT_SYMBOL_GPL(device_destroy);
|
||||||
|
|
|
@ -991,6 +991,8 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
|
||||||
|
|
||||||
static int verify_suspended(struct device *dev, void *unused)
|
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;
|
return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue