summaryrefslogtreecommitdiff
path: root/sys/dev/wscons
diff options
context:
space:
mode:
authorcube <cube@NetBSD.org>2008-03-25 00:49:19 +0000
committercube <cube@NetBSD.org>2008-03-25 00:49:19 +0000
commitd94699ecbbbbd4d5cd54477991a08c19f7f68de6 (patch)
treeea8d8b90d9aebeba26136a00e5c073d67b32aeb4 /sys/dev/wscons
parentf722be6c160f0296cf77a66df52ce5d54caedb2d (diff)
Split device_t and softc for wskbd(4), wsmouse(4) and that creepy wsmux(4).
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r--sys/dev/wscons/wsdisplay.c6
-rw-r--r--sys/dev/wscons/wsdisplayvar.h4
-rw-r--r--sys/dev/wscons/wsemulvar.h3
-rw-r--r--sys/dev/wscons/wskbd.c70
-rw-r--r--sys/dev/wscons/wskbdvar.h6
-rw-r--r--sys/dev/wscons/wsmouse.c71
-rw-r--r--sys/dev/wscons/wsmux.c129
-rw-r--r--sys/dev/wscons/wsmuxvar.h20
8 files changed, 165 insertions, 144 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 17e7a55d332..1dc387a3c29 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.119 2008/03/12 23:26:18 drochner Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.120 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.119 2008/03/12 23:26:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.120 2008/03/25 00:49:20 cube Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_wsmsgattrs.h"
@@ -757,7 +757,7 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
#if NWSKBD > 0
kme = wskbd_set_console_display(sc->sc_dev, sc->sc_input);
if (kme != NULL)
- aprint_normal(", using %s", kme->me_dv.dv_xname);
+ aprint_normal(", using %s", device_xname(kme->me_dv));
#if NWSMUX == 0
sc->sc_input = kme;
#endif
diff --git a/sys/dev/wscons/wsdisplayvar.h b/sys/dev/wscons/wsdisplayvar.h
index 644b6e77fff..74eaf43a890 100644
--- a/sys/dev/wscons/wsdisplayvar.h
+++ b/sys/dev/wscons/wsdisplayvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.46 2008/02/20 22:33:18 drochner Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.47 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -220,7 +220,7 @@ void wsdisplay_scroll(void *, int);
#define WSDISPLAY_SCROLL_RESET (1 << 2)
#define WSDISPLAY_SCROLL_LOW (1 << 3)
-int wsdisplay_stat_inject(struct device *, u_int, int);
+int wsdisplay_stat_inject(device_t, u_int, int);
/*
* for general use
diff --git a/sys/dev/wscons/wsemulvar.h b/sys/dev/wscons/wsemulvar.h
index 6f5d1bd0918..75cf4af42ac 100644
--- a/sys/dev/wscons/wsemulvar.h
+++ b/sys/dev/wscons/wsemulvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemulvar.h,v 1.13 2006/10/09 11:03:43 peter Exp $ */
+/* $NetBSD: wsemulvar.h,v 1.14 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -30,7 +30,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-struct device;
struct wsdisplay_emulops;
enum wsemul_resetops {
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index f35bc5b2e64..6aff8081b82 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbd.c,v 1.114 2008/02/28 16:54:48 dyoung Exp $ */
+/* $NetBSD: wskbd.c,v 1.115 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.114 2008/02/28 16:54:48 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.115 2008/03/25 00:49:20 cube Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -213,7 +213,7 @@ struct wskbd_softc {
dst |= (src & MOD_META_R) ? MOD_META_R : 0; \
} while (0)
-static int wskbd_match(device_t, struct cfdata *, void *);
+static int wskbd_match(device_t, cfdata_t, void *);
static void wskbd_attach(device_t, device_t, void *);
static int wskbd_detach(device_t, int);
static int wskbd_activate(device_t, enum devact);
@@ -251,7 +251,7 @@ static int wskbd_mux_close(struct wsevsrc *);
static int wskbd_do_open(struct wskbd_softc *, struct wseventvar *);
static int wskbd_do_ioctl(device_t, u_long, void *, int, struct lwp *);
-CFATTACH_DECL(wskbd, sizeof (struct wskbd_softc),
+CFATTACH_DECL_NEW(wskbd, sizeof (struct wskbd_softc),
wskbd_match, wskbd_attach, wskbd_detach, wskbd_activate);
extern struct cfdriver wskbd_cd;
@@ -357,7 +357,7 @@ wskbddevprint(void *aux, const char *pnp)
}
int
-wskbd_match(device_t parent, struct cfdata *match, void *aux)
+wskbd_match(device_t parent, cfdata_t match, void *aux)
{
struct wskbddev_attach_args *ap = aux;
@@ -385,13 +385,14 @@ wskbd_attach(device_t parent, device_t self, void *aux)
int mux, error;
#endif
+ sc->sc_base.me_dv = self;
sc->sc_isconsole = ap->console;
#if NWSMUX > 0 || NWSDISPLAY > 0
sc->sc_base.me_ops = &wskbd_srcops;
#endif
#if NWSMUX > 0
- mux = device_cfdata(&sc->sc_base.me_dv)->wskbddevcf_mux;
+ mux = device_cfdata(sc->sc_base.me_dv)->wskbddevcf_mux;
if (ap->console) {
/* Ignore mux for console; it always goes to the console mux. */
/* printf(" (mux %d ignored for console)", mux); */
@@ -400,7 +401,7 @@ wskbd_attach(device_t parent, device_t self, void *aux)
if (mux >= 0)
aprint_normal(" mux %d", mux);
#else
- if (device_cfdata(&sc->sc_base.me_dv)->wskbddevcf_mux >= 0)
+ if (device_cfdata(sc->sc_base.me_dv)->wskbddevcf_mux >= 0)
aprint_normal(" (mux ignored)");
#endif
@@ -461,8 +462,8 @@ wskbd_attach(device_t parent, device_t self, void *aux)
if (mux >= 0) {
error = wsmux_attach_sc(wsmux_getmux(mux), &sc->sc_base);
if (error)
- printf("%s: attach error=%d\n",
- sc->sc_base.me_dv.dv_xname, error);
+ aprint_error_dev(sc->sc_base.me_dv,
+ "attach error=%d\n", error);
}
#endif
@@ -610,8 +611,8 @@ wskbd_detach(device_t self, int flags)
/* Wait for processes to go away. */
if (tsleep(sc, PZERO, "wskdet", hz * 60))
- printf("wskbd_detach: %s didn't detach\n",
- sc->sc_base.me_dv.dv_xname);
+ aprint_error("wskbd_detach: %s didn't detach\n",
+ device_xname(self));
}
splx(s);
}
@@ -715,7 +716,7 @@ wskbd_deliver_event(struct wskbd_softc *sc, u_int type, int value)
event.value = value;
if (wsevent_inject(evar, &event, 1) != 0)
log(LOG_WARNING, "%s: event queue overflow\n",
- sc->sc_base.me_dv.dv_xname);
+ device_xname(sc->sc_base.me_dv));
}
#ifdef WSDISPLAY_COMPAT_RAWKBD
@@ -819,18 +820,16 @@ wskbd_mux_open(struct wsevsrc *me, struct wseventvar *evp)
int
wskbdopen(dev_t dev, int flags, int mode, struct lwp *l)
{
- struct wskbd_softc *sc;
+ struct wskbd_softc *sc = device_lookup_private(&wskbd_cd, minor(dev));
struct wseventvar *evar;
- int unit, error;
+ int error;
- unit = minor(dev);
- if (unit >= wskbd_cd.cd_ndevs || /* make sure it was attached */
- (sc = wskbd_cd.cd_devs[unit]) == NULL)
+ if (sc == NULL)
return (ENXIO);
#if NWSMUX > 0
- DPRINTF(("wskbdopen: %s mux=%p l=%p\n", sc->sc_base.me_dv.dv_xname,
- sc->sc_base.me_parent, l));
+ DPRINTF(("wskbdopen: %s mux=%p l=%p\n",
+ device_xname(sc->sc_base.me_dv), sc->sc_base.me_parent, l));
#endif
if (sc->sc_dying)
@@ -857,7 +856,7 @@ wskbdopen(dev_t dev, int flags, int mode, struct lwp *l)
error = wskbd_do_open(sc, evar);
if (error) {
DPRINTF(("wskbdopen: %s open failed\n",
- sc->sc_base.me_dv.dv_xname));
+ device_xname(sc->sc_base.me_dv)));
sc->sc_base.me_evp = NULL;
wsevent_fini(evar);
}
@@ -878,7 +877,7 @@ wskbdclose(dev_t dev, int flags, int mode,
struct lwp *l)
{
struct wskbd_softc *sc =
- (struct wskbd_softc *)wskbd_cd.cd_devs[minor(dev)];
+ device_lookup_private(&wskbd_cd, minor(dev));
struct wseventvar *evar = sc->sc_base.me_evp;
if (evar == NULL)
@@ -910,7 +909,8 @@ wskbd_mux_close(struct wsevsrc *me)
int
wskbdread(dev_t dev, struct uio *uio, int flags)
{
- struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
+ struct wskbd_softc *sc =
+ device_lookup_private(&wskbd_cd, minor(dev));
int error;
if (sc->sc_dying)
@@ -935,7 +935,8 @@ wskbdread(dev_t dev, struct uio *uio, int flags)
int
wskbdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
- return (wskbd_do_ioctl(wskbd_cd.cd_devs[minor(dev)], cmd, data, flag,l));
+ return (wskbd_do_ioctl(device_lookup(&wskbd_cd, minor(dev)),
+ cmd, data, flag,l));
}
/* A wrapper around the ioctl() workhorse to make reference counting easy. */
@@ -991,7 +992,7 @@ wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, void *data, int flag,
* Try the keyboard driver for WSKBDIO ioctls. It returns EPASSTHROUGH
* if it didn't recognize the request.
*/
- return (wskbd_displayioctl(&sc->sc_base.me_dv, cmd, data, flag, l));
+ return (wskbd_displayioctl(sc->sc_base.me_dv, cmd, data, flag, l));
}
/*
@@ -1224,7 +1225,8 @@ getkeyrepeat:
int
wskbdpoll(dev_t dev, int events, struct lwp *l)
{
- struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
+ struct wskbd_softc *sc =
+ device_lookup_private(&wskbd_cd, minor(dev));
if (sc->sc_base.me_evp == NULL)
return (POLLERR);
@@ -1234,7 +1236,8 @@ wskbdpoll(dev_t dev, int events, struct lwp *l)
int
wskbdkqfilter(dev_t dev, struct knote *kn)
{
- struct wskbd_softc *sc = wskbd_cd.cd_devs[minor(dev)];
+ struct wskbd_softc *sc =
+ device_lookup_private(&wskbd_cd, minor(dev));
if (sc->sc_base.me_evp == NULL)
return (1);
@@ -1250,7 +1253,7 @@ wskbd_pickfree(void)
struct wskbd_softc *sc;
for (i = 0; i < wskbd_cd.cd_ndevs; i++) {
- if ((sc = wskbd_cd.cd_devs[i]) == NULL)
+ if ((sc = device_private(wskbd_cd.cd_devs[i])) == NULL)
continue;
if (sc->sc_base.me_dispdv == NULL)
return (i);
@@ -1281,7 +1284,7 @@ wskbd_set_display(device_t dv, struct wsevsrc *me)
int error;
DPRINTF(("wskbd_set_display: %s me=%p odisp=%p disp=%p cons=%d\n",
- dv->dv_xname, me, sc->sc_base.me_dispdv, displaydv,
+ device_xname(dv), me, sc->sc_base.me_dispdv, displaydv,
sc->sc_isconsole));
if (sc->sc_isconsole)
@@ -1306,10 +1309,12 @@ wskbd_set_display(device_t dv, struct wsevsrc *me)
if (displaydv)
aprint_verbose("%s: connecting to %s\n",
- sc->sc_base.me_dv.dv_xname, displaydv->dv_xname);
+ device_xname(sc->sc_base.me_dv),
+ device_xname(displaydv));
else
aprint_verbose("%s: disconnecting from %s\n",
- sc->sc_base.me_dv.dv_xname, odisplaydv->dv_xname);
+ device_xname(sc->sc_base.me_dv),
+ device_xname(odisplaydv));
return (0);
}
@@ -1320,10 +1325,9 @@ wskbd_set_display(device_t dv, struct wsevsrc *me)
int
wskbd_add_mux(int unit, struct wsmux_softc *muxsc)
{
- struct wskbd_softc *sc;
+ struct wskbd_softc *sc = device_lookup_private(&wskbd_cd, unit);
- if (unit < 0 || unit >= wskbd_cd.cd_ndevs ||
- (sc = wskbd_cd.cd_devs[unit]) == NULL)
+ if (sc == NULL)
return (ENXIO);
if (sc->sc_base.me_parent != NULL || sc->sc_base.me_evp != NULL)
diff --git a/sys/dev/wscons/wskbdvar.h b/sys/dev/wscons/wskbdvar.h
index 165f539db92..9dbc9112662 100644
--- a/sys/dev/wscons/wskbdvar.h
+++ b/sys/dev/wscons/wskbdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbdvar.h,v 1.14 2007/03/04 06:02:51 christos Exp $ */
+/* $NetBSD: wskbdvar.h,v 1.15 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -88,9 +88,9 @@ int wskbddevprint(void *, const char *);
/*
* Callbacks from the keyboard driver to the wskbd interface driver.
*/
-void wskbd_input(struct device *, u_int, int);
+void wskbd_input(device_t, u_int, int);
/* for WSDISPLAY_COMPAT_RAWKBD */
-void wskbd_rawinput(struct device *, u_char *, int);
+void wskbd_rawinput(device_t, u_char *, int);
/*
* Console interface.
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index 4b8cd0616fa..7723835e445 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.55 2007/12/09 20:28:25 jmcneill Exp $ */
+/* $NetBSD: wsmouse.c,v 1.56 2008/03/25 00:49:20 cube Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.55 2007/12/09 20:28:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.56 2008/03/25 00:49:20 cube Exp $");
#include "wsmouse.h"
#include "wsdisplay.h"
@@ -177,10 +177,10 @@ struct wsmouse_softc {
unsigned int sc_repeat_delay;
};
-static int wsmouse_match(struct device *, struct cfdata *, void *);
-static void wsmouse_attach(struct device *, struct device *, void *);
-static int wsmouse_detach(struct device *, int);
-static int wsmouse_activate(struct device *, enum devact);
+static int wsmouse_match(device_t, cfdata_t, void *);
+static void wsmouse_attach(device_t, device_t, void *);
+static int wsmouse_detach(device_t, int);
+static int wsmouse_activate(device_t, enum devact);
static int wsmouse_do_ioctl(struct wsmouse_softc *, u_long, void *,
int, struct lwp *);
@@ -190,11 +190,11 @@ static int wsmouse_mux_open(struct wsevsrc *, struct wseventvar *);
static int wsmouse_mux_close(struct wsevsrc *);
#endif
-static int wsmousedoioctl(struct device *, u_long, void *, int, struct lwp *);
+static int wsmousedoioctl(device_t, u_long, void *, int, struct lwp *);
static int wsmousedoopen(struct wsmouse_softc *, struct wseventvar *);
-CFATTACH_DECL(wsmouse, sizeof (struct wsmouse_softc),
+CFATTACH_DECL_NEW(wsmouse, sizeof (struct wsmouse_softc),
wsmouse_match, wsmouse_attach, wsmouse_detach, wsmouse_activate);
static void wsmouse_repeat(void *v);
@@ -233,21 +233,21 @@ wsmousedevprint(void *aux, const char *pnp)
}
int
-wsmouse_match(struct device *parent, struct cfdata *match,
- void *aux)
+wsmouse_match(device_t parent, cfdata_t match, void *aux)
{
return (1);
}
void
-wsmouse_attach(struct device *parent, struct device *self, void *aux)
+wsmouse_attach(device_t parent, device_t self, void *aux)
{
- struct wsmouse_softc *sc = (struct wsmouse_softc *)self;
+ struct wsmouse_softc *sc = device_private(self);
struct wsmousedev_attach_args *ap = aux;
#if NWSMUX > 0
int mux, error;
#endif
+ sc->sc_base.me_dv = self;
sc->sc_accessops = ap->accessops;
sc->sc_accesscookie = ap->accesscookie;
@@ -260,7 +260,7 @@ wsmouse_attach(struct device *parent, struct device *self, void *aux)
#if NWSMUX > 0
sc->sc_base.me_ops = &wsmouse_srcops;
- mux = device_cfdata(&sc->sc_base.me_dv)->wsmousedevcf_mux;
+ mux = device_cfdata(self)->wsmousedevcf_mux;
if (mux >= 0) {
error = wsmux_attach_sc(wsmux_getmux(mux), &sc->sc_base);
if (error)
@@ -269,7 +269,7 @@ wsmouse_attach(struct device *parent, struct device *self, void *aux)
aprint_normal(" mux %d", mux);
}
#else
- if (device_cfdata(&sc->sc_base.me_dv)->wsmousedevcf_mux >= 0)
+ if (device_cfdata(self)->wsmousedevcf_mux >= 0)
aprint_normal(" (mux ignored)");
#endif
@@ -281,9 +281,9 @@ wsmouse_attach(struct device *parent, struct device *self, void *aux)
}
int
-wsmouse_activate(struct device *self, enum devact act)
+wsmouse_activate(device_t self, enum devact act)
{
- struct wsmouse_softc *sc = (struct wsmouse_softc *)self;
+ struct wsmouse_softc *sc = device_private(self);
if (act == DVACT_DEACTIVATE)
sc->sc_dying = 1;
@@ -299,9 +299,9 @@ wsmouse_activate(struct device *self, enum devact act)
* vnode and return (which will deallocate the softc).
*/
int
-wsmouse_detach(struct device *self, int flags)
+wsmouse_detach(device_t self, int flags)
{
- struct wsmouse_softc *sc = (struct wsmouse_softc *)self;
+ struct wsmouse_softc *sc = device_private(self);
struct wseventvar *evar;
int maj, mn;
int s;
@@ -330,7 +330,7 @@ wsmouse_detach(struct device *self, int flags)
/* Wait for processes to go away. */
if (tsleep(sc, PZERO, "wsmdet", hz * 60))
printf("wsmouse_detach: %s didn't detach\n",
- sc->sc_base.me_dv.dv_xname);
+ device_xname(self));
}
splx(s);
}
@@ -346,10 +346,10 @@ wsmouse_detach(struct device *self, int flags)
}
void
-wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
+wsmouse_input(device_t wsmousedev, u_int btns /* 0 is up */,
int x, int y, int z, int w, u_int flags)
{
- struct wsmouse_softc *sc = (struct wsmouse_softc *)wsmousedev;
+ struct wsmouse_softc *sc = device_private(wsmousedev);
struct wseventvar *evar;
int mb, ub, d, nevents;
/* one for each dimension (4) + a bit for each button */
@@ -371,7 +371,8 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
#if NWSMUX > 0
DPRINTFN(5,("wsmouse_input: %s mux=%p, evar=%p\n",
- sc->sc_base.me_dv.dv_xname, sc->sc_base.me_parent, evar));
+ device_xname(sc->sc_base.me_dv),
+ sc->sc_base.me_parent, evar));
#endif
sc->sc_mb = btns;
@@ -471,8 +472,9 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
KASSERT(btnno >= 0);
if (nevents >= sizeof(events) / sizeof(events[0])) {
- printf("%s: Event queue full (button status mb=0x%x"
- " ub=0x%x)\n", sc->sc_base.me_dv.dv_xname, mb, ub);
+ aprint_error_dev(sc->sc_base.me_dv,
+ "Event queue full (button status mb=0x%x"
+ " ub=0x%x)\n", mb, ub);
break;
}
@@ -506,7 +508,7 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
sc->sc_ub = ub;
#if NWSMUX > 0
DPRINTFN(5,("wsmouse_input: %s wakeup evar=%p\n",
- sc->sc_base.me_dv.dv_xname, evar));
+ device_xname(sc->sc_base.me_dv), evar));
#endif
}
}
@@ -570,7 +572,7 @@ wsmouseopen(dev_t dev, int flags, int mode, struct lwp *l)
unit = minor(dev);
if (unit >= wsmouse_cd.cd_ndevs || /* make sure it was attached */
- (sc = wsmouse_cd.cd_devs[unit]) == NULL)
+ (sc = device_private(wsmouse_cd.cd_devs[unit])) == NULL)
return (ENXIO);
#if NWSMUX > 0
@@ -607,7 +609,7 @@ wsmouseclose(dev_t dev, int flags, int mode,
struct lwp *l)
{
struct wsmouse_softc *sc =
- (struct wsmouse_softc *)wsmouse_cd.cd_devs[minor(dev)];
+ device_private(wsmouse_cd.cd_devs[minor(dev)]);
struct wseventvar *evar = sc->sc_base.me_evp;
if (evar == NULL)
@@ -642,7 +644,8 @@ wsmousedoopen(struct wsmouse_softc *sc, struct wseventvar *evp)
int
wsmouseread(dev_t dev, struct uio *uio, int flags)
{
- struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)];
+ struct wsmouse_softc *sc =
+ device_private(wsmouse_cd.cd_devs[minor(dev)]);
int error;
if (sc->sc_dying)
@@ -673,10 +676,10 @@ wsmouseioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
/* A wrapper around the ioctl() workhorse to make reference counting easy. */
int
-wsmousedoioctl(struct device *dv, u_long cmd, void *data, int flag,
+wsmousedoioctl(device_t dv, u_long cmd, void *data, int flag,
struct lwp *l)
{
- struct wsmouse_softc *sc = (struct wsmouse_softc *)dv;
+ struct wsmouse_softc *sc = device_private(dv);
int error;
sc->sc_refcnt++;
@@ -767,7 +770,8 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, void *data,
int
wsmousepoll(dev_t dev, int events, struct lwp *l)
{
- struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)];
+ struct wsmouse_softc *sc =
+ device_private(wsmouse_cd.cd_devs[minor(dev)]);
if (sc->sc_base.me_evp == NULL)
return (POLLERR);
@@ -777,7 +781,8 @@ wsmousepoll(dev_t dev, int events, struct lwp *l)
int
wsmousekqfilter(dev_t dev, struct knote *kn)
{
- struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)];
+ struct wsmouse_softc *sc =
+ device_private(wsmouse_cd.cd_devs[minor(dev)]);
if (sc->sc_base.me_evp == NULL)
return (1);
@@ -813,7 +818,7 @@ wsmouse_add_mux(int unit, struct wsmux_softc *muxsc)
struct wsmouse_softc *sc;
if (unit < 0 || unit >= wsmouse_cd.cd_ndevs ||
- (sc = wsmouse_cd.cd_devs[unit]) == NULL)
+ (sc = device_private(wsmouse_cd.cd_devs[unit])) == NULL)
return (ENXIO);
if (sc->sc_base.me_parent != NULL || sc->sc_base.me_evp != NULL)
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index 524ca751102..c4c1cbc3668 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmux.c,v 1.48 2007/03/04 06:02:52 christos Exp $ */
+/* $NetBSD: wsmux.c,v 1.49 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.48 2007/03/04 06:02:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.49 2008/03/25 00:49:20 cube Exp $");
#include "wsdisplay.h"
#include "wsmux.h"
@@ -104,14 +104,14 @@ static void wsmux_do_open(struct wsmux_softc *, struct wseventvar *);
static void wsmux_do_close(struct wsmux_softc *);
#if NWSDISPLAY > 0
-static int wsmux_evsrc_set_display(struct device *, struct wsevsrc *);
+static int wsmux_evsrc_set_display(device_t, struct wsevsrc *);
#else
#define wsmux_evsrc_set_display NULL
#endif
-static int wsmux_do_displayioctl(struct device *dev, u_long cmd,
+static int wsmux_do_displayioctl(device_t dev, u_long cmd,
void *data, int flag, struct lwp *l);
-static int wsmux_do_ioctl(struct device *, u_long, void *,int,struct lwp *);
+static int wsmux_do_ioctl(device_t, u_long, void *,int,struct lwp *);
static int wsmux_add_mux(int, struct wsmux_softc *);
@@ -203,8 +203,8 @@ wsmuxopen(dev_t dev, int flags, int mode, struct lwp *l)
if (sc == NULL)
return (ENXIO);
- DPRINTF(("wsmuxopen: %s: sc=%p l=%p\n", sc->sc_base.me_dv.dv_xname,
- sc, l));
+ DPRINTF(("wsmuxopen: %s: sc=%p l=%p\n",
+ device_xname(sc->sc_base.me_dv), sc, l));
if (WSMUXCTL(minr)) {
/* This is the control device which does not allow reads. */
@@ -272,7 +272,8 @@ wsmux_do_open(struct wsmux_softc *sc, struct wseventvar *evar)
/* Open all children. */
CIRCLEQ_FOREACH(me, &sc->sc_cld, me_next) {
DPRINTF(("wsmuxopen: %s: m=%p dev=%s\n",
- sc->sc_base.me_dv.dv_xname, me, me->me_dv.dv_xname));
+ device_xname(sc->sc_base.me_dv), me,
+ device_xname(me->me_dv)));
#ifdef DIAGNOSTIC
if (me->me_evp != NULL) {
printf("wsmuxopen: dev already in use\n");
@@ -336,12 +337,14 @@ wsmux_do_close(struct wsmux_softc *sc)
{
struct wsevsrc *me;
- DPRINTF(("wsmuxclose: %s: sc=%p\n", sc->sc_base.me_dv.dv_xname, sc));
+ DPRINTF(("wsmuxclose: %s: sc=%p\n",
+ device_xname(sc->sc_base.me_dv), sc));
/* Close all the children. */
CIRCLEQ_FOREACH(me, &sc->sc_cld, me_next) {
DPRINTF(("wsmuxclose %s: m=%p dev=%s\n",
- sc->sc_base.me_dv.dv_xname, me, me->me_dv.dv_xname));
+ device_xname(sc->sc_base.me_dv), me,
+ device_xname(me->me_dv)));
#ifdef DIAGNOSTIC
if (me->me_parent != sc) {
printf("wsmuxclose: bad child=%p\n", me);
@@ -379,10 +382,10 @@ wsmuxread(dev_t dev, struct uio *uio, int flags)
}
DPRINTFN(5,("wsmuxread: %s event read evar=%p\n",
- sc->sc_base.me_dv.dv_xname, evar));
+ device_xname(sc->sc_base.me_dv), evar));
error = wsevent_read(evar, uio, flags);
DPRINTFN(5,("wsmuxread: %s event read ==> error=%d\n",
- sc->sc_base.me_dv.dv_xname, error));
+ device_xname(sc->sc_base.me_dv), error));
return (error);
}
@@ -394,17 +397,17 @@ wsmuxioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
int u = WSMUXDEV(minor(dev));
- return wsmux_do_ioctl(&wsmuxdevs[u]->sc_base.me_dv, cmd, data, flag, l);
+ return wsmux_do_ioctl(wsmuxdevs[u]->sc_base.me_dv, cmd, data, flag, l);
}
/*
* ioctl of a mux via the parent mux, continuation of wsmuxioctl().
*/
int
-wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
+wsmux_do_ioctl(device_t dv, u_long cmd, void *data, int flag,
struct lwp *lwp)
{
- struct wsmux_softc *sc = (struct wsmux_softc *)dv;
+ struct wsmux_softc *sc = device_private(dv);
struct wsevsrc *me;
int error, ok;
int s, n;
@@ -413,12 +416,12 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
struct wsmux_device_list *l;
DPRINTF(("wsmux_do_ioctl: %s: enter sc=%p, cmd=%08lx\n",
- sc->sc_base.me_dv.dv_xname, sc, cmd));
+ device_xname(sc->sc_base.me_dv), sc, cmd));
switch (cmd) {
case WSMUXIO_INJECTEVENT:
/* Inject an event, e.g., from moused. */
- DPRINTF(("%s: inject\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: inject\n", device_xname(sc->sc_base.me_dv)));
evar = sc->sc_base.me_evp;
if (evar == NULL) {
@@ -436,8 +439,8 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
return error;
case WSMUXIO_ADD_DEVICE:
#define d ((struct wsmux_device *)data)
- DPRINTF(("%s: add type=%d, no=%d\n", sc->sc_base.me_dv.dv_xname,
- d->type, d->idx));
+ DPRINTF(("%s: add type=%d, no=%d\n",
+ device_xname(sc->sc_base.me_dv), d->type, d->idx));
switch (d->type) {
#if NWSMOUSE > 0
case WSMUX_MOUSE:
@@ -453,12 +456,12 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
return (EINVAL);
}
case WSMUXIO_REMOVE_DEVICE:
- DPRINTF(("%s: rem type=%d, no=%d\n", sc->sc_base.me_dv.dv_xname,
- d->type, d->idx));
+ DPRINTF(("%s: rem type=%d, no=%d\n",
+ device_xname(sc->sc_base.me_dv), d->type, d->idx));
/* Locate the device */
CIRCLEQ_FOREACH(me, &sc->sc_cld, me_next) {
if (me->me_ops->type == d->type &&
- device_unit(&me->me_dv) == d->idx) {
+ device_unit(me->me_dv) == d->idx) {
DPRINTF(("wsmux_do_ioctl: detach\n"));
wsmux_detach_sc(me);
return (0);
@@ -468,14 +471,14 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
#undef d
case WSMUXIO_LIST_DEVICES:
- DPRINTF(("%s: list\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: list\n", device_xname(sc->sc_base.me_dv)));
l = (struct wsmux_device_list *)data;
n = 0;
CIRCLEQ_FOREACH(me, &sc->sc_cld, me_next) {
if (n >= WSMUX_MAXDEV)
break;
l->devices[n].type = me->me_ops->type;
- l->devices[n].idx = device_unit(&me->me_dv);
+ l->devices[n].idx = device_unit(me->me_dv);
n++;
}
l->ndevices = n;
@@ -487,18 +490,18 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
break;
#endif
case FIONBIO:
- DPRINTF(("%s: FIONBIO\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: FIONBIO\n", device_xname(sc->sc_base.me_dv)));
return (0);
case FIOASYNC:
- DPRINTF(("%s: FIOASYNC\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: FIOASYNC\n", device_xname(sc->sc_base.me_dv)));
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
evar->async = *(int *)data != 0;
return (0);
case FIOSETOWN:
- DPRINTF(("%s: FIOSETOWN\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: FIOSETOWN\n", device_xname(sc->sc_base.me_dv)));
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
@@ -507,7 +510,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
return (EPERM);
return (0);
case TIOCSPGRP:
- DPRINTF(("%s: TIOCSPGRP\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: TIOCSPGRP\n", device_xname(sc->sc_base.me_dv)));
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
@@ -515,7 +518,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
return (EPERM);
return (0);
default:
- DPRINTF(("%s: unknown\n", sc->sc_base.me_dv.dv_xname));
+ DPRINTF(("%s: unknown\n", device_xname(sc->sc_base.me_dv)));
break;
}
@@ -539,8 +542,8 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, void *data, int flag,
#endif
error = wsevsrc_ioctl(me, cmd, data, flag, lwp);
DPRINTF(("wsmux_do_ioctl: %s: me=%p dev=%s ==> %d\n",
- sc->sc_base.me_dv.dv_xname, me, me->me_dv.dv_xname,
- error));
+ device_xname(sc->sc_base.me_dv), me,
+ device_xname(me->me_dv), error));
if (!error)
ok = 1;
}
@@ -616,8 +619,8 @@ wsmux_add_mux(int unit, struct wsmux_softc *muxsc)
return (ENXIO);
DPRINTF(("wsmux_add_mux: %s(%p) to %s(%p)\n",
- sc->sc_base.me_dv.dv_xname, sc, muxsc->sc_base.me_dv.dv_xname,
- muxsc));
+ device_xname(sc->sc_base.me_dv), sc,
+ device_xname(muxsc->sc_base.me_dv), muxsc));
if (sc->sc_base.me_parent != NULL || sc->sc_base.me_evp != NULL)
return (EBUSY);
@@ -642,10 +645,16 @@ wsmux_create(const char *name, int unit)
sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc == NULL)
return (NULL);
+ sc->sc_base.me_dv = malloc(sizeof(struct device), M_DEVBUF, M_NOWAIT|M_ZERO);
+ if (sc->sc_base.me_dv == NULL) {
+ free(sc, M_DEVBUF);
+ return NULL;
+ }
CIRCLEQ_INIT(&sc->sc_cld);
- snprintf(sc->sc_base.me_dv.dv_xname, sizeof sc->sc_base.me_dv.dv_xname,
+ snprintf(sc->sc_base.me_dv->dv_xname, sizeof sc->sc_base.me_dv->dv_xname,
"%s%d", name, unit);
- sc->sc_base.me_dv.dv_unit = unit;
+ sc->sc_base.me_dv->dv_private = sc;
+ sc->sc_base.me_dv->dv_unit = unit;
sc->sc_base.me_ops = &wsmux_srcops;
sc->sc_kbd_layout = KB_NONE;
return (sc);
@@ -661,7 +670,7 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
return (EINVAL);
DPRINTF(("wsmux_attach_sc: %s(%p): type=%d\n",
- sc->sc_base.me_dv.dv_xname, sc, me->me_ops->type));
+ device_xname(sc->sc_base.me_dv), sc, me->me_ops->type));
#ifdef DIAGNOSTIC
if (me->me_parent != NULL) {
@@ -677,7 +686,8 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
if (sc->sc_base.me_dispdv != NULL) {
/* This is a display mux, so attach the new device to it. */
DPRINTF(("wsmux_attach_sc: %s: set display %p\n",
- sc->sc_base.me_dv.dv_xname, sc->sc_base.me_dispdv));
+ device_xname(sc->sc_base.me_dv),
+ sc->sc_base.me_dispdv));
if (me->me_ops->dsetdisplay != NULL) {
error = wsevsrc_set_display(me, &sc->sc_base);
/* Ignore that the console already has a display. */
@@ -686,7 +696,8 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
if (!error) {
#ifdef WSDISPLAY_COMPAT_RAWKBD
DPRINTF(("wsmux_attach_sc: %s set rawkbd=%d\n",
- me->me_dv.dv_xname, sc->sc_rawkbd));
+ device_xname(me->me_dv),
+ sc->sc_rawkbd));
(void)wsevsrc_ioctl(me, WSKBDIO_SETMODE,
&sc->sc_rawkbd, 0, 0);
#endif
@@ -701,11 +712,12 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
if (sc->sc_base.me_evp != NULL) {
/* Mux is open, so open the new subdevice */
DPRINTF(("wsmux_attach_sc: %s: calling open of %s\n",
- sc->sc_base.me_dv.dv_xname, me->me_dv.dv_xname));
+ device_xname(sc->sc_base.me_dv),
+ device_xname(me->me_dv)));
error = wsevsrc_open(me, sc->sc_base.me_evp);
} else {
DPRINTF(("wsmux_attach_sc: %s not open\n",
- sc->sc_base.me_dv.dv_xname));
+ device_xname(sc->sc_base.me_dv)));
}
if (error) {
@@ -714,7 +726,7 @@ wsmux_attach_sc(struct wsmux_softc *sc, struct wsevsrc *me)
}
DPRINTF(("wsmux_attach_sc: %s(%p) done, error=%d\n",
- sc->sc_base.me_dv.dv_xname, sc, error));
+ device_xname(sc->sc_base.me_dv), sc, error));
return (error);
}
@@ -725,12 +737,12 @@ wsmux_detach_sc(struct wsevsrc *me)
struct wsmux_softc *sc = me->me_parent;
DPRINTF(("wsmux_detach_sc: %s(%p) parent=%p\n",
- me->me_dv.dv_xname, me, sc));
+ device_xname(me->me_dv), me, sc));
#ifdef DIAGNOSTIC
if (sc == NULL) {
printf("wsmux_detach_sc: %s has no parent\n",
- me->me_dv.dv_xname);
+ device_xname(me->me_dv));
return;
}
#endif
@@ -758,15 +770,15 @@ wsmux_detach_sc(struct wsevsrc *me)
* Display ioctl() of a mux via the parent mux.
*/
int
-wsmux_do_displayioctl(struct device *dv, u_long cmd, void *data, int flag,
+wsmux_do_displayioctl(device_t dv, u_long cmd, void *data, int flag,
struct lwp *l)
{
- struct wsmux_softc *sc = (struct wsmux_softc *)dv;
+ struct wsmux_softc *sc = device_private(dv);
struct wsevsrc *me;
int error, ok;
DPRINTF(("wsmux_displayioctl: %s: sc=%p, cmd=%08lx\n",
- sc->sc_base.me_dv.dv_xname, sc, cmd));
+ device_xname(sc->sc_base.me_dv), sc, cmd));
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (cmd == WSKBDIO_SETMODE) {
@@ -792,7 +804,7 @@ wsmux_do_displayioctl(struct device *dv, u_long cmd, void *data, int flag,
if (me->me_ops->ddispioctl != NULL) {
error = wsevsrc_display_ioctl(me, cmd, data, flag, l);
DPRINTF(("wsmux_displayioctl: me=%p dev=%s ==> %d\n",
- me, me->me_dv.dv_xname, error));
+ me, device_xname(me->me_dv), error));
if (!error)
ok = 1;
}
@@ -808,14 +820,14 @@ wsmux_do_displayioctl(struct device *dv, u_long cmd, void *data, int flag,
* Set display of a mux via the parent mux.
*/
int
-wsmux_evsrc_set_display(struct device *dv, struct wsevsrc *ame)
+wsmux_evsrc_set_display(device_t dv, struct wsevsrc *ame)
{
struct wsmux_softc *muxsc = (struct wsmux_softc *)ame;
- struct wsmux_softc *sc = (struct wsmux_softc *)dv;
- struct device *displaydv = muxsc ? muxsc->sc_base.me_dispdv : NULL;
+ struct wsmux_softc *sc = device_private(dv);
+ device_t displaydv = muxsc ? muxsc->sc_base.me_dispdv : NULL;
DPRINTF(("wsmux_set_display: %s: displaydv=%p\n",
- sc->sc_base.me_dv.dv_xname, displaydv));
+ device_xname(sc->sc_base.me_dv), displaydv));
if (displaydv != NULL) {
if (sc->sc_base.me_dispdv != NULL)
@@ -829,9 +841,9 @@ wsmux_evsrc_set_display(struct device *dv, struct wsevsrc *ame)
}
int
-wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
+wsmux_set_display(struct wsmux_softc *sc, device_t displaydv)
{
- struct device *odisplaydv;
+ device_t odisplaydv;
struct wsevsrc *me;
struct wsmux_softc *nsc = displaydv ? sc : NULL;
int error, ok;
@@ -840,8 +852,8 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
sc->sc_base.me_dispdv = displaydv;
if (displaydv)
- aprint_verbose("%s: connecting to %s\n",
- sc->sc_base.me_dv.dv_xname, displaydv->dv_xname);
+ aprint_verbose_dev(sc->sc_base.me_dv, "connecting to %s\n",
+ device_xname(displaydv));
ok = 0;
error = 0;
CIRCLEQ_FOREACH(me, &sc->sc_cld,me_next) {
@@ -854,12 +866,12 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
if (me->me_ops->dsetdisplay != NULL) {
error = wsevsrc_set_display(me, &nsc->sc_base);
DPRINTF(("wsmux_set_display: m=%p dev=%s error=%d\n",
- me, me->me_dv.dv_xname, error));
+ me, device_xname(me->me_dv), error));
if (!error) {
ok = 1;
#ifdef WSDISPLAY_COMPAT_RAWKBD
DPRINTF(("wsmux_set_display: %s set rawkbd=%d\n",
- me->me_dv.dv_xname, sc->sc_rawkbd));
+ device_xname(me->me_dv), sc->sc_rawkbd));
(void)wsevsrc_ioctl(me, WSKBDIO_SETMODE,
&sc->sc_rawkbd, 0, 0);
#endif
@@ -871,7 +883,8 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv)
if (displaydv == NULL)
aprint_verbose("%s: disconnecting from %s\n",
- sc->sc_base.me_dv.dv_xname, odisplaydv->dv_xname);
+ device_xname(sc->sc_base.me_dv),
+ device_xname(odisplaydv));
return (error);
}
diff --git a/sys/dev/wscons/wsmuxvar.h b/sys/dev/wscons/wsmuxvar.h
index 898c4280de9..a5d1409163f 100644
--- a/sys/dev/wscons/wsmuxvar.h
+++ b/sys/dev/wscons/wsmuxvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmuxvar.h,v 1.12 2007/03/04 06:02:52 christos Exp $ */
+/* $NetBSD: wsmuxvar.h,v 1.13 2008/03/25 00:49:20 cube Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,12 +40,12 @@
* A ws event source, i.e., wskbd, wsmouse, or wsmux.
*/
struct wsevsrc {
- struct device me_dv;
+ device_t me_dv;
const struct wssrcops *me_ops; /* method pointers */
struct wseventvar me_evar; /* wseventvar opened directly */
struct wseventvar *me_evp; /* our wseventvar when open */
#if NWSDISPLAY > 0
- struct device *me_dispdv; /* our display if part of one */
+ device_t me_dispdv; /* our display if part of one */
#endif
#if NWSMUX > 0
struct wsmux_softc *me_parent; /* parent mux device */
@@ -61,9 +61,9 @@ struct wssrcops {
int type; /* device type: WSMUX_{MOUSE,KBD,MUX} */
int (*dopen)(struct wsevsrc *, struct wseventvar *);
int (*dclose)(struct wsevsrc *);
- int (*dioctl)(struct device *, u_long, void *, int, struct lwp *);
- int (*ddispioctl)(struct device *, u_long, void *, int, struct lwp *);
- int (*dsetdisplay)(struct device *, struct wsevsrc *);
+ int (*dioctl)(device_t, u_long, void *, int, struct lwp *);
+ int (*ddispioctl)(device_t, u_long, void *, int, struct lwp *);
+ int (*dsetdisplay)(device_t, struct wsevsrc *);
};
#define wsevsrc_open(me, evp) \
@@ -71,11 +71,11 @@ struct wssrcops {
#define wsevsrc_close(me) \
((me)->me_ops->dclose((me)))
#define wsevsrc_ioctl(me, cmd, data, flag, l) \
- ((me)->me_ops->dioctl(&(me)->me_dv, cmd, (void *)data, flag, l))
+ ((me)->me_ops->dioctl((me)->me_dv, cmd, (void *)data, flag, l))
#define wsevsrc_display_ioctl(me, cmd, data, flag, l) \
- ((me)->me_ops->ddispioctl(&(me)->me_dv, cmd, (void *)data, flag, l))
+ ((me)->me_ops->ddispioctl((me)->me_dv, cmd, (void *)data, flag, l))
#define wsevsrc_set_display(me, arg) \
- ((me)->me_ops->dsetdisplay(&(me)->me_dv, arg))
+ ((me)->me_ops->dsetdisplay((me)->me_dv, arg))
#if NWSMUX > 0
struct wsmux_softc {
@@ -92,7 +92,7 @@ struct wsmux_softc *wsmux_getmux(int);
struct wsmux_softc *wsmux_create(const char *, int);
int wsmux_attach_sc(struct wsmux_softc *, struct wsevsrc *);
void wsmux_detach_sc(struct wsevsrc *);
-int wsmux_set_display(struct wsmux_softc *, struct device *);
+int wsmux_set_display(struct wsmux_softc *, device_t);
int wskbd_add_mux(int, struct wsmux_softc *);
int wsmouse_add_mux(int, struct wsmux_softc *);