summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-01-02 16:33:53 +0000
committerjoe <joe@FreeBSD.org>2002-01-02 16:33:53 +0000
commitb7218f93dc375ffb8587a39aec1dd9673e1cdd0d (patch)
tree8e42e13bc7d524abcb88c0d18fe353eb8239fdb2 /sys
parent205784642b3c46f1f017271c18a02c23a15089b8 (diff)
downloadFreeBSD-src-b7218f93dc375ffb8587a39aec1dd9673e1cdd0d.zip
FreeBSD-src-b7218f93dc375ffb8587a39aec1dd9673e1cdd0d.tar.gz
NetBSD have introduced usb_proc_ptr for us (they'll be needing it soon too)
to hide the distinction between struct proc and struct thread.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/ugen.c22
-rw-r--r--sys/dev/usb/uhid.c30
-rw-r--r--sys/dev/usb/ulpt.c6
-rw-r--r--sys/dev/usb/umodem.c18
-rw-r--r--sys/dev/usb/ums.c10
-rw-r--r--sys/dev/usb/urio.c14
-rw-r--r--sys/dev/usb/usb.c22
-rw-r--r--sys/dev/usb/usb_port.h11
-rw-r--r--sys/dev/usb/uscanner.c12
9 files changed, 78 insertions, 67 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 084041f..d6de9db 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -157,7 +157,7 @@ Static void ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr,
Static int ugen_do_read(struct ugen_softc *, int, struct uio *, int);
Static int ugen_do_write(struct ugen_softc *, int, struct uio *, int);
Static int ugen_do_ioctl(struct ugen_softc *, int, u_long,
- caddr_t, int, struct thread *);
+ caddr_t, int, usb_proc_ptr);
#if defined(__FreeBSD__)
Static void ugen_make_devnodes(struct ugen_softc *sc);
Static void ugen_destroy_devnodes(struct ugen_softc *sc);
@@ -360,7 +360,7 @@ ugen_set_config(struct ugen_softc *sc, int configno)
}
int
-ugenopen(dev_t dev, int flag, int mode, struct thread *td)
+ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
{
struct ugen_softc *sc;
int unit = UGENUNIT(dev);
@@ -492,7 +492,7 @@ ugenopen(dev_t dev, int flag, int mode, struct thread *td)
}
int
-ugenclose(dev_t dev, int flag, int mode, struct thread *td)
+ugenclose(dev_t dev, int flag, int mode, usb_proc_ptr p)
{
int endpt = UGENENDPOINT(dev);
struct ugen_softc *sc;
@@ -1067,7 +1067,7 @@ ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx)
Static int
ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
- caddr_t addr, int flag, struct thread *td)
+ caddr_t addr, int flag, usb_proc_ptr p)
{
struct ugen_endpoint *sce;
usbd_status err;
@@ -1259,7 +1259,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
uio.uio_offset = 0;
uio.uio_segflg = UIO_USERSPACE;
uio.uio_rw = UIO_READ;
- uio.uio_td = td;
+ uio.uio_td = p;
#if defined(__NetBSD__) || defined(__OpenBSD__)
error = uiomove((caddr_t)cdesc, len, &uio);
#elif defined(__FreeBSD__)
@@ -1309,7 +1309,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
uio.uio_rw =
ur->request.bmRequestType & UT_READ ?
UIO_READ : UIO_WRITE;
- uio.uio_td = td;
+ uio.uio_td = p;
ptr = malloc(len, M_TEMP, M_WAITOK);
if (uio.uio_rw == UIO_WRITE) {
error = uiomove(ptr, len, &uio);
@@ -1346,7 +1346,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
}
int
-ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
+ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p)
{
int endpt = UGENENDPOINT(dev);
struct ugen_softc *sc;
@@ -1355,14 +1355,14 @@ ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
USB_GET_SC(ugen, UGENUNIT(dev), sc);
sc->sc_refcnt++;
- error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, td);
+ error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, p);
if (--sc->sc_refcnt < 0)
usb_detach_wakeup(USBDEV(sc->sc_dev));
return (error);
}
int
-ugenpoll(dev_t dev, int events, struct thread *td)
+ugenpoll(dev_t dev, int events, usb_proc_ptr p)
{
struct ugen_softc *sc;
struct ugen_endpoint *sce;
@@ -1395,7 +1395,7 @@ ugenpoll(dev_t dev, int events, struct thread *td)
if (sce->q.c_cc > 0)
revents |= events & (POLLIN | POLLRDNORM);
else
- selrecord(td, &sce->rsel);
+ selrecord(p, &sce->rsel);
}
break;
case UE_ISOCHRONOUS:
@@ -1403,7 +1403,7 @@ ugenpoll(dev_t dev, int events, struct thread *td)
if (sce->cur != sce->fill)
revents |= events & (POLLIN | POLLRDNORM);
else
- selrecord(td, &sce->rsel);
+ selrecord(p, &sce->rsel);
}
break;
case UE_BULK:
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index 7914cb3..323a560 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -163,7 +163,7 @@ Static void uhid_intr(usbd_xfer_handle, usbd_private_handle,
Static int uhid_do_read(struct uhid_softc *, struct uio *uio, int);
Static int uhid_do_write(struct uhid_softc *, struct uio *uio, int);
Static int uhid_do_ioctl(struct uhid_softc *, u_long, caddr_t, int,
- struct thread *);
+ usb_proc_ptr);
USB_DECLARE_DRIVER(uhid);
@@ -373,11 +373,11 @@ uhid_intr(xfer, addr, status)
}
int
-uhidopen(dev, flag, mode, td)
+uhidopen(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uhid_softc *sc;
usbd_status err;
@@ -422,11 +422,11 @@ uhidopen(dev, flag, mode, td)
}
int
-uhidclose(dev, flag, mode, td)
+uhidclose(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uhid_softc *sc;
@@ -588,12 +588,12 @@ uhidwrite(dev, uio, flag)
}
int
-uhid_do_ioctl(sc, cmd, addr, flag, td)
+uhid_do_ioctl(sc, cmd, addr, flag, p)
struct uhid_softc *sc;
u_long cmd;
caddr_t addr;
int flag;
- struct thread *td;
+ usb_proc_ptr p;
{
struct usb_ctl_report_desc *rd;
struct usb_ctl_report *re;
@@ -614,8 +614,8 @@ uhid_do_ioctl(sc, cmd, addr, flag, td)
if (*(int *)addr) {
if (sc->sc_async != NULL)
return (EBUSY);
- sc->sc_async = td->td_proc; /* XXXKSE */
- DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", td->td_proc));
+ sc->sc_async = p->td_proc; /* XXXKSE */
+ DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p->td_proc));
} else
sc->sc_async = NULL;
break;
@@ -703,12 +703,12 @@ uhid_do_ioctl(sc, cmd, addr, flag, td)
}
int
-uhidioctl(dev, cmd, addr, flag, td)
+uhidioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uhid_softc *sc;
int error;
@@ -716,17 +716,17 @@ uhidioctl(dev, cmd, addr, flag, td)
USB_GET_SC(uhid, UHIDUNIT(dev), sc);
sc->sc_refcnt++;
- error = uhid_do_ioctl(sc, cmd, addr, flag, td);
+ error = uhid_do_ioctl(sc, cmd, addr, flag, p);
if (--sc->sc_refcnt < 0)
usb_detach_wakeup(USBDEV(sc->sc_dev));
return (error);
}
int
-uhidpoll(dev, events, td)
+uhidpoll(dev, events, p)
dev_t dev;
int events;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uhid_softc *sc;
int revents = 0;
@@ -744,7 +744,7 @@ uhidpoll(dev, events, td)
if (sc->sc_q.c_cc > 0)
revents |= events & (POLLIN | POLLRDNORM);
else
- selrecord(td, &sc->sc_rsel);
+ selrecord(p, &sc->sc_rsel);
}
splx(s);
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 8e66da7..50d9e09 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -467,7 +467,7 @@ int ulptusein = 0;
* Reset the printer, then wait until it's selected and not busy.
*/
int
-ulptopen(dev_t dev, int flag, int mode, struct thread *td)
+ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
{
u_char flags = ULPTFLAGS(dev);
struct ulpt_softc *sc;
@@ -586,7 +586,7 @@ ulpt_statusmsg(u_char status, struct ulpt_softc *sc)
}
int
-ulptclose(dev_t dev, int flag, int mode, struct thread *td)
+ulptclose(dev_t dev, int flag, int mode, usb_proc_ptr p)
{
struct ulpt_softc *sc;
@@ -676,7 +676,7 @@ ulptwrite(dev_t dev, struct uio *uio, int flags)
}
int
-ulptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
+ulptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
{
int error = 0;
diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c
index ad24d94..abdc81d 100644
--- a/sys/dev/usb/umodem.c
+++ b/sys/dev/usb/umodem.c
@@ -571,10 +571,10 @@ umodemparam(tp, t)
}
int
-umodemopen(dev, flag, mode, td)
+umodemopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
- struct thread *td;
+ usb_proc_ptr p;
{
int unit = UMODEMUNIT(dev);
struct umodem_softc *sc;
@@ -599,7 +599,7 @@ umodemopen(dev, flag, mode, td)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- suser_td(td))
+ suser_td(p))
return (EBUSY);
/*
@@ -781,10 +781,10 @@ umodemreadcb(xfer, p, status)
}
int
-umodemclose(dev, flag, mode, td)
+umodemclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
- struct thread *td;
+ usb_proc_ptr p;
{
struct umodem_softc *sc;
struct tty *tp;
@@ -924,12 +924,12 @@ umodemtty(dev)
}
int
-umodemioctl(dev, cmd, data, flag, td)
+umodemioctl(dev, cmd, data, flag, p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
- struct thread *td;
+ usb_proc_ptr p;
{
struct umodem_softc *sc;
struct tty *tp;
@@ -946,12 +946,12 @@ umodemioctl(dev, cmd, data, flag, td)
DPRINTF(("umodemioctl: cmd=0x%08lx\n", cmd));
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
#if defined(__NetBSD__) || defined(__OpenBSD__)
- error = ttioctl(tp, cmd, data, flag, td);
+ error = ttioctl(tp, cmd, data, flag, p);
#elif defined(__FreeBSD__)
error = ttioctl(tp, cmd, data, flag);
#endif
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index 2a72120..c3acdf0 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -586,7 +586,7 @@ ums_disable(priv)
}
Static int
-ums_open(dev_t dev, int flag, int fmt, struct thread *td)
+ums_open(dev_t dev, int flag, int fmt, usb_proc_ptr p)
{
struct ums_softc *sc;
@@ -596,7 +596,7 @@ ums_open(dev_t dev, int flag, int fmt, struct thread *td)
}
Static int
-ums_close(dev_t dev, int flag, int fmt, struct thread *td)
+ums_close(dev_t dev, int flag, int fmt, usb_proc_ptr p)
{
struct ums_softc *sc;
@@ -682,7 +682,7 @@ ums_read(dev_t dev, struct uio *uio, int flag)
}
Static int
-ums_poll(dev_t dev, int events, struct thread *td)
+ums_poll(dev_t dev, int events, usb_proc_ptr p)
{
struct ums_softc *sc;
int revents = 0;
@@ -699,7 +699,7 @@ ums_poll(dev_t dev, int events, struct thread *td)
revents = events & (POLLIN | POLLRDNORM);
} else {
sc->state |= UMS_SELECT;
- selrecord(td, &sc->rsel);
+ selrecord(p, &sc->rsel);
}
}
splx(s);
@@ -708,7 +708,7 @@ ums_poll(dev_t dev, int events, struct thread *td)
}
int
-ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
+ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p)
{
struct ums_softc *sc;
int error = 0;
diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c
index 878aaaf..e53cd1c 100644
--- a/sys/dev/usb/urio.c
+++ b/sys/dev/usb/urio.c
@@ -292,11 +292,11 @@ USB_ATTACH(urio)
int
-urioopen(dev, flag, mode, td)
+urioopen(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
#if (USBDI >= 1)
struct urio_softc * sc;
@@ -336,11 +336,11 @@ urioopen(dev, flag, mode, td)
}
int
-urioclose(dev, flag, mode, td)
+urioclose(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
#if (USBDI >= 1)
struct urio_softc * sc;
@@ -510,12 +510,12 @@ uriowrite(dev, uio, flag)
int
-urioioctl(dev, cmd, addr, flag, td)
+urioioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
- struct thread *td;
+ usb_proc_ptr p;
{
#if (USBDI >= 1)
struct urio_softc * sc;
@@ -585,7 +585,7 @@ urioioctl(dev, cmd, addr, flag, td)
uio.uio_rw =
req.bmRequestType & UT_READ ?
UIO_READ : UIO_WRITE;
- uio.uio_td = td;
+ uio.uio_td = p;
ptr = malloc(len, M_TEMP, M_WAITOK);
if (uio.uio_rw == UIO_WRITE) {
error = uiomove(ptr, len, &uio);
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index cf2f20b..8bf401b 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -336,10 +336,10 @@ usbctlprint(aux, pnp)
#endif /* defined(__NetBSD__) || defined(__OpenBSD__) */
int
-usbopen(dev, flag, mode, td)
+usbopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
- struct thread *td;
+ usb_proc_ptr p;
{
int unit = USBUNIT(dev);
struct usb_softc *sc;
@@ -398,10 +398,10 @@ usbread(dev, uio, flag)
}
int
-usbclose(dev, flag, mode, td)
+usbclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
- struct thread *td;
+ usb_proc_ptr p;
{
int unit = USBUNIT(dev);
@@ -414,12 +414,12 @@ usbclose(dev, flag, mode, td)
}
int
-usbioctl(devt, cmd, data, flag, td)
+usbioctl(devt, cmd, data, flag, p)
dev_t devt;
u_long cmd;
caddr_t data;
int flag;
- struct thread *td;
+ usb_proc_ptr p;
{
struct usb_softc *sc;
int unit = USBUNIT(devt);
@@ -432,7 +432,7 @@ usbioctl(devt, cmd, data, flag, td)
case FIOASYNC:
if (*(int *)data)
- usb_async_proc = td->td_proc;
+ usb_async_proc = p->td_proc;
else
usb_async_proc = 0;
return (0);
@@ -492,7 +492,7 @@ usbioctl(devt, cmd, data, flag, td)
uio.uio_rw =
ur->request.bmRequestType & UT_READ ?
UIO_READ : UIO_WRITE;
- uio.uio_td = td;
+ uio.uio_td = p;
ptr = malloc(len, M_TEMP, M_WAITOK);
if (uio.uio_rw == UIO_WRITE) {
error = uiomove(ptr, len, &uio);
@@ -545,10 +545,10 @@ usbioctl(devt, cmd, data, flag, td)
}
int
-usbpoll(dev, events, td)
+usbpoll(dev, events, p)
dev_t dev;
int events;
- struct thread *td;
+ usb_proc_ptr p;
{
int revents, mask, s;
int unit = USBUNIT(dev);
@@ -562,7 +562,7 @@ usbpoll(dev, events, td)
revents |= events & mask;
if (revents == 0 && (events & mask)) {
DPRINTFN(2,("usb: sleeping on %p\n", &usb_selevent));
- selrecord(td, &usb_selevent);
+ selrecord(p, &usb_selevent);
}
splx(s);
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 3045615..52313a1 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -38,6 +38,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _USB_PORT_H
+#define _USB_PORT_H
/*
* Macro's to cope with the differences between operating systems.
@@ -62,6 +64,8 @@
#define Static static
+typedef struct proc *usb_proc_ptr;
+
typedef struct device *device_ptr_t;
#define USBBASEDEVICE struct device
#define USBDEV(bdev) (&(bdev))
@@ -165,6 +169,8 @@ __CONCAT(dname,_detach)(self, flags) \
#define Static static
+typedef struct proc *usb_proc_ptr;
+
#define memcpy(d, s, l) bcopy((s),(d),(l))
#define memset(d, v, l) bzero((d),(l))
#define bswap32(x) swap32(x)
@@ -286,6 +292,8 @@ __CONCAT(dname,_detach)(self, flags) \
#define DECLARE_USB_DMA_T typedef char * usb_dma_t
+typedef struct thread *usb_proc_ptr;
+
/* XXX Change this when FreeBSD has memset */
#define memcpy(d, s, l) bcopy((s),(d),(l))
#define memset(d, v, l) bzero((d),(l))
@@ -396,3 +404,6 @@ __CONCAT(dname,_detach)(device_t self)
#define logprintf printf
#endif /* __FreeBSD__ */
+
+#endif /* _USB_PORT_H */
+
diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c
index 9bac9b1..3baadbf 100644
--- a/sys/dev/usb/uscanner.c
+++ b/sys/dev/usb/uscanner.c
@@ -326,11 +326,11 @@ USB_ATTACH(uscanner)
}
int
-uscanneropen(dev, flag, mode, td)
+uscanneropen(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uscanner_softc *sc;
int unit = USCANNERUNIT(dev);
@@ -389,11 +389,11 @@ uscanneropen(dev, flag, mode, td)
}
int
-uscannerclose(dev, flag, mode, td)
+uscannerclose(dev, flag, mode, p)
dev_t dev;
int flag;
int mode;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uscanner_softc *sc;
@@ -640,10 +640,10 @@ USB_DETACH(uscanner)
}
int
-uscannerpoll(dev, events, td)
+uscannerpoll(dev, events, p)
dev_t dev;
int events;
- struct thread *td;
+ usb_proc_ptr p;
{
struct uscanner_softc *sc;
int revents = 0;
OpenPOWER on IntegriCloud