Sync with NetBSD. Non-functional changes that bring this file

closer to the NetBSD version.

Reviewed by:	md5
This commit is contained in:
Josef Karthauser 2002-01-02 21:56:02 +00:00
parent c1201321e4
commit 7ccc786694

View File

@ -148,7 +148,7 @@ struct cdevsw usb_cdevsw = {
}; };
#endif #endif
Static usbd_status usb_discover(struct usb_softc *); Static usbd_status usb_discover(void *);
Static void usb_create_event_thread(void *); Static void usb_create_event_thread(void *);
Static void usb_event_thread(void *); Static void usb_event_thread(void *);
@ -161,7 +161,7 @@ Static TAILQ_HEAD(, usb_event_q) usb_events =
TAILQ_HEAD_INITIALIZER(usb_events); TAILQ_HEAD_INITIALIZER(usb_events);
Static int usb_nevents = 0; Static int usb_nevents = 0;
Static struct selinfo usb_selevent; Static struct selinfo usb_selevent;
Static struct proc *usb_async_proc; /* process who wants USB SIGIO */ Static struct proc *usb_async_proc; /* process that wants USB SIGIO */
Static int usb_dev_open = 0; Static int usb_dev_open = 0;
Static int usb_get_next_event(struct usb_event *); Static int usb_get_next_event(struct usb_event *);
@ -273,8 +273,7 @@ USB_ATTACH(usb)
} }
void void
usb_create_event_thread(arg) usb_create_event_thread(void *arg)
void *arg;
{ {
struct usb_softc *sc = arg; struct usb_softc *sc = arg;
@ -287,8 +286,7 @@ usb_create_event_thread(arg)
} }
void void
usb_event_thread(arg) usb_event_thread(void *arg)
void *arg;
{ {
struct usb_softc *sc = arg; struct usb_softc *sc = arg;
int to; int to;
@ -312,7 +310,7 @@ usb_event_thread(arg)
(void)tsleep(&sc->sc_bus->needs_explore, PWAIT, "usbevt", to); (void)tsleep(&sc->sc_bus->needs_explore, PWAIT, "usbevt", to);
DPRINTFN(2,("usb_event_thread: woke up\n")); DPRINTFN(2,("usb_event_thread: woke up\n"));
} }
sc->sc_event_thread = 0; sc->sc_event_thread = NULL;
/* In case parent is waiting for us to exit. */ /* In case parent is waiting for us to exit. */
wakeup(sc); wakeup(sc);
@ -323,9 +321,7 @@ usb_event_thread(arg)
#if defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
int int
usbctlprint(aux, pnp) usbctlprint(void *aux, const char *pnp)
void *aux;
const char *pnp;
{ {
/* only "usb"es can attach to host controllers */ /* only "usb"es can attach to host controllers */
if (pnp) if (pnp)
@ -336,10 +332,7 @@ usbctlprint(aux, pnp)
#endif /* defined(__NetBSD__) || defined(__OpenBSD__) */ #endif /* defined(__NetBSD__) || defined(__OpenBSD__) */
int int
usbopen(dev, flag, mode, p) usbopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
dev_t dev;
int flag, mode;
usb_proc_ptr p;
{ {
int unit = USBUNIT(dev); int unit = USBUNIT(dev);
struct usb_softc *sc; struct usb_softc *sc;
@ -361,10 +354,7 @@ usbopen(dev, flag, mode, p)
} }
int int
usbread(dev, uio, flag) usbread(dev_t dev, struct uio *uio, int flag)
dev_t dev;
struct uio *uio;
int flag;
{ {
struct usb_event ue; struct usb_event ue;
int unit = USBUNIT(dev); int unit = USBUNIT(dev);
@ -398,10 +388,7 @@ usbread(dev, uio, flag)
} }
int int
usbclose(dev, flag, mode, p) usbclose(dev_t dev, int flag, int mode, usb_proc_ptr p)
dev_t dev;
int flag, mode;
usb_proc_ptr p;
{ {
int unit = USBUNIT(dev); int unit = USBUNIT(dev);
@ -414,12 +401,7 @@ usbclose(dev, flag, mode, p)
} }
int int
usbioctl(devt, cmd, data, flag, p) usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
dev_t devt;
u_long cmd;
caddr_t data;
int flag;
usb_proc_ptr p;
{ {
struct usb_softc *sc; struct usb_softc *sc;
int unit = USBUNIT(devt); int unit = USBUNIT(devt);
@ -463,7 +445,7 @@ usbioctl(devt, cmd, data, flag, p)
ohcidebug = ((*(int *)data) & 0x00ff0000) >> 16; ohcidebug = ((*(int *)data) & 0x00ff0000) >> 16;
#endif #endif
break; break;
#endif #endif /* USB_DEBUG */
case USB_REQUEST: case USB_REQUEST:
{ {
struct usb_ctl_request *ur = (void *)data; struct usb_ctl_request *ur = (void *)data;
@ -528,7 +510,7 @@ usbioctl(devt, cmd, data, flag, p)
if (addr < 1 || addr >= USB_MAX_DEVICES) if (addr < 1 || addr >= USB_MAX_DEVICES)
return (EINVAL); return (EINVAL);
dev = sc->sc_bus->devices[addr]; dev = sc->sc_bus->devices[addr];
if (dev == 0) if (dev == NULL)
return (ENXIO); return (ENXIO);
usbd_fill_deviceinfo(dev, di, 1); usbd_fill_deviceinfo(dev, di, 1);
break; break;
@ -545,10 +527,7 @@ usbioctl(devt, cmd, data, flag, p)
} }
int int
usbpoll(dev, events, p) usbpoll(dev_t dev, int events, usb_proc_ptr p)
dev_t dev;
int events;
usb_proc_ptr p;
{ {
int revents, mask, s; int revents, mask, s;
int unit = USBUNIT(dev); int unit = USBUNIT(dev);
@ -556,16 +535,14 @@ usbpoll(dev, events, p)
if (unit == USB_DEV_MINOR) { if (unit == USB_DEV_MINOR) {
revents = 0; revents = 0;
mask = POLLIN | POLLRDNORM; mask = POLLIN | POLLRDNORM;
s = splusb(); s = splusb();
if ((events & mask) && usb_nevents > 0) if (events & mask && usb_nevents > 0)
revents |= events & mask; revents |= events & mask;
if (revents == 0 && (events & mask)) { if (revents == 0 && events & mask)
DPRINTFN(2,("usb: sleeping on %p\n", &usb_selevent));
selrecord(p, &usb_selevent); selrecord(p, &usb_selevent);
}
splx(s); splx(s);
return (revents); return (revents);
} else { } else {
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
@ -578,9 +555,10 @@ usbpoll(dev, events, p)
/* Explore device tree from the root. */ /* Explore device tree from the root. */
usbd_status usbd_status
usb_discover(sc) usb_discover(void *v)
struct usb_softc *sc;
{ {
struct usb_softc *sc = v;
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
/* splxxx should be changed to mutexes for preemption safety some day */ /* splxxx should be changed to mutexes for preemption safety some day */
int s; int s;
@ -612,8 +590,7 @@ usb_discover(sc)
} }
void void
usb_needs_explore(bus) usb_needs_explore(usbd_bus_handle bus)
usbd_bus_handle bus;
{ {
bus->needs_explore = 1; bus->needs_explore = 1;
wakeup(&bus->needs_explore); wakeup(&bus->needs_explore);
@ -621,8 +598,7 @@ usb_needs_explore(bus)
/* Called at splusb() */ /* Called at splusb() */
int int
usb_get_next_event(ue) usb_get_next_event(struct usb_event *ue)
struct usb_event *ue;
{ {
struct usb_event_q *ueq; struct usb_event_q *ueq;
@ -642,9 +618,7 @@ usb_get_next_event(ue)
} }
void void
usbd_add_event(type, dev) usbd_add_event(int type, usbd_device_handle dev)
int type;
usbd_device_handle dev;
{ {
struct usb_event_q *ueq, *ueq_next; struct usb_event_q *ueq, *ueq_next;
struct usb_event ue; struct usb_event ue;
@ -694,9 +668,7 @@ usbd_add_event(type, dev)
#if defined(__NetBSD__) || defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
int int
usb_activate(self, act) usb_activate(device_ptr_t self, enum devact act)
device_ptr_t self;
enum devact act;
{ {
struct usb_softc *sc = (struct usb_softc *)self; struct usb_softc *sc = (struct usb_softc *)self;
usbd_device_handle dev = sc->sc_port.device; usbd_device_handle dev = sc->sc_port.device;
@ -719,9 +691,7 @@ usb_activate(self, act)
} }
int int
usb_detach(self, flags) usb_detach(device_ptr_t self, int flags)
device_ptr_t self;
int flags;
{ {
struct usb_softc *sc = (struct usb_softc *)self; struct usb_softc *sc = (struct usb_softc *)self;