Re: remove unreachable code from all audio drivers

2016-09-08 Thread Philip Guenther
On Wed, 7 Sep 2016, Alexandre Ratchov wrote:
> This diff deletes unreachable code in low-level audio drivers.  As
> this touches all archs, tests (a quick kernel build is enough) are
> welcome on anything but amd64 and i386.
> 
> OK?

Kernel builds and boots and a file recorded with aucat -o plays correctly 
on both loongson and macppc.  Kernel builds and boots on armv7, but no 
audio devices to test again.


Philip Guuenther



remove unreachable code from all audio drivers

2016-09-07 Thread Alexandre Ratchov
This diff deletes unreachable code in low-level audio drivers.  As
this touches all archs, tests (a quick kernel build is enough) are
welcome on anything but amd64 and i386.

OK?

Index: share/man/man9/audio.9
===
RCS file: /cvs/src/share/man/man9/audio.9,v
retrieving revision 1.24
diff -u -p -r1.24 audio.9
--- share/man/man9/audio.9  1 Sep 2016 10:14:08 -   1.24
+++ share/man/man9/audio.9  7 Sep 2016 14:01:04 -
@@ -45,9 +45,6 @@ structure.
 struct audio_hw_if {
int (*open)(void *, int);
void(*close)(void *);
-   int (*drain)(void *);
-
-   int (*query_encoding)(void *, struct audio_encoding *);
int (*set_params)(void *, int, int,
struct audio_params *, struct audio_params *);
int (*round_blocksize)(void *, int);
@@ -78,15 +75,12 @@ struct audio_hw_if {
void*(*allocm)(void *, int, size_t, int, int);
void(*freem)(void *, void *, int);
size_t  (*round_buffersize)(void *, int, size_t);
-   paddr_t (*mappage)(void *, void *, off_t, int);
-
int (*get_props)(void *);
 
int (*trigger_output)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
int (*trigger_input)(void *, void *, void *, int,
void (*)(void *), void *, struct audio_params *);
-   void(*get_default_params)(void *, int, struct audio_params *);
 };
 
 struct audio_params {
@@ -160,22 +154,6 @@ is matched by a call to
 This function returns 0 on success, otherwise an error code.
 .It Fn "void (*close)" "void *hdl"
 This function is called when the audio device is closed.
-.It Fn "int (*drain)" "void *hdl"
-This function is optional.
-If supplied, it is called before the device is closed or when the
-.Dv AUDIO_DRAIN
-.Xr ioctl 2
-is called.
-It makes sure that no samples remain to be played that could
-be lost when
-.Fn close
-is called.
-This function returns 0 on success, otherwise an error code.
-.It Fn "int (*query_encoding)" "void *hdl" "struct audio_encoding *ae"
-This function fills
-.Fa ae
-and returns 0 or, if there is no encoding with the given number, returns
-.Er EINVAL .
 .It Fn "int (*set_params)" "void *hdl" "int setmode" "int usemode" \
 "struct audio_params *play" "struct audio_params *rec"
 This function is called to set the audio encoding mode.
@@ -375,18 +353,6 @@ Note that the buffer size is always a mu
 and
 .Fn round_buffersize
 must be consistent.
-.It Fn "paddr_t (*mappage)" "void *hdl" "void *addr" "off_t offs" "int prot"
-This function is optional.
-If supplied, it is called for
-.Xr mmap 2 .
-It returns the map value for the page at offset
-.Fa offs
-from address
-.Fa addr
-mapped with protection
-.Fa prot .
-This function returns \-1 on failure, or a machine dependent opaque
-value on success.
 .It Fn "int (*get_props)" "void *hdl"
 This function returns a combination of
 .Dv AUDIO_PROP_xxx
@@ -435,21 +401,6 @@ will be called with the argument
 Once started, the transfer may be stopped using
 .Fn halt_input .
 This function returns 0 on success, otherwise an error code.
-.It Fn "void (*get_default_params)" "void *hdl" "int direction" \
-"struct audio_params *param"
-This function is optional.
-If supplied, it is called to retrieve the default configuration
-for the given
-.Fa direction ,
-parameterized in
-.Fa param .
-.Fa direction
-is
-.Dv AUMODE_PLAY
-or
-.Dv AUMODE_RECORD .
-The default configuration should not include emulated formats, and should
-reflect the optimal operating configuration for the underlying hardware.
 .El
 .Pp
 If the audio hardware is capable of input from more
@@ -497,7 +448,6 @@ and be of class
 .Dv AudioCoutputs .
 .Sh SEE ALSO
 .Xr ioctl 2 ,
-.Xr mmap 2 ,
 .Xr open 2 ,
 .Xr sio_open 3 ,
 .Xr audio 4 ,
Index: sys/arch/hppa/gsc/harmony.c
===
RCS file: /cvs/src/sys/arch/hppa/gsc/harmony.c,v
retrieving revision 1.31
diff -u -p -r1.31 harmony.c
--- sys/arch/hppa/gsc/harmony.c 8 Sep 2015 07:14:04 -   1.31
+++ sys/arch/hppa/gsc/harmony.c 7 Sep 2016 14:01:05 -
@@ -56,7 +56,6 @@
 
 int harmony_open(void *, int);
 voidharmony_close(void *);
-int harmony_query_encoding(void *, struct audio_encoding *);
 int harmony_set_params(void *, int, int, struct audio_params *,
 struct audio_params *);
 int harmony_round_blocksize(void *, int);
@@ -79,8 +78,6 @@ int harmony_trigger_input(void *, vo
 struct audio_hw_if harmony_sa_hw_if = {
harmony_open,
harmony_close,
-   NULL,
-   harmony_query_encoding,
harmony_set_params,
harmony_round_blocksize,
harmony_commit_settings,
@@ -99,11 +96,9 @@ struct audio_hw_if harmony_sa_hw_if = {
harmony_allocm,
harmony_freem,
harmony_round_buffersize,
-   NULL,
harmony_get_props,