Advertisement
Pavle_nis

s3 i9305 driver.c

Jun 17th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. #define DO_UNBIND   0
  2. #define DO_REBIND   1
  3.  
  4. /* Unbind drivers for @udev's interfaces that don't support suspend/resume,
  5.  * or rebind interfaces that have been unbound, according to @action.
  6.  *
  7.  * The caller must hold @udev's device lock.
  8.  */
  9. static void do_unbind_rebind(struct usb_device *udev, int action)
  10. {
  11.     struct usb_host_config  *config;
  12.     int         i;
  13.     struct usb_interface    *intf;
  14.     struct usb_driver   *drv;
  15.  
  16.     config = udev->actconfig;
  17.     if (config) {
  18.         for (i = 0; i < config->desc.bNumInterfaces; ++i) {
  19.             intf = config->interface[i];
  20.             switch (action) {
  21.             case DO_UNBIND:
  22.                 if (intf->dev.driver) {
  23.                     drv = to_usb_driver(intf->dev.driver);
  24.                     if (!drv->suspend || !drv->resume)
  25.                         usb_forced_unbind_intf(intf);
  26.                 }
  27.                 break;
  28.             case DO_REBIND:
  29.                 if (intf->needs_binding)
  30.                     usb_rebind_intf(intf);
  31.                 break;
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement