sync with OpenBSD -current
This commit is contained in:
parent
e26f182543
commit
eff43bb1fd
20 changed files with 553 additions and 416 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dt_dev.c,v 1.28 2023/07/14 07:07:08 claudio Exp $ */
|
||||
/* $OpenBSD: dt_dev.c,v 1.29 2024/01/02 16:32:48 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
|
||||
|
@ -160,13 +160,13 @@ int
|
|||
dtopen(dev_t dev, int flags, int mode, struct proc *p)
|
||||
{
|
||||
struct dt_softc *sc;
|
||||
struct dt_evt *queue;
|
||||
size_t qlen;
|
||||
int unit = minor(dev);
|
||||
|
||||
if (!allowdt)
|
||||
return EPERM;
|
||||
|
||||
KASSERT(dtlookup(unit) == NULL);
|
||||
|
||||
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO);
|
||||
if (sc == NULL)
|
||||
return ENOMEM;
|
||||
|
@ -174,16 +174,26 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p)
|
|||
/*
|
||||
* Enough space to empty 2 full rings of events in a single read.
|
||||
*/
|
||||
sc->ds_bufqlen = 2 * DT_EVTRING_SIZE;
|
||||
sc->ds_bufqueue = mallocarray(sc->ds_bufqlen, sizeof(*sc->ds_bufqueue),
|
||||
M_DEVBUF, M_WAITOK|M_CANFAIL);
|
||||
if (sc->ds_bufqueue == NULL)
|
||||
goto bad;
|
||||
qlen = 2 * DT_EVTRING_SIZE;
|
||||
queue = mallocarray(qlen, sizeof(*queue), M_DEVBUF, M_WAITOK|M_CANFAIL);
|
||||
if (queue == NULL) {
|
||||
free(sc, M_DEVBUF, sizeof(*sc));
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
/* no sleep after this point */
|
||||
if (dtlookup(unit) != NULL) {
|
||||
free(queue, M_DEVBUF, qlen * sizeof(*queue));
|
||||
free(sc, M_DEVBUF, sizeof(*sc));
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
sc->ds_unit = unit;
|
||||
sc->ds_pid = p->p_p->ps_pid;
|
||||
TAILQ_INIT(&sc->ds_pcbs);
|
||||
mtx_init(&sc->ds_mtx, IPL_HIGH);
|
||||
sc->ds_bufqlen = qlen;
|
||||
sc->ds_bufqueue = queue;
|
||||
sc->ds_evtcnt = 0;
|
||||
sc->ds_readevt = 0;
|
||||
sc->ds_dropevt = 0;
|
||||
|
@ -193,10 +203,6 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p)
|
|||
DPRINTF("dt%d: pid %d open\n", sc->ds_unit, sc->ds_pid);
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
free(sc, M_DEVBUF, sizeof(*sc));
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: qwx.c,v 1.1 2023/12/28 17:36:29 stsp Exp $ */
|
||||
/* $OpenBSD: qwx.c,v 1.2 2024/01/02 17:39:08 stsp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
|
||||
|
@ -208,6 +208,8 @@ qwx_init(struct ifnet *ifp)
|
|||
|
||||
ieee80211_begin_scan(ifp);
|
||||
} else {
|
||||
sc->attached = 1;
|
||||
|
||||
/* Configure MAC address at boot-time. */
|
||||
error = if_setlladdr(ifp, ic->ic_myaddr);
|
||||
if (error)
|
||||
|
@ -18329,8 +18331,6 @@ qwx_attach(struct qwx_softc *sc)
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
sc->attached = 1;
|
||||
|
||||
/* Turn device off until interface comes up. */
|
||||
qwx_core_deinit(sc);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue