Change the way the `struct device' base part of all driver softc are
declared and accessed to make it more portable. Idea from Nick Hibma, FreeBSD. No functional changes.
This commit is contained in:
parent
6cbab8a473
commit
24251055bc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ugen.c,v 1.21 1999/09/04 22:26:11 augustss Exp $ */
|
||||
/* $NetBSD: ugen.c,v 1.22 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -93,7 +93,7 @@ struct ugen_endpoint {
|
|||
#define UGEN_BBSIZE 1024
|
||||
|
||||
struct ugen_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
|
||||
char sc_is_open[USB_MAX_ENDPOINTS];
|
||||
|
@ -407,7 +407,9 @@ ugen_do_read(sc, endpt, uio, flag)
|
|||
int error = 0;
|
||||
u_char buffer[UGEN_CHUNK];
|
||||
|
||||
#ifdef __NetBSD__
|
||||
DPRINTFN(5, ("ugenread: %d:%d\n", sc->sc_dev.dv_unit, endpt));
|
||||
#endif
|
||||
if (sc->sc_dying)
|
||||
return (EIO);
|
||||
|
||||
|
@ -507,7 +509,7 @@ ugenread(dev, uio, flag)
|
|||
sc->sc_refcnt++;
|
||||
error = ugen_do_read(sc, endpt, uio, flag);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -581,13 +583,13 @@ ugenwrite(dev, uio, flag)
|
|||
sc->sc_refcnt++;
|
||||
error = ugen_do_write(sc, endpt, uio, flag);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
ugen_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct ugen_softc *sc = (struct ugen_softc *)self;
|
||||
|
@ -606,7 +608,7 @@ ugen_activate(self, act)
|
|||
|
||||
int
|
||||
ugen_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct ugen_softc *sc = (struct ugen_softc *)self;
|
||||
|
@ -633,7 +635,7 @@ ugen_detach(self, flags)
|
|||
for (i = 0; i < USB_MAX_ENDPOINTS; i++)
|
||||
wakeup(&sc->sc_endpoints[i][IN]);
|
||||
/* Wait for processes to go away. */
|
||||
usb_detach_wait(&sc->sc_dev);
|
||||
usb_detach_wait(USBDEV(sc->sc_dev));
|
||||
}
|
||||
splx(s);
|
||||
|
||||
|
@ -1077,7 +1079,7 @@ ugenioctl(dev, cmd, addr, flag, p)
|
|||
sc->sc_refcnt++;
|
||||
error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, p);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uhci.c,v 1.45 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: uhci.c,v 1.46 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -778,12 +778,12 @@ uhci_intr(arg)
|
|||
ack |= UHCI_STS_USBEI;
|
||||
if (status & UHCI_STS_RD) {
|
||||
ack |= UHCI_STS_RD;
|
||||
printf("%s: resume detect\n",
|
||||
USBDEVNAME(sc->sc_bus.bdev));
|
||||
printf("%s: resume detect\n", USBDEVNAME(sc->sc_bus.bdev));
|
||||
}
|
||||
if (status & UHCI_STS_HSE) {
|
||||
ack |= UHCI_STS_HSE;
|
||||
printf("%s: host controller process error\n", USBDEVNAME(sc->sc_bus.bdev));
|
||||
printf("%s: host controller process error\n",
|
||||
USBDEVNAME(sc->sc_bus.bdev));
|
||||
}
|
||||
if (status & UHCI_STS_HCPE) {
|
||||
ack |= UHCI_STS_HCPE;
|
||||
|
@ -791,7 +791,8 @@ uhci_intr(arg)
|
|||
}
|
||||
if (status & UHCI_STS_HCH) {
|
||||
/* no acknowledge needed */
|
||||
printf("%s: host controller halted\n", USBDEVNAME(sc->sc_bus.bdev));
|
||||
printf("%s: host controller halted\n",
|
||||
USBDEVNAME(sc->sc_bus.bdev));
|
||||
}
|
||||
|
||||
if (ack) /* acknowledge the ints */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uhid.c,v 1.23 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: uhid.c,v 1.24 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -81,7 +81,7 @@ int uhiddebug = 0;
|
|||
#endif
|
||||
|
||||
struct uhid_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
|
@ -239,7 +239,7 @@ USB_ATTACH(uhid)
|
|||
|
||||
int
|
||||
uhid_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct uhid_softc *sc = (struct uhid_softc *)self;
|
||||
|
@ -258,7 +258,7 @@ uhid_activate(self, act)
|
|||
|
||||
int
|
||||
uhid_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct uhid_softc *sc = (struct uhid_softc *)self;
|
||||
|
@ -277,7 +277,7 @@ uhid_detach(self, flags)
|
|||
/* Wake everyone */
|
||||
wakeup(&sc->sc_q);
|
||||
/* Wait for processes to go away. */
|
||||
usb_detach_wait(&sc->sc_dev);
|
||||
usb_detach_wait(USBDEV(sc->sc_dev));
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ uhidread(dev, uio, flag)
|
|||
sc->sc_refcnt++;
|
||||
error = uhid_do_read(sc, uio, flag);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ uhidwrite(dev, uio, flag)
|
|||
sc->sc_refcnt++;
|
||||
error = uhid_do_write(sc, uio, flag);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ uhidioctl(dev, cmd, addr, flag, p)
|
|||
sc->sc_refcnt++;
|
||||
error = uhid_do_ioctl(sc, cmd, addr, flag, p);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uhub.c,v 1.25 1999/09/02 18:13:50 augustss Exp $ */
|
||||
/* $NetBSD: uhub.c,v 1.26 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -68,7 +68,7 @@ extern int usbdebug;
|
|||
#endif
|
||||
|
||||
struct uhub_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_device_handle sc_hub; /* USB device */
|
||||
usbd_pipe_handle sc_ipipe; /* interrupt pipe */
|
||||
u_int8_t sc_status[1]; /* XXX more ports */
|
||||
|
@ -180,8 +180,7 @@ USB_ATTACH(uhub)
|
|||
if (!dev->self_powered && dev->powersrc->parent &&
|
||||
!dev->powersrc->parent->self_powered) {
|
||||
printf("%s: bus powered hub connected to bus powered hub, "
|
||||
"ignored\n",
|
||||
USBDEVNAME(sc->sc_dev));
|
||||
"ignored\n", USBDEVNAME(sc->sc_dev));
|
||||
goto bad;
|
||||
}
|
||||
|
||||
|
@ -395,7 +394,7 @@ uhub_explore(dev)
|
|||
continue;
|
||||
|
||||
/* Get device info and set its address. */
|
||||
r = usbd_new_device(&sc->sc_dev, dev->bus,
|
||||
r = usbd_new_device(USBDEV(sc->sc_dev), dev->bus,
|
||||
dev->depth + 1, status & UPS_LOW_SPEED,
|
||||
port, up);
|
||||
/* XXX retry a few times? */
|
||||
|
@ -467,10 +466,10 @@ uhub_disconnect_port(up)
|
|||
}
|
||||
|
||||
if (dev->subdevs) {
|
||||
hubname = USBDEVNAME(*up->parent->subdevs[0]);
|
||||
hubname = USBDEVPTRNAME(up->parent->subdevs[0]);
|
||||
for (i = 0; dev->subdevs[i]; i++) {
|
||||
printf("%s: at %s port %d (addr %d) disconnected\n",
|
||||
USBDEVNAME(*dev->subdevs[i]), hubname,
|
||||
USBDEVPTRNAME(dev->subdevs[i]), hubname,
|
||||
up->portno, dev->address);
|
||||
config_detach(dev->subdevs[i], DETACH_FORCE);
|
||||
}
|
||||
|
@ -489,7 +488,7 @@ uhub_disconnect_port(up)
|
|||
|
||||
int
|
||||
uhub_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
switch (act) {
|
||||
|
@ -509,7 +508,7 @@ uhub_activate(self, act)
|
|||
*/
|
||||
int
|
||||
uhub_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct uhub_softc *sc = (struct uhub_softc *)self;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ukbd.c,v 1.42 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: ukbd.c,v 1.43 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -167,7 +167,7 @@ static u_int8_t ukbd_trtab[256] = {
|
|||
#define MAXKEYS (NMOD+2*NKEYCODE)
|
||||
|
||||
struct ukbd_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
|
@ -390,7 +390,7 @@ ukbd_enable(v, on)
|
|||
|
||||
int
|
||||
ukbd_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct ukbd_softc *sc = (struct ukbd_softc *)self;
|
||||
|
@ -409,7 +409,7 @@ ukbd_activate(self, act)
|
|||
|
||||
int
|
||||
ukbd_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct ukbd_softc *sc = (struct ukbd_softc *)self;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ulpt.c,v 1.19 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: ulpt.c,v 1.20 1999/09/05 19:32:18 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -90,7 +90,7 @@ int ulptdebug = 0;
|
|||
#define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NOPAPER)
|
||||
|
||||
struct ulpt_softc {
|
||||
bdevice sc_dev;
|
||||
USBBASEDEVICE sc_dev;
|
||||
usbd_device_handle sc_udev; /* device */
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
int sc_ifaceno;
|
||||
|
@ -221,7 +221,7 @@ USB_ATTACH(ulpt)
|
|||
|
||||
int
|
||||
ulpt_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct ulpt_softc *sc = (struct ulpt_softc *)self;
|
||||
|
@ -240,7 +240,7 @@ ulpt_activate(self, act)
|
|||
|
||||
int
|
||||
ulpt_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct ulpt_softc *sc = (struct ulpt_softc *)self;
|
||||
|
@ -257,7 +257,7 @@ ulpt_detach(self, flags)
|
|||
if (--sc->sc_refcnt >= 0) {
|
||||
/* There is noone to wake, aborting the pipe is enough */
|
||||
/* Wait for processes to go away. */
|
||||
usb_detach_wait(&sc->sc_dev);
|
||||
usb_detach_wait(USBDEV(sc->sc_dev));
|
||||
}
|
||||
splx(s);
|
||||
|
||||
|
@ -453,7 +453,7 @@ ulptwrite(dev, uio, flags)
|
|||
sc->sc_refcnt++;
|
||||
error = ulpt_do_write(sc, uio, flags);
|
||||
if (--sc->sc_refcnt < 0)
|
||||
usb_detach_wakeup(&sc->sc_dev);
|
||||
usb_detach_wakeup(USBDEV(sc->sc_dev));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: umass.c,v 1.11 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: umass.c,v 1.12 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -130,7 +130,7 @@ int umassdebug = /* UDMASS_SCSI|UDMASS_BULK|UDMASS_USB */ 0;
|
|||
#endif
|
||||
|
||||
typedef struct umass_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_interface_handle sc_iface; /* the interface we use */
|
||||
|
||||
u_int8_t sc_bulkout; /* bulk-out Endpoint Address */
|
||||
|
@ -141,7 +141,7 @@ typedef struct umass_softc {
|
|||
struct scsipi_link sc_link; /* prototype for devs */
|
||||
struct scsipi_adapter sc_adapter;
|
||||
|
||||
bdevice *sc_child; /* child device, for detach */
|
||||
device_ptr_t sc_child; /* child device, for detach */
|
||||
|
||||
char sc_dying;
|
||||
} umass_softc_t;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: umodem.c,v 1.12 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: umodem.c,v 1.13 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -97,7 +97,7 @@ int umodemdebug = 0;
|
|||
#define UMODEMIBUFSIZE 64
|
||||
|
||||
struct umodem_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
|
||||
usbd_device_handle sc_udev; /* USB device */
|
||||
|
||||
|
@ -995,7 +995,7 @@ umodem_set_line_coding(sc, state)
|
|||
|
||||
int
|
||||
umodem_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct umodem_softc *sc = (struct umodem_softc *)self;
|
||||
|
@ -1014,7 +1014,7 @@ umodem_activate(self, act)
|
|||
|
||||
int
|
||||
umodem_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct umodem_softc *sc = (struct umodem_softc *)self;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ums.c,v 1.30 1999/09/04 22:26:12 augustss Exp $ */
|
||||
/* $NetBSD: ums.c,v 1.31 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -85,7 +85,7 @@ int umsdebug = 0;
|
|||
#define PS2BUTMASK 0x0f
|
||||
|
||||
struct ums_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_interface_handle sc_iface; /* interface */
|
||||
usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
|
||||
int sc_ep_addr;
|
||||
|
@ -297,7 +297,7 @@ USB_ATTACH(ums)
|
|||
|
||||
int
|
||||
ums_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
struct ums_softc *sc = (struct ums_softc *)self;
|
||||
|
@ -316,7 +316,7 @@ ums_activate(self, act)
|
|||
|
||||
int
|
||||
ums_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
struct ums_softc *sc = (struct ums_softc *)self;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb.c,v 1.18 1999/08/28 21:42:35 augustss Exp $ */
|
||||
/* $NetBSD: usb.c,v 1.19 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -90,7 +90,7 @@ int ohcidebug;
|
|||
#define USBUNIT(dev) (minor(dev))
|
||||
|
||||
struct usb_softc {
|
||||
bdevice sc_dev; /* base device */
|
||||
USBBASEDEVICE sc_dev; /* base device */
|
||||
usbd_bus_handle sc_bus; /* USB controller */
|
||||
struct usbd_port sc_port; /* dummy port for root hub */
|
||||
char sc_running;
|
||||
|
@ -156,7 +156,7 @@ USB_ATTACH(usb)
|
|||
sc->sc_running = 1;
|
||||
sc->sc_bus->use_polling = 1;
|
||||
sc->sc_port.power = USB_MAX_POWER;
|
||||
r = usbd_new_device(&sc->sc_dev, sc->sc_bus, 0,0,0, &sc->sc_port);
|
||||
r = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0,0,0, &sc->sc_port);
|
||||
|
||||
if (r == USBD_NORMAL_COMPLETION) {
|
||||
dev = sc->sc_port.device;
|
||||
|
@ -448,7 +448,7 @@ usb_needs_explore(bus)
|
|||
|
||||
int
|
||||
usb_activate(self, act)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
enum devact act;
|
||||
{
|
||||
panic("usb_activate\n");
|
||||
|
@ -457,7 +457,7 @@ usb_activate(self, act)
|
|||
|
||||
int
|
||||
usb_detach(self, flags)
|
||||
bdevice *self;
|
||||
device_ptr_t self;
|
||||
int flags;
|
||||
{
|
||||
panic("usb_detach\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb_port.h,v 1.9 1999/08/17 16:06:21 augustss Exp $ */
|
||||
/* $NetBSD: usb_port.h,v 1.10 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -42,16 +42,18 @@
|
|||
* Macro's to cope with the differences between operating systems.
|
||||
*/
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/*
|
||||
* NetBSD
|
||||
*/
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include "opt_usbverbose.h"
|
||||
|
||||
typedef struct device *device_ptr_t;
|
||||
#define USBBASEDEVICE struct device
|
||||
#define USBDEV(bdev) (&(bdev))
|
||||
#define USBDEVNAME(bdev) ((bdev).dv_xname)
|
||||
|
||||
typedef struct device bdevice; /* base device */
|
||||
#define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname)
|
||||
|
||||
#define usb_timeout(f, d, t, h) timeout((f), (d), (t))
|
||||
#define usb_untimeout(f, d, h) untimeout((f), (d))
|
||||
|
@ -131,9 +133,11 @@ __CONCAT(dname,_attach)(parent, self, aux) \
|
|||
#define uhidpoll uhidselect
|
||||
#define ugenpoll ugenselect
|
||||
|
||||
typedef struct device device_ptr_t;
|
||||
#define USBBASEDEVICE struct device
|
||||
#define USBDEV(bdev) (&(bdev))
|
||||
#define USBDEVNAME(bdev) ((bdev).dv_xname)
|
||||
|
||||
typedef struct device bdevice; /* base device */
|
||||
#define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname)
|
||||
|
||||
#define usb_timeout(f, d, t, h) timeout((f), (d), (t))
|
||||
#define usb_untimeout(f, d, h) untimeout((f), (d))
|
||||
|
@ -204,12 +208,11 @@ __CONCAT(dname,_attach)(parent, self, aux) \
|
|||
*/
|
||||
|
||||
#include "opt_usb.h"
|
||||
/*
|
||||
* The following is not a type def to avoid error messages
|
||||
* because of includes in the wrong order.
|
||||
*/
|
||||
#define bdevice device_t
|
||||
#define USBDEVNAME(bdev) usbd_devname(&bdev)
|
||||
|
||||
#define USBBASEDEVICE device_t
|
||||
#define USBDEV(bdev) (bdev)
|
||||
#define USBDEVNAME(bdev) usbd_devname(bdev)
|
||||
#define USBDEVPTRNAME(bdev) usbd_devname(bdev)
|
||||
|
||||
/* XXX Change this when FreeBSD has memset
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb_subr.c,v 1.42 1999/08/29 19:41:27 thorpej Exp $ */
|
||||
/* $NetBSD: usb_subr.c,v 1.43 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -77,14 +77,14 @@ char *usbd_get_string __P((usbd_device_handle, int, char *));
|
|||
int usbd_getnewaddr __P((usbd_bus_handle bus));
|
||||
int usbd_print __P((void *aux, const char *pnp));
|
||||
#if defined(__NetBSD__)
|
||||
int usbd_submatch __P((bdevice *, struct cfdata *cf, void *));
|
||||
int usbd_submatch __P((device_ptr_t, struct cfdata *cf, void *));
|
||||
#elif defined(__OpenBSD__)
|
||||
int usbd_submatch __P((bdevice *, void *, void *));
|
||||
int usbd_submatch __P((device_ptr_t, void *, void *));
|
||||
#endif
|
||||
void usbd_free_iface_data __P((usbd_device_handle dev, int ifcno));
|
||||
void usbd_kill_pipe __P((usbd_pipe_handle));
|
||||
usbd_status usbd_probe_and_attach
|
||||
__P((bdevice *parent, usbd_device_handle dev, int port, int addr));
|
||||
__P((device_ptr_t parent, usbd_device_handle dev, int port, int addr));
|
||||
|
||||
|
||||
#ifdef USBVERBOSE
|
||||
|
@ -718,7 +718,7 @@ usbd_getnewaddr(bus)
|
|||
|
||||
usbd_status
|
||||
usbd_probe_and_attach(parent, dev, port, addr)
|
||||
bdevice *parent;
|
||||
device_ptr_t parent;
|
||||
usbd_device_handle dev;
|
||||
int port;
|
||||
int addr;
|
||||
|
@ -726,7 +726,7 @@ usbd_probe_and_attach(parent, dev, port, addr)
|
|||
struct usb_attach_arg uaa;
|
||||
usb_device_descriptor_t *dd = &dev->ddesc;
|
||||
int r, found, i, confi, nifaces;
|
||||
bdevice *dv;
|
||||
device_ptr_t dv;
|
||||
usbd_interface_handle ifaces[256]; /* 256 is the absolute max */
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
|
@ -734,7 +734,7 @@ usbd_probe_and_attach(parent, dev, port, addr)
|
|||
* XXX uaa is a static var. Not a problem as it _should_ be used only
|
||||
* during probe and attach. Should be changed however.
|
||||
*/
|
||||
bdevice bdev;
|
||||
device_t bdev;
|
||||
bdev = device_add_child(*parent, NULL, -1, &uaa);
|
||||
if (!bdev) {
|
||||
printf("%s: Device creation failed\n", USBDEVNAME(dev->bus->bdev));
|
||||
|
@ -775,11 +775,11 @@ usbd_probe_and_attach(parent, dev, port, addr)
|
|||
if (r != USBD_NORMAL_COMPLETION) {
|
||||
#ifdef USB_DEBUG
|
||||
DPRINTF(("%s: port %d, set config at addr %d failed, "
|
||||
"error=%s\n", USBDEVNAME(*parent), port,
|
||||
"error=%s\n", USBDEVPTRNAME(parent), port,
|
||||
addr, usbd_errstr(r)));
|
||||
#else
|
||||
printf("%s: port %d, set config at addr %d failed\n",
|
||||
USBDEVNAME(*parent), port, addr);
|
||||
USBDEVPTRNAME(parent), port, addr);
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
device_delete_child(*parent, bdev);
|
||||
|
@ -864,7 +864,7 @@ usbd_probe_and_attach(parent, dev, port, addr)
|
|||
*/
|
||||
usbd_status
|
||||
usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
bdevice *parent;
|
||||
device_ptr_t parent;
|
||||
usbd_bus_handle bus;
|
||||
int depth;
|
||||
int lowspeed;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi.c,v 1.33 1999/08/28 10:04:01 augustss Exp $ */
|
||||
/* $NetBSD: usbdi.c,v 1.34 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -1001,7 +1001,7 @@ usbd_device_set_desc(device_t device, char *devinfo)
|
|||
}
|
||||
|
||||
char *
|
||||
usbd_devname(bdevice *bdev)
|
||||
usbd_devname(device_t bdev)
|
||||
{
|
||||
static char buf[20];
|
||||
/*
|
||||
|
@ -1009,7 +1009,7 @@ usbd_devname(bdevice *bdev)
|
|||
* but it's not fatal.
|
||||
*/
|
||||
|
||||
sprintf(buf, "%s%d", device_get_name(*bdev), device_get_unit(*bdev));
|
||||
sprintf(buf, "%s%d", device_get_name(bdev), device_get_unit(bdev));
|
||||
return (buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi.h,v 1.25 1999/08/29 19:41:27 thorpej Exp $ */
|
||||
/* $NetBSD: usbdi.h,v 1.26 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -253,7 +253,7 @@ usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor
|
|||
#if defined(__FreeBSD__)
|
||||
int usbd_driver_load __P((module_t mod, int what, void *arg));
|
||||
void usbd_device_set_desc __P((device_t device, char *devinfo));
|
||||
char *usbd_devname(bdevice *bdev);
|
||||
char *usbd_devname(device_t *bdev);
|
||||
bus_print_child_t usbd_print_child;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi_util.c,v 1.19 1999/08/22 20:12:40 augustss Exp $ */
|
||||
/* $NetBSD: usbdi_util.c,v 1.20 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -541,19 +541,19 @@ usbd_bulk_transfer(reqh, pipe, flags, timeout, buf, size, lbl)
|
|||
|
||||
void
|
||||
usb_detach_wait(dv)
|
||||
bdevice *dv;
|
||||
device_ptr_t dv;
|
||||
{
|
||||
DPRINTF(("usb_detach_wait: waiting for %s\n", USBDEVNAME(*dv)));
|
||||
DPRINTF(("usb_detach_wait: waiting for %s\n", USBDEVPTRNAME(dv)));
|
||||
if (tsleep(dv, PZERO, "usbdet", hz * 60))
|
||||
printf("usb_detach_wait: %s didn't detach\n",
|
||||
USBDEVNAME(*dv));
|
||||
DPRINTF(("usb_detach_wait: %s done\n", USBDEVNAME(*dv)));
|
||||
USBDEVPTRNAME(dv));
|
||||
DPRINTF(("usb_detach_wait: %s done\n", USBDEVPTRNAME(dv)));
|
||||
}
|
||||
|
||||
void
|
||||
usb_detach_wakeup(dv)
|
||||
bdevice *dv;
|
||||
device_ptr_t dv;
|
||||
{
|
||||
DPRINTF(("usb_detach_wakeup: for %s\n", USBDEVNAME(*dv)));
|
||||
DPRINTF(("usb_detach_wakeup: for %s\n", USBDEVPTRNAME(dv)));
|
||||
wakeup(dv);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi_util.h,v 1.16 1999/08/22 20:12:40 augustss Exp $ */
|
||||
/* $NetBSD: usbdi_util.h,v 1.17 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -92,6 +92,6 @@ usbd_status usbd_bulk_transfer
|
|||
__P((usbd_request_handle reqh, usbd_pipe_handle pipe, u_int16_t flags,
|
||||
u_int32_t timeout, void *buf, u_int32_t *size, char *lbl));
|
||||
|
||||
void usb_detach_wait __P((bdevice *));
|
||||
void usb_detach_wakeup __P((bdevice *));
|
||||
void usb_detach_wait __P((device_ptr_t));
|
||||
void usb_detach_wakeup __P((device_ptr_t));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdivar.h,v 1.27 1999/08/29 17:57:25 thorpej Exp $ */
|
||||
/* $NetBSD: usbdivar.h,v 1.28 1999/09/05 19:32:19 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -79,7 +79,7 @@ struct usb_softc;
|
|||
|
||||
struct usbd_bus {
|
||||
/* Filled by HC driver */
|
||||
bdevice bdev; /* base device, host adapter */
|
||||
USBBASEDEVICE bdev; /* base device, host adapter */
|
||||
usbd_status (*open_pipe)__P((struct usbd_pipe *pipe));
|
||||
u_int32_t pipe_size; /* size of a pipe struct */
|
||||
void (*do_poll)__P((struct usbd_bus *));
|
||||
|
@ -111,7 +111,7 @@ struct usbd_device {
|
|||
usb_config_descriptor_t *cdesc; /* full config descr */
|
||||
struct usbd_quirks *quirks;
|
||||
struct usbd_hub *hub; /* only if this is a hub */
|
||||
bdevice **subdevs; /* sub-devices, 0 terminated */
|
||||
device_ptr_t *subdevs; /* sub-devices, 0 terminated */
|
||||
};
|
||||
|
||||
struct usbd_interface {
|
||||
|
@ -176,7 +176,7 @@ usbd_status usbd_setup_pipe __P((usbd_device_handle dev,
|
|||
usbd_interface_handle iface,
|
||||
struct usbd_endpoint *,
|
||||
usbd_pipe_handle *pipe));
|
||||
usbd_status usbd_new_device __P((bdevice *parent,
|
||||
usbd_status usbd_new_device __P((device_ptr_t parent,
|
||||
usbd_bus_handle bus, int depth,
|
||||
int lowspeed, int port,
|
||||
struct usbd_port *));
|
||||
|
|
Loading…
Reference in New Issue