On Thu, Oct 27, 2022 at 08:35:31PM +, Klemens Nanni wrote:
> On Thu, Oct 27, 2022 at 03:51:05PM +0200, Alexandre Ratchov wrote:
> > On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> > > @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
> > >
> > > DPRINTF(("ad1848_open
On Thu, Oct 27, 2022 at 03:51:05PM +0200, Alexandre Ratchov wrote:
> On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> > @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
> >
> > DPRINTF(("ad1848_open: sc=%p\n", sc));
> >
> > + if ((flags & (FWRITE | FREAD)) && sc->m
27 Oct 2022 17:31:45 Miod Vallat :
> Wait, this is wrong. All your
>
> (flags & (FWRITE | FREAD))
>
> comparisons must be
>
> ((flags & (FWRITE | FREAD)) == (FWRITE | FREAD))
>
> in order to truly catch full-duplex opens. Otherwise the condition will
> always be satisfied since one o
On Thu, Oct 27, 2022 at 01:08:57PM +, Klemens Nanni wrote:
> @@ -1040,6 +1041,9 @@ ad1848_open(void *addr, int flags)
>
> DPRINTF(("ad1848_open: sc=%p\n", sc));
>
> + if ((flags & (FWRITE | FREAD)) && sc->mode != 2)
> + return ENXIO;
> +
> sc->sc_pintr = sc->sc_p
Make drivers which do *not* adverise AUDIO_PROP_FULLDPLEX return ENXIO
in their open() if full-duplex mode was requested.
This way, sys/dev/audio.c:audio_open() will fail immediately rather than
later through the to-be-removed get_props() check.
This is the first round for drivers with logic in t