This source file includes following definitions.
- quirks_param_set
 
- usb_endpoint_is_blacklisted
 
- usb_match_any_interface
 
- usb_amd_resume_quirk
 
- usb_detect_static_quirks
 
- usb_detect_dynamic_quirks
 
- usb_detect_quirks
 
- usb_detect_interface_quirks
 
- usb_release_quirk_list
 
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 #include <linux/moduleparam.h>
  10 #include <linux/usb.h>
  11 #include <linux/usb/quirks.h>
  12 #include <linux/usb/hcd.h>
  13 #include "usb.h"
  14 
  15 struct quirk_entry {
  16         u16 vid;
  17         u16 pid;
  18         u32 flags;
  19 };
  20 
  21 static DEFINE_MUTEX(quirk_mutex);
  22 
  23 static struct quirk_entry *quirk_list;
  24 static unsigned int quirk_count;
  25 
  26 static char quirks_param[128];
  27 
  28 static int quirks_param_set(const char *val, const struct kernel_param *kp)
  29 {
  30         char *p, *field;
  31         u16 vid, pid;
  32         u32 flags;
  33         size_t i;
  34         int err;
  35 
  36         err = param_set_copystring(val, kp);
  37         if (err)
  38                 return err;
  39 
  40         mutex_lock(&quirk_mutex);
  41 
  42         if (!*val) {
  43                 quirk_count = 0;
  44                 kfree(quirk_list);
  45                 quirk_list = NULL;
  46                 goto unlock;
  47         }
  48 
  49         for (quirk_count = 1, i = 0; val[i]; i++)
  50                 if (val[i] == ',')
  51                         quirk_count++;
  52 
  53         if (quirk_list) {
  54                 kfree(quirk_list);
  55                 quirk_list = NULL;
  56         }
  57 
  58         quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
  59                              GFP_KERNEL);
  60         if (!quirk_list) {
  61                 quirk_count = 0;
  62                 mutex_unlock(&quirk_mutex);
  63                 return -ENOMEM;
  64         }
  65 
  66         for (i = 0, p = (char *)val; p && *p;) {
  67                 
  68                 field = strsep(&p, ":");
  69                 if (!field)
  70                         break;
  71 
  72                 if (kstrtou16(field, 16, &vid))
  73                         break;
  74 
  75                 field = strsep(&p, ":");
  76                 if (!field)
  77                         break;
  78 
  79                 if (kstrtou16(field, 16, &pid))
  80                         break;
  81 
  82                 field = strsep(&p, ",");
  83                 if (!field || !*field)
  84                         break;
  85 
  86                 
  87                 for (flags = 0; *field; field++) {
  88                         switch (*field) {
  89                         case 'a':
  90                                 flags |= USB_QUIRK_STRING_FETCH_255;
  91                                 break;
  92                         case 'b':
  93                                 flags |= USB_QUIRK_RESET_RESUME;
  94                                 break;
  95                         case 'c':
  96                                 flags |= USB_QUIRK_NO_SET_INTF;
  97                                 break;
  98                         case 'd':
  99                                 flags |= USB_QUIRK_CONFIG_INTF_STRINGS;
 100                                 break;
 101                         case 'e':
 102                                 flags |= USB_QUIRK_RESET;
 103                                 break;
 104                         case 'f':
 105                                 flags |= USB_QUIRK_HONOR_BNUMINTERFACES;
 106                                 break;
 107                         case 'g':
 108                                 flags |= USB_QUIRK_DELAY_INIT;
 109                                 break;
 110                         case 'h':
 111                                 flags |= USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL;
 112                                 break;
 113                         case 'i':
 114                                 flags |= USB_QUIRK_DEVICE_QUALIFIER;
 115                                 break;
 116                         case 'j':
 117                                 flags |= USB_QUIRK_IGNORE_REMOTE_WAKEUP;
 118                                 break;
 119                         case 'k':
 120                                 flags |= USB_QUIRK_NO_LPM;
 121                                 break;
 122                         case 'l':
 123                                 flags |= USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL;
 124                                 break;
 125                         case 'm':
 126                                 flags |= USB_QUIRK_DISCONNECT_SUSPEND;
 127                                 break;
 128                         case 'n':
 129                                 flags |= USB_QUIRK_DELAY_CTRL_MSG;
 130                                 break;
 131                         case 'o':
 132                                 flags |= USB_QUIRK_HUB_SLOW_RESET;
 133                                 break;
 134                         
 135                         }
 136                 }
 137 
 138                 quirk_list[i++] = (struct quirk_entry)
 139                         { .vid = vid, .pid = pid, .flags = flags };
 140         }
 141 
 142         if (i < quirk_count)
 143                 quirk_count = i;
 144 
 145 unlock:
 146         mutex_unlock(&quirk_mutex);
 147 
 148         return 0;
 149 }
 150 
 151 static const struct kernel_param_ops quirks_param_ops = {
 152         .set = quirks_param_set,
 153         .get = param_get_string,
 154 };
 155 
 156 static struct kparam_string quirks_param_string = {
 157         .maxlen = sizeof(quirks_param),
 158         .string = quirks_param,
 159 };
 160 
 161 device_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0644);
 162 MODULE_PARM_DESC(quirks, "Add/modify USB quirks by specifying quirks=vendorID:productID:quirks");
 163 
 164 
 165 
 166 
 167 
 168 
 169 
 170 
 171 
 172 
 173 
 174 
 175 
 176 
 177 
 178 
 179 
 180 
 181 static const struct usb_device_id usb_quirk_list[] = {
 182         
 183         { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
 184 
 185         
 186         { USB_DEVICE(0x0218, 0x0201), .driver_info =
 187                         USB_QUIRK_CONFIG_INTF_STRINGS },
 188 
 189         
 190         { USB_DEVICE(0x0218, 0x0401), .driver_info =
 191                         USB_QUIRK_CONFIG_INTF_STRINGS },
 192 
 193         
 194         { USB_DEVICE(0x03f0, 0x0701), .driver_info =
 195                         USB_QUIRK_STRING_FETCH_255 },
 196 
 197         
 198         { USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT },
 199 
 200         
 201         { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
 202 
 203         
 204         { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
 205 
 206         
 207         { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },
 208 
 209         
 210         { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
 211 
 212         
 213         { USB_DEVICE(0x045e, 0x07c6), .driver_info = USB_QUIRK_NO_LPM },
 214 
 215         
 216         { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME },
 217 
 218         
 219         { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
 220 
 221         
 222         { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
 223         { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
 224         { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
 225         { USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT },
 226 
 227         
 228         { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
 229         { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT },
 230 
 231         
 232         { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
 233 
 234         
 235         { USB_DEVICE(0x046d, 0x086c), .driver_info = USB_QUIRK_NO_LPM },
 236 
 237         
 238         { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
 239 
 240         
 241         { USB_DEVICE(0x046d, 0x08c2), .driver_info = USB_QUIRK_RESET_RESUME },
 242 
 243         
 244         { USB_DEVICE(0x046d, 0x08c3), .driver_info = USB_QUIRK_RESET_RESUME },
 245 
 246         
 247         { USB_DEVICE(0x046d, 0x08c5), .driver_info = USB_QUIRK_RESET_RESUME },
 248 
 249         
 250         { USB_DEVICE(0x046d, 0x08c6), .driver_info = USB_QUIRK_RESET_RESUME },
 251 
 252         
 253         { USB_DEVICE(0x046d, 0x08c7), .driver_info = USB_QUIRK_RESET_RESUME },
 254 
 255         
 256         { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
 257 
 258         
 259         { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
 260 
 261         
 262         { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME },
 263 
 264         
 265         { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME },
 266 
 267         
 268         { USB_DEVICE(0x04b4, 0x0526), .driver_info =
 269                         USB_QUIRK_CONFIG_INTF_STRINGS },
 270 
 271         
 272         { USB_DEVICE(0x04d8, 0x000c), .driver_info =
 273                         USB_QUIRK_CONFIG_INTF_STRINGS },
 274 
 275         
 276         { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME },
 277 
 278         
 279         { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME },
 280 
 281         
 282         { USB_DEVICE(0x04e8, 0x6601), .driver_info =
 283                         USB_QUIRK_CONFIG_INTF_STRINGS },
 284 
 285         
 286         { USB_DEVICE(0x04f3, 0x0089), .driver_info =
 287                         USB_QUIRK_DEVICE_QUALIFIER },
 288 
 289         { USB_DEVICE(0x04f3, 0x009b), .driver_info =
 290                         USB_QUIRK_DEVICE_QUALIFIER },
 291 
 292         { USB_DEVICE(0x04f3, 0x010c), .driver_info =
 293                         USB_QUIRK_DEVICE_QUALIFIER },
 294 
 295         { USB_DEVICE(0x04f3, 0x0125), .driver_info =
 296                         USB_QUIRK_DEVICE_QUALIFIER },
 297 
 298         { USB_DEVICE(0x04f3, 0x016f), .driver_info =
 299                         USB_QUIRK_DEVICE_QUALIFIER },
 300 
 301         { USB_DEVICE(0x04f3, 0x0381), .driver_info =
 302                         USB_QUIRK_NO_LPM },
 303 
 304         { USB_DEVICE(0x04f3, 0x21b8), .driver_info =
 305                         USB_QUIRK_DEVICE_QUALIFIER },
 306 
 307         
 308         { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
 309 
 310         
 311         { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
 312 
 313         
 314         { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME },
 315 
 316         
 317         { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
 318 
 319         
 320         { USB_DEVICE(0x05e3, 0x0612), .driver_info = USB_QUIRK_NO_LPM },
 321 
 322         
 323         { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_RESET_RESUME },
 324 
 325         
 326         { USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM },
 327 
 328         
 329         { USB_DEVICE(0x0638, 0x0a13), .driver_info =
 330           USB_QUIRK_STRING_FETCH_255 },
 331 
 332         
 333         { USB_DEVICE(0x06a3, 0x0006), .driver_info =
 334                         USB_QUIRK_CONFIG_INTF_STRINGS },
 335 
 336         
 337         { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
 338 
 339         
 340         { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
 341 
 342         
 343         { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
 344 
 345         
 346         { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM },
 347         { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM },
 348 
 349         
 350         { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
 351 
 352         
 353         { USB_DEVICE(0x0904, 0x6101), .driver_info =
 354                         USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
 355         { USB_DEVICE(0x0904, 0x6102), .driver_info =
 356                         USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
 357         { USB_DEVICE(0x0904, 0x6103), .driver_info =
 358                         USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
 359 
 360         
 361         { USB_DEVICE(0x0926, 0x0202), .driver_info =
 362                         USB_QUIRK_ENDPOINT_BLACKLIST },
 363 
 364         
 365         { USB_DEVICE(0x0926, 0x3333), .driver_info =
 366                         USB_QUIRK_CONFIG_INTF_STRINGS },
 367 
 368         
 369         { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
 370 
 371         
 372         { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
 373 
 374         
 375         { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME },
 376 
 377         
 378         { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
 379                         USB_QUIRK_IGNORE_REMOTE_WAKEUP },
 380 
 381         
 382         { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
 383 
 384         
 385         { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM },
 386 
 387         
 388         { USB_DEVICE(0x10d6, 0x2200), .driver_info =
 389                         USB_QUIRK_STRING_FETCH_255 },
 390 
 391         
 392         { USB_DEVICE(0x12d1, 0x15bb), .driver_info =
 393                         USB_QUIRK_DISCONNECT_SUSPEND },
 394         { USB_DEVICE(0x12d1, 0x15c3), .driver_info =
 395                         USB_QUIRK_DISCONNECT_SUSPEND },
 396 
 397         
 398         { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME },
 399 
 400         
 401         { USB_DEVICE(0x1532, 0x0116), .driver_info =
 402                         USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
 403 
 404         
 405         { USB_DEVICE(0x1908, 0x1315), .driver_info =
 406                         USB_QUIRK_HONOR_BNUMINTERFACES },
 407 
 408         
 409         { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
 410                         USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
 411 
 412         
 413         { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET },
 414 
 415         
 416         { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT |
 417           USB_QUIRK_DELAY_CTRL_MSG },
 418 
 419         
 420         { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
 421           USB_QUIRK_DELAY_CTRL_MSG },
 422 
 423         
 424         { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
 425           USB_QUIRK_DELAY_CTRL_MSG },
 426 
 427         
 428         { USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT },
 429 
 430         
 431         { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
 432 
 433         
 434         { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT |
 435           USB_QUIRK_DELAY_CTRL_MSG },
 436 
 437         
 438         { USB_DEVICE(0x1c75, 0x0204), .driver_info =
 439                         USB_QUIRK_CONFIG_INTF_STRINGS },
 440 
 441         
 442         { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM },
 443 
 444         
 445         { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM },
 446 
 447         
 448         { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM },
 449 
 450         
 451         { USB_DEVICE(0x2040, 0x7200), .driver_info =
 452                         USB_QUIRK_CONFIG_INTF_STRINGS },
 453 
 454         
 455         { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM },
 456 
 457         { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
 458 
 459         
 460         { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
 461 
 462         
 463         { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 464 
 465         
 466         { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME },
 467 
 468         { }  
 469 };
 470 
 471 static const struct usb_device_id usb_interface_quirk_list[] = {
 472         
 473         { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0),
 474           .driver_info = USB_QUIRK_RESET_RESUME },
 475 
 476         { }  
 477 };
 478 
 479 static const struct usb_device_id usb_amd_resume_quirk_list[] = {
 480         
 481         { USB_DEVICE(0x17ef, 0x602e), .driver_info = USB_QUIRK_RESET_RESUME },
 482 
 483         
 484         { USB_DEVICE(0x093a, 0x2500), .driver_info = USB_QUIRK_RESET_RESUME },
 485         { USB_DEVICE(0x093a, 0x2510), .driver_info = USB_QUIRK_RESET_RESUME },
 486         { USB_DEVICE(0x093a, 0x2521), .driver_info = USB_QUIRK_RESET_RESUME },
 487         { USB_DEVICE(0x03f0, 0x2b4a), .driver_info = USB_QUIRK_RESET_RESUME },
 488 
 489         
 490         { USB_DEVICE(0x046d, 0xc05a), .driver_info = USB_QUIRK_RESET_RESUME },
 491 
 492         { }  
 493 };
 494 
 495 
 496 
 497 
 498 
 499 
 500 
 501 static const struct usb_device_id usb_endpoint_blacklist[] = {
 502         { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 },
 503         { }
 504 };
 505 
 506 bool usb_endpoint_is_blacklisted(struct usb_device *udev,
 507                 struct usb_host_interface *intf,
 508                 struct usb_endpoint_descriptor *epd)
 509 {
 510         const struct usb_device_id *id;
 511         unsigned int address;
 512 
 513         for (id = usb_endpoint_blacklist; id->match_flags; ++id) {
 514                 if (!usb_match_device(udev, id))
 515                         continue;
 516 
 517                 if (!usb_match_one_id_intf(udev, intf, id))
 518                         continue;
 519 
 520                 address = id->driver_info;
 521                 if (address == epd->bEndpointAddress)
 522                         return true;
 523         }
 524 
 525         return false;
 526 }
 527 
 528 static bool usb_match_any_interface(struct usb_device *udev,
 529                                     const struct usb_device_id *id)
 530 {
 531         unsigned int i;
 532 
 533         for (i = 0; i < udev->descriptor.bNumConfigurations; ++i) {
 534                 struct usb_host_config *cfg = &udev->config[i];
 535                 unsigned int j;
 536 
 537                 for (j = 0; j < cfg->desc.bNumInterfaces; ++j) {
 538                         struct usb_interface_cache *cache;
 539                         struct usb_host_interface *intf;
 540 
 541                         cache = cfg->intf_cache[j];
 542                         if (cache->num_altsetting == 0)
 543                                 continue;
 544 
 545                         intf = &cache->altsetting[0];
 546                         if (usb_match_one_id_intf(udev, intf, id))
 547                                 return true;
 548                 }
 549         }
 550 
 551         return false;
 552 }
 553 
 554 static int usb_amd_resume_quirk(struct usb_device *udev)
 555 {
 556         struct usb_hcd *hcd;
 557 
 558         hcd = bus_to_hcd(udev->bus);
 559         
 560         if (udev->level == 1 && hcd->amd_resume_bug == 1)
 561                 return 1;
 562 
 563         return 0;
 564 }
 565 
 566 static u32 usb_detect_static_quirks(struct usb_device *udev,
 567                                     const struct usb_device_id *id)
 568 {
 569         u32 quirks = 0;
 570 
 571         for (; id->match_flags; id++) {
 572                 if (!usb_match_device(udev, id))
 573                         continue;
 574 
 575                 if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_INFO) &&
 576                     !usb_match_any_interface(udev, id))
 577                         continue;
 578 
 579                 quirks |= (u32)(id->driver_info);
 580         }
 581 
 582         return quirks;
 583 }
 584 
 585 static u32 usb_detect_dynamic_quirks(struct usb_device *udev)
 586 {
 587         u16 vid = le16_to_cpu(udev->descriptor.idVendor);
 588         u16 pid = le16_to_cpu(udev->descriptor.idProduct);
 589         int i, flags = 0;
 590 
 591         mutex_lock(&quirk_mutex);
 592 
 593         for (i = 0; i < quirk_count; i++) {
 594                 if (vid == quirk_list[i].vid && pid == quirk_list[i].pid) {
 595                         flags = quirk_list[i].flags;
 596                         break;
 597                 }
 598         }
 599 
 600         mutex_unlock(&quirk_mutex);
 601 
 602         return flags;
 603 }
 604 
 605 
 606 
 607 
 608 void usb_detect_quirks(struct usb_device *udev)
 609 {
 610         udev->quirks = usb_detect_static_quirks(udev, usb_quirk_list);
 611 
 612         
 613 
 614 
 615 
 616         if (usb_amd_resume_quirk(udev))
 617                 udev->quirks |= usb_detect_static_quirks(udev,
 618                                 usb_amd_resume_quirk_list);
 619 
 620         udev->quirks ^= usb_detect_dynamic_quirks(udev);
 621 
 622         if (udev->quirks)
 623                 dev_dbg(&udev->dev, "USB quirks for this device: %x\n",
 624                         udev->quirks);
 625 
 626 #ifdef CONFIG_USB_DEFAULT_PERSIST
 627         if (!(udev->quirks & USB_QUIRK_RESET))
 628                 udev->persist_enabled = 1;
 629 #else
 630         
 631         if (udev->descriptor.bDeviceClass == USB_CLASS_HUB)
 632                 udev->persist_enabled = 1;
 633 #endif  
 634 }
 635 
 636 void usb_detect_interface_quirks(struct usb_device *udev)
 637 {
 638         u32 quirks;
 639 
 640         quirks = usb_detect_static_quirks(udev, usb_interface_quirk_list);
 641         if (quirks == 0)
 642                 return;
 643 
 644         dev_dbg(&udev->dev, "USB interface quirks for this device: %x\n",
 645                 quirks);
 646         udev->quirks |= quirks;
 647 }
 648 
 649 void usb_release_quirk_list(void)
 650 {
 651         mutex_lock(&quirk_mutex);
 652         kfree(quirk_list);
 653         quirk_list = NULL;
 654         mutex_unlock(&quirk_mutex);
 655 }