Module Name: src Committed By: isaki Date: Tue May 21 12:52:57 UTC 2019
Modified Files: src/sys/dev/audio: audio.c Log Message: Adjust debug message. Inspired from PR kern/54177. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.7 src/sys/dev/audio/audio.c:1.8 --- src/sys/dev/audio/audio.c:1.7 Mon May 13 08:50:25 2019 +++ src/sys/dev/audio/audio.c Tue May 21 12:52:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.7 2019/05/13 08:50:25 nakayama Exp $ */ +/* $NetBSD: audio.c,v 1.8 2019/05/21 12:52:57 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -149,7 +149,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.7 2019/05/13 08:50:25 nakayama Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.8 2019/05/21 12:52:57 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -580,11 +580,7 @@ static int audio_sysctl_blk_ms(SYSCTLFN_ static int audio_sysctl_multiuser(SYSCTLFN_PROTO); #if defined(AUDIO_DEBUG) static int audio_sysctl_debug(SYSCTLFN_PROTO); -#endif -#if defined(DIAGNOSTIC) || defined(AUDIO_DEBUG) static void audio_format2_tostr(char *, size_t, const audio_format2_t *); -#endif -#if defined(AUDIO_DEBUG) static void audio_print_format2(const char *, const audio_format2_t *) __unused; #endif @@ -6751,7 +6747,12 @@ audio_file_setinfo(struct audio_softc *s if (ptrack) { pchanges = audio_track_setinfo_check(&pfmt, pi); if (pchanges == -1) { - TRACET(1, ptrack, "check play.params failed"); +#if defined(AUDIO_DEBUG) + char fmtbuf[64]; + audio_format2_tostr(fmtbuf, sizeof(fmtbuf), &pfmt); + TRACET(1, ptrack, "check play.params failed: %s", + fmtbuf); +#endif return EINVAL; } if (SPECIFIED(ai->mode)) @@ -6760,7 +6761,12 @@ audio_file_setinfo(struct audio_softc *s if (rtrack) { rchanges = audio_track_setinfo_check(&rfmt, ri); if (rchanges == -1) { - TRACET(1, rtrack, "check record.params failed"); +#if defined(AUDIO_DEBUG) + char fmtbuf[64]; + audio_format2_tostr(fmtbuf, sizeof(fmtbuf), &rfmt); + TRACET(1, rtrack, "check record.params failed: %s", + fmtbuf); +#endif return EINVAL; } if (SPECIFIED(ai->mode)) @@ -6894,14 +6900,8 @@ audio_track_setinfo_check(audio_format2_ } if (changes) { - if (audio_check_params(fmt) != 0) { -#ifdef DIAGNOSTIC - char fmtbuf[64]; - audio_format2_tostr(fmtbuf, sizeof(fmtbuf), fmt); - printf("%s failed: %s\n", __func__, fmtbuf); -#endif + if (audio_check_params(fmt) != 0) return -1; - } } return changes; @@ -7662,7 +7662,7 @@ audio_resume(device_t dv, const pmf_qual return true; } -#if defined(DIAGNOSTIC) || defined(AUDIO_DEBUG) +#if defined(AUDIO_DEBUG) static void audio_format2_tostr(char *buf, size_t bufsize, const audio_format2_t *fmt) {