Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Change the way the `struct device' base part of ...
details: https://anonhg.NetBSD.org/src/rev/a995a68e61fb
branches: trunk
changeset: 476095:a995a68e61fb
user: augustss <augustss%NetBSD.org@localhost>
date: Sun Sep 05 19:32:18 1999 +0000
description:
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.
diffstat:
sys/dev/usb/ugen.c | 18 ++++++++++--------
sys/dev/usb/uhci.c | 11 ++++++-----
sys/dev/usb/uhid.c | 16 ++++++++--------
sys/dev/usb/uhub.c | 17 ++++++++---------
sys/dev/usb/ukbd.c | 8 ++++----
sys/dev/usb/ulpt.c | 12 ++++++------
sys/dev/usb/umass.c | 6 +++---
sys/dev/usb/umodem.c | 8 ++++----
sys/dev/usb/ums.c | 8 ++++----
sys/dev/usb/usb.c | 10 +++++-----
sys/dev/usb/usb_port.h | 27 +++++++++++++++------------
sys/dev/usb/usb_subr.c | 20 ++++++++++----------
sys/dev/usb/usbdi.c | 6 +++---
sys/dev/usb/usbdi.h | 4 ++--
sys/dev/usb/usbdi_util.c | 14 +++++++-------
sys/dev/usb/usbdi_util.h | 6 +++---
sys/dev/usb/usbdivar.h | 8 ++++----
17 files changed, 102 insertions(+), 97 deletions(-)
diffs (truncated from 763 to 300 lines):
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/ugen.c Sun Sep 05 19:32:18 1999 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/uhci.c Sun Sep 05 19:32:18 1999 +0000
@@ -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 @@
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 @@
}
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 */
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/uhid.c Sun Sep 05 19:32:18 1999 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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);
}
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/uhub.c Sun Sep 05 19:32:18 1999 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
}
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 @@
int
uhub_activate(self, act)
- bdevice *self;
+ device_ptr_t self;
enum devact act;
{
switch (act) {
@@ -509,7 +508,7 @@
*/
int
uhub_detach(self, flags)
- bdevice *self;
+ device_ptr_t self;
int flags;
{
struct uhub_softc *sc = (struct uhub_softc *)self;
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/ukbd.c Sun Sep 05 19:32:18 1999 +0000
@@ -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 @@
#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 @@
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 @@
int
ukbd_detach(self, flags)
- bdevice *self;
+ device_ptr_t self;
int flags;
{
struct ukbd_softc *sc = (struct ukbd_softc *)self;
diff -r 0ab93e5ebc83 -r a995a68e61fb sys/dev/usb/ulpt.c
--- a/sys/dev/usb/ulpt.c Sun Sep 05 16:33:03 1999 +0000
+++ b/sys/dev/usb/ulpt.c Sun Sep 05 19:32:18 1999 +0000
@@ -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.
Home |
Main Index |
Thread Index |
Old Index