[BACK]Return to usb_subr.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / usb

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/usb/usb_subr.c between version 1.198.2.38 and 1.198.2.39

version 1.198.2.38, 2016/12/29 08:40:27 version 1.198.2.39, 2017/01/03 12:50:50
Line 832  usbd_getnewaddr(struct usbd_bus *bus)
Line 832  usbd_getnewaddr(struct usbd_bus *bus)
 {  {
         int addr;          int addr;
   
         for (addr = 1; addr < USB_MAX_DEVICES; addr++)          for (addr = 1; addr < USB_MAX_DEVICES; addr++) {
                 if (bus->ub_devices[addr] == NULL)                  size_t dindex = usb_addr2dindex(addr);
                   if (bus->ub_devices[dindex] == NULL)
                         return addr;                          return addr;
           }
         return -1;          return -1;
 }  }
   
Line 1336  usbd_new_device(device_t parent, struct 
Line 1338  usbd_new_device(device_t parent, struct 
         /* Allow device time to set new address */          /* Allow device time to set new address */
         usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);          usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
         dev->ud_addr = addr;    /* new device address now */          dev->ud_addr = addr;    /* new device address now */
         bus->ub_devices[addr] = dev;          bus->ub_devices[usb_addr2dindex(addr)] = dev;
   
         /* Re-establish the default pipe with the new address. */          /* Re-establish the default pipe with the new address. */
         usbd_kill_pipe(dev->ud_pipe0);          usbd_kill_pipe(dev->ud_pipe0);
Line 1428  usbd_remove_device(struct usbd_device *d
Line 1430  usbd_remove_device(struct usbd_device *d
         if (dev->ud_pipe0 != NULL)          if (dev->ud_pipe0 != NULL)
                 usbd_kill_pipe(dev->ud_pipe0);                  usbd_kill_pipe(dev->ud_pipe0);
         up->up_dev = NULL;          up->up_dev = NULL;
         dev->ud_bus->ub_devices[dev->ud_addr] = NULL;          dev->ud_bus->ub_devices[usb_addr2dindex(dev->ud_addr)] = NULL;
   
         kmem_free(dev, sizeof(*dev));          kmem_free(dev, sizeof(*dev));
 }  }
Line 1737  usb_disconnect_port(struct usbd_port *up
Line 1739  usb_disconnect_port(struct usbd_port *up
         }          }
   
         mutex_enter(dev->ud_bus->ub_lock);          mutex_enter(dev->ud_bus->ub_lock);
         dev->ud_bus->ub_devices[dev->ud_addr] = NULL;          dev->ud_bus->ub_devices[usb_addr2dindex(dev->ud_addr)] = NULL;
         up->up_dev = NULL;          up->up_dev = NULL;
         mutex_exit(dev->ud_bus->ub_lock);          mutex_exit(dev->ud_bus->ub_lock);
   

Legend:
Removed from v.1.198.2.38  
changed lines
  Added in v.1.198.2.39

CVSweb <webmaster@jp.NetBSD.org>