Diff for /src/sys/bus/usb/usb_subr.c between versions 1.6 and 1.7

version 1.6, 2003/12/30 01:01:44 version 1.7, 2004/02/11 15:17:26
Line 53 Line 53
 #if defined(__NetBSD__) || defined(__OpenBSD__)  #if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>  #include <sys/device.h>
 #include <sys/select.h>  #include <sys/select.h>
#elif defined(__FreeBSD__)#elif defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/module.h>  #include <sys/module.h>
 #include <sys/bus.h>  #include <sys/bus.h>
 #endif  #endif
Line 69 Line 69
 #include "usbdevs.h"  #include "usbdevs.h"
 #include "usb_quirks.h"  #include "usb_quirks.h"
   
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <machine/clock.h>  #include <machine/clock.h>
 #define delay(d)         DELAY(d)  #define delay(d)         DELAY(d)
 #endif  #endif
Line 811  usbd_probe_and_attach(device_ptr_t paren Line 811  usbd_probe_and_attach(device_ptr_t paren
         device_ptr_t dv;          device_ptr_t dv;
         usbd_interface_handle ifaces[256]; /* 256 is the absolute max */          usbd_interface_handle ifaces[256]; /* 256 is the absolute max */
   
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
         /*          /*
          * XXX uaa is a static var. Not a problem as it _should_ be used only           * XXX uaa is a static var. Not a problem as it _should_ be used only
          * during probe and attach. Should be changed however.           * during probe and attach. Should be changed however.
Line 868  usbd_probe_and_attach(device_ptr_t paren Line 868  usbd_probe_and_attach(device_ptr_t paren
                         printf("%s: port %d, set config at addr %d failed\n",                          printf("%s: port %d, set config at addr %d failed\n",
                                USBDEVPTRNAME(parent), port, addr);                                 USBDEVPTRNAME(parent), port, addr);
 #endif  #endif
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
                         device_delete_child(parent, bdev);                          device_delete_child(parent, bdev);
 #endif  #endif
   
Line 882  usbd_probe_and_attach(device_ptr_t paren Line 882  usbd_probe_and_attach(device_ptr_t paren
                 uaa.nifaces = nifaces;                  uaa.nifaces = nifaces;
                 dev->subdevs = malloc((nifaces+1) * sizeof dv, M_USB,M_NOWAIT);                  dev->subdevs = malloc((nifaces+1) * sizeof dv, M_USB,M_NOWAIT);
                 if (dev->subdevs == NULL) {                  if (dev->subdevs == NULL) {
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
                         device_delete_child(parent, bdev);                          device_delete_child(parent, bdev);
 #endif  #endif
                         return (USBD_NOMEM);                          return (USBD_NOMEM);
Line 901  usbd_probe_and_attach(device_ptr_t paren Line 901  usbd_probe_and_attach(device_ptr_t paren
                                 dev->subdevs[found] = 0;                                  dev->subdevs[found] = 0;
                                 ifaces[i] = 0; /* consumed */                                  ifaces[i] = 0; /* consumed */
   
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
                                 /* create another child for the next iface */                                  /* create another child for the next iface */
                                 bdev = device_add_child(parent, NULL, -1);                                  bdev = device_add_child(parent, NULL, -1);
                                 if (!bdev) {                                  if (!bdev) {
Line 915  usbd_probe_and_attach(device_ptr_t paren Line 915  usbd_probe_and_attach(device_ptr_t paren
                         }                          }
                 }                  }
                 if (found != 0) {                  if (found != 0) {
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
                         /* remove the last created child again; it is unused */                          /* remove the last created child again; it is unused */
                         device_delete_child(parent, bdev);                          device_delete_child(parent, bdev);
 #endif  #endif
Line 952  usbd_probe_and_attach(device_ptr_t paren Line 952  usbd_probe_and_attach(device_ptr_t paren
          * fully operational and not harming anyone.           * fully operational and not harming anyone.
          */           */
         DPRINTF(("usbd_probe_and_attach: generic attach failed\n"));          DPRINTF(("usbd_probe_and_attach: generic attach failed\n"));
#if defined(__FreeBSD__)#if defined(__FreeBSD__) || defined(__DragonFly__)
         device_delete_child(parent, bdev);          device_delete_child(parent, bdev);
 #endif  #endif
         return (USBD_NORMAL_COMPLETION);          return (USBD_NORMAL_COMPLETION);

Removed from v.1.6  
changed lines
  Added in v.1.7