Download raw body.
vio: Reduce code duplication in control queue handling
On Fri, 6 Sep 2024, Claudio Jeker wrote:
> On Fri, Sep 06, 2024 at 10:18:52AM +0200, Stefan Fritsch wrote:
> > Hi,
> >
> > On Wed, 4 Sep 2024, Alexander Bluhm wrote:
> > > Comments inline.
> >
> > Some answers inline. New diff below.
> >
> > > >
> > > > - if ((r = vio_wait_ctrl(sc)) != 0)
> > > > - return r;
> > > > + while (sc->sc_ctrl_inuse != FREE) {
> > > > + if (sc->sc_ctrl_inuse == RESET || vio_needs_reset(sc))
> > > > + return ENXIO;
> > > > + r = tsleep_nsec(&sc->sc_ctrl_inuse, PRIBIO, "viowait", INFSLP);
> > >
> > > The old code aborted if sleep() returned an error.
> >
> > In the absence of PCATCH or a timeout, tsleep should not return an error.
> > But I added a return anyway.
>
> Correct. This should not return an error. Maybe a KASSERT is enough.
> I wonder why this uses PRIBIO here? This is not a disk IO wait.
There is no PRINET/PNET. Not sure which value would be correct here. Some
drivers use 0, which would be PSWP, some use PWAIT, others use PRIBIO. I
suspect it does not matter much?
vio: Reduce code duplication in control queue handling