Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299130
b: refs/heads/master
c: c825bab
h: refs/heads/master
v: v3
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Apr 6, 2012
1 parent 5846da5 commit 04d4ced
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e8dc2f2c1f669401f4bb07ccdb92ae8e44a9f00
refs/heads/master: c825bab0cef8b90bab8b63eb5686b8c8eb22e798
30 changes: 30 additions & 0 deletions trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids =
#undef COMPLIANT_DEV
#undef USUAL_DEV

#ifdef CONFIG_LOCKDEP

static struct lock_class_key us_interface_key[USB_MAXINTERFACES];

static void us_set_lock_class(struct mutex *mutex,
struct usb_interface *intf)
{
struct usb_device *udev = interface_to_usbdev(intf);
struct usb_host_config *config = udev->actconfig;
int i;

for (i = 0; i < config->desc.bNumInterfaces; i++) {
if (config->interface[i] == intf)
break;
}

BUG_ON(i == config->desc.bNumInterfaces);

lockdep_set_class(mutex, &us_interface_key[i]);
}

#else

static void us_set_lock_class(struct mutex *mutex,
struct usb_interface *intf)
{
}

#endif

#ifdef CONFIG_PM /* Minimal support for suspend and resume */

Expand Down Expand Up @@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus,
*pus = us = host_to_us(host);
memset(us, 0, sizeof(struct us_data));
mutex_init(&(us->dev_mutex));
us_set_lock_class(&us->dev_mutex, intf);
init_completion(&us->cmnd_ready);
init_completion(&(us->notify));
init_waitqueue_head(&us->delay_wait);
Expand Down

0 comments on commit 04d4ced

Please sign in to comment.