aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c18538e4a6db..2653e73db623 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids =
132#undef COMPLIANT_DEV 132#undef COMPLIANT_DEV
133#undef USUAL_DEV 133#undef USUAL_DEV
134 134
135#ifdef CONFIG_LOCKDEP
136
137static struct lock_class_key us_interface_key[USB_MAXINTERFACES];
138
139static void us_set_lock_class(struct mutex *mutex,
140 struct usb_interface *intf)
141{
142 struct usb_device *udev = interface_to_usbdev(intf);
143 struct usb_host_config *config = udev->actconfig;
144 int i;
145
146 for (i = 0; i < config->desc.bNumInterfaces; i++) {
147 if (config->interface[i] == intf)
148 break;
149 }
150
151 BUG_ON(i == config->desc.bNumInterfaces);
152
153 lockdep_set_class(mutex, &us_interface_key[i]);
154}
155
156#else
157
158static void us_set_lock_class(struct mutex *mutex,
159 struct usb_interface *intf)
160{
161}
162
163#endif
135 164
136#ifdef CONFIG_PM /* Minimal support for suspend and resume */ 165#ifdef CONFIG_PM /* Minimal support for suspend and resume */
137 166
@@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus,
895 *pus = us = host_to_us(host); 924 *pus = us = host_to_us(host);
896 memset(us, 0, sizeof(struct us_data)); 925 memset(us, 0, sizeof(struct us_data));
897 mutex_init(&(us->dev_mutex)); 926 mutex_init(&(us->dev_mutex));
927 us_set_lock_class(&us->dev_mutex, intf);
898 init_completion(&us->cmnd_ready); 928 init_completion(&us->cmnd_ready);
899 init_completion(&(us->notify)); 929 init_completion(&(us->notify));
900 init_waitqueue_head(&us->delay_wait); 930 init_waitqueue_head(&us->delay_wait);