Re: audio: remove unused AUDIO_PROP_{MMAP,INDEPENDENT}

2022-10-18 Thread Klemens Nanni
On Tue, Oct 18, 2022 at 09:32:27AM +0200, Alexandre Ratchov wrote:
> On Mon, Oct 17, 2022 at 07:45:33PM +, Klemens Nanni wrote:
> > I was looking at one particular driver and needed to know what those
> > flags are, turns out AUDIO_PROP_FULLDUPLEX is the only audio(9) property
> > that is in use.
> 
> Even AUDIO_PROP_FULLDUPLEX (and the associated get_props() and setfd()
> routines) should go. FWIW, an audio device has only these modes:

I was wondering about the usefulness of AUDIO_PROP_FULLDUPLEX...

> 
> AUDIO_MODE_PLAY -> play only
> AUDIO_MODE_RECORD -> record only
> AUDIO_MODE_PLAY | AUDIO_MODE_RECORD -> play and record (in sync)
> 
> But this requires touching the isa(4) drivers, bba(4/alpha), arcofi(4)
> and alike.
> 
> > 
> > Feedback? Objection? OK?
> > 
> 
> ok ratchov, thanks!
> 
> As we,re at it, last point: audio_if.h and audioio.h are private
> interfaces and the risk of breaking a port close to zero.
> 
> distfiles contain the "sys/audioio.h" string because it's still used
> on SunOS and NetBSD but these are #ifdef'd out on OpenBSD.

Thanks for clarifying that.



Re: audio: remove unused AUDIO_PROP_{MMAP,INDEPENDENT}

2022-10-18 Thread Alexandre Ratchov
On Mon, Oct 17, 2022 at 07:45:33PM +, Klemens Nanni wrote:
> I was looking at one particular driver and needed to know what those
> flags are, turns out AUDIO_PROP_FULLDUPLEX is the only audio(9) property
> that is in use.

Even AUDIO_PROP_FULLDUPLEX (and the associated get_props() and setfd()
routines) should go. FWIW, an audio device has only these modes:

AUDIO_MODE_PLAY -> play only
AUDIO_MODE_RECORD -> record only
AUDIO_MODE_PLAY | AUDIO_MODE_RECORD -> play and record (in sync)

But this requires touching the isa(4) drivers, bba(4/alpha), arcofi(4)
and alike.

> 
> Feedback? Objection? OK?
> 

ok ratchov, thanks!

As we,re at it, last point: audio_if.h and audioio.h are private
interfaces and the risk of breaking a port close to zero.

distfiles contain the "sys/audioio.h" string because it's still used
on SunOS and NetBSD but these are #ifdef'd out on OpenBSD.



Re: audio: remove unused AUDIO_PROP_{MMAP,INDEPENDENT}

2022-10-17 Thread Klemens Nanni
On Mon, Oct 17, 2022 at 09:53:26PM +0200, Mark Kettenis wrote:
> > Date: Mon, 17 Oct 2022 19:45:33 +
> > From: Klemens Nanni 
> > 
> > I was looking at one particular driver and needed to know what those
> > flags are, turns out AUDIO_PROP_FULLDUPLEX is the only audio(9) property
> > that is in use.
> > 
> > The other two are only ever set in *_get_props();  their handling
> > disappeared from sys/dev/audio.c in
> > 
> > commit 1cf2860827c8ca659d8097d8da94a5ae5b888c53
> > Author: ratchov 
> > Date:   Thu Jun 25 06:43:45 2015 +
> > 
> > Reimplement the audio driver in a simpler way, removing 
> > unused/unusable
> > functionality. Same API and ABI except for the removed bits and no
> > behaviour change for programs using libsndio. With help from armani@
> > and mpi@, thanks.
> > 
> > and the following merely moved them when they were dead code already:
> > 
> > commit 9215aa3dfad387bca877a805534df6dcfe8722eb
> > Author: ratchov 
> > Date:   Wed Aug 31 07:22:43 2016 +
> > 
> > Delete unused ioctls and associated macros. Move macros that are 
> > still
> > used internally by low-level drivers from sys/audioio.h to
> > dev/audio_if.h instead of deleting them.
> > 
> > Feedback? Objection? OK?
> 
> Is there code in ports (or even base) that relies on those flags being
> defined in sys/audioio.h.

dev/audio_if.h currently defines them.

base does not use AUDIO_PROP_*.
/usr/ports/ has no occurence of AUDIO_PROP_ and codesearch[0] only shows
the same two code snippets around AUDIO_PROP_{CAPTURE,PLAYBACK}
(which we don't have) in firefox-esr, mozjs and cubeb.

So I think this is safe.

0: https://codesearch.debian.net/search?q=AUDIO_PROP_=1



Re: audio: remove unused AUDIO_PROP_{MMAP,INDEPENDENT}

2022-10-17 Thread Mark Kettenis
> Date: Mon, 17 Oct 2022 19:45:33 +
> From: Klemens Nanni 
> 
> I was looking at one particular driver and needed to know what those
> flags are, turns out AUDIO_PROP_FULLDUPLEX is the only audio(9) property
> that is in use.
> 
> The other two are only ever set in *_get_props();  their handling
> disappeared from sys/dev/audio.c in
> 
>   commit 1cf2860827c8ca659d8097d8da94a5ae5b888c53
>   Author: ratchov 
>   Date:   Thu Jun 25 06:43:45 2015 +
> 
>   Reimplement the audio driver in a simpler way, removing 
> unused/unusable
>   functionality. Same API and ABI except for the removed bits and no
>   behaviour change for programs using libsndio. With help from armani@
>   and mpi@, thanks.
> 
> and the following merely moved them when they were dead code already:
> 
>   commit 9215aa3dfad387bca877a805534df6dcfe8722eb
>   Author: ratchov 
>   Date:   Wed Aug 31 07:22:43 2016 +
> 
>   Delete unused ioctls and associated macros. Move macros that are 
> still
>   used internally by low-level drivers from sys/audioio.h to
>   dev/audio_if.h instead of deleting them.
> 
> Feedback? Objection? OK?

Is there code in ports (or even base) that relies on those flags being
defined in sys/audioio.h.

> diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c
> index 38c7ed6b411..bd5dcbb2273 100644
> --- a/sys/arch/macppc/dev/awacs.c
> +++ b/sys/arch/macppc/dev/awacs.c
> @@ -873,7 +873,7 @@ awacs_allocm(void *h, int dir, size_t size, int type, int 
> flags)
>  int
>  awacs_get_props(void *h)
>  {
> - return AUDIO_PROP_FULLDUPLEX /* | AUDIO_PROP_MMAP */;
> + return AUDIO_PROP_FULLDUPLEX;
>  }
>  
>  int
> diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c
> index b87711a0497..e3ab9465ad8 100644
> --- a/sys/arch/macppc/dev/i2s.c
> +++ b/sys/arch/macppc/dev/i2s.c
> @@ -583,7 +583,7 @@ i2s_round_buffersize(void *h, int dir, size_t size)
>  int
>  i2s_get_props(void *h)
>  {
> - return AUDIO_PROP_FULLDUPLEX /* | AUDIO_PROP_MMAP */;
> + return AUDIO_PROP_FULLDUPLEX;
>  }
>  
>  int
> diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h
> index c5adaf579cd..dd7a891f915 100644
> --- a/sys/dev/audio_if.h
> +++ b/sys/dev/audio_if.h
> @@ -44,8 +44,6 @@
>   * get_props
>   */
>  #define AUDIO_PROP_FULLDUPLEX0x01
> -#define AUDIO_PROP_MMAP  0x02
> -#define AUDIO_PROP_INDEPENDENT   0x04
>  
>  #define AUDIO_BPS(bits)  (bits) <= 8 ? 1 : ((bits) <= 16 ? 2 : 4)
>  
> diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
> index 68e9a891f1e..d984d39ec4e 100644
> --- a/sys/dev/isa/ad1848.c
> +++ b/sys/dev/isa/ad1848.c
> @@ -1464,6 +1464,5 @@ ad1848_get_props(void *addr)
>  {
>   struct ad1848_softc *sc = addr;
>  
> - return AUDIO_PROP_MMAP |
> - (sc->mode == 2 ? AUDIO_PROP_FULLDUPLEX : 0);
> + return (sc->mode == 2 ? AUDIO_PROP_FULLDUPLEX : 0);
>  }
> diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c
> index c0298cacfb4..aab79005463 100644
> --- a/sys/dev/isa/ess.c
> +++ b/sys/dev/isa/ess.c
> @@ -2074,13 +2074,13 @@ ess_round_buffersize(void *addr, int direction, 
> size_t size)
>  int
>  ess_1788_get_props(void *addr)
>  {
> - return (AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT);
> + return (0);
>  }
>  
>  int
>  ess_1888_get_props(void *addr)
>  {
> - return (AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT | 
> AUDIO_PROP_FULLDUPLEX);
> + return (AUDIO_PROP_FULLDUPLEX);
>  }
>  
>  /* 
> diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
> index fbe64587fd2..174989317d4 100644
> --- a/sys/dev/isa/gus.c
> +++ b/sys/dev/isa/gus.c
> @@ -2698,8 +2698,7 @@ int
>  gus_get_props(void *addr)
>  {
>   struct gus_softc *sc = addr;
> - return AUDIO_PROP_MMAP |
> - (sc->sc_recdrq == sc->sc_drq ? 0 : AUDIO_PROP_FULLDUPLEX);
> + return (sc->sc_recdrq == sc->sc_drq ? 0 : AUDIO_PROP_FULLDUPLEX);
>  }
>  
>  int
> diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
> index 84845094c92..41ec544601c 100644
> --- a/sys/dev/isa/sbdsp.c
> +++ b/sys/dev/isa/sbdsp.c
> @@ -2116,8 +2116,7 @@ int
>  sbdsp_get_props(void *addr)
>  {
>   struct sbdsp_softc *sc = addr;
> - return AUDIO_PROP_MMAP | AUDIO_PROP_INDEPENDENT |
> -(sc->sc_fullduplex ? AUDIO_PROP_FULLDUPLEX : 0);
> + return (sc->sc_fullduplex ? AUDIO_PROP_FULLDUPLEX : 0);
>  }
>  
>  #if NMIDI > 0
> diff --git a/sys/dev/pci/auacer.c b/sys/dev/pci/auacer.c
> index ad840a08458..ee26ab75569 100644
> --- a/sys/dev/pci/auacer.c
> +++ b/sys/dev/pci/auacer.c
> @@ -642,8 +642,7 @@ auacer_round_buffersize(void *v, int direction, size_t 
> size)
>  int
>  auacer_get_props(void *v)
>  {
> - return (AUDIO_PROP_INDEPENDENT | AUDIO_PROP_FULLDUPLEX |
> - AUDIO_PROP_MMAP);
> + return (AUDIO_PROP_FULLDUPLEX);
>  }
>  
>  static void
> diff --git a/sys/dev/pci/auglx.c b/sys/dev/pci/auglx.c
> index