summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorisaki <isaki@NetBSD.org>2020-02-22 07:09:18 +0000
committerisaki <isaki@NetBSD.org>2020-02-22 07:09:18 +0000
commit0a7e5edd17304fa5d5da394e33b03a56e7721fa2 (patch)
tree967a3ed50d910bed21e53b73fe27d5741ae011b9 /sys/dev
parentcf749042caeab2ba066d40712a6932c0b99867dd (diff)
hw_if->query_format is already mandatory method. Drop null checks.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio/audio.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c
index 77a841ae334..ded59d141ce 100644
--- a/sys/dev/audio/audio.c
+++ b/sys/dev/audio/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.47 2020/02/22 06:58:39 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.48 2020/02/22 07:09:18 isaki Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.47 2020/02/22 06:58:39 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.48 2020/02/22 07:09:18 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -2690,15 +2690,11 @@ audio_ioctl(dev_t dev, struct audio_softc *sc, u_long cmd, void *addr, int flag,
case AUDIO_QUERYFORMAT:
query = (audio_format_query_t *)addr;
- if (sc->hw_if->query_format) {
- mutex_enter(sc->sc_lock);
- error = sc->hw_if->query_format(sc->hw_hdl, query);
- mutex_exit(sc->sc_lock);
- /* Hide internal infomations */
- query->fmt.driver_data = NULL;
- } else {
- error = ENODEV;
- }
+ mutex_enter(sc->sc_lock);
+ error = sc->hw_if->query_format(sc->hw_hdl, query);
+ mutex_exit(sc->sc_lock);
+ /* Hide internal infomations */
+ query->fmt.driver_data = NULL;
break;
case AUDIO_GETFORMAT:
@@ -6226,21 +6222,6 @@ audio_hw_validate_format(struct audio_softc *sc, int mode,
KASSERT(mutex_owned(sc->sc_lock));
- /*
- * If query_format is not supported by hardware driver,
- * a rough check instead will be performed.
- * XXX This will gone in the future.
- */
- if (sc->hw_if->query_format == NULL) {
- if (fmt->encoding != AUDIO_ENCODING_SLINEAR_NE)
- return EINVAL;
- if (fmt->precision != AUDIO_INTERNAL_BITS)
- return EINVAL;
- if (fmt->stride != AUDIO_INTERNAL_BITS)
- return EINVAL;
- return 0;
- }
-
for (index = 0; ; index++) {
query.index = index;
error = sc->hw_if->query_format(sc->hw_hdl, &query);