diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -175,6 +175,9 @@ #define PCM_DETACHING(x) ((x)->flags & SD_F_DETACHING) +#define PCM_CHANCOUNT(d) \ + (d->playcount + d->pvchancount + d->reccount + d->rvchancount) + /* many variables should be reduced to a range. Here define a macro */ #define RANGE(var, low, high) (var) = \ (((var)<(low))? (low) : ((var)>(high))? (high) : (var)) @@ -367,7 +370,7 @@ } opened; } pcm; } channels; - unsigned devcount, playcount, reccount, pvchancount, rvchancount ; + unsigned playcount, reccount, pvchancount, rvchancount; unsigned flags; unsigned int bufsz; void *devinfo; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -602,8 +602,6 @@ break; } - d->devcount++; - return (0); } @@ -644,8 +642,6 @@ break; } - d->devcount--; - return (0); } @@ -947,7 +943,6 @@ d->flags |= SD_F_BITPERFECT; d->devinfo = devinfo; - d->devcount = 0; d->reccount = 0; d->playcount = 0; d->pvchancount = 0; @@ -1116,7 +1111,7 @@ PCM_UNLOCKASSERT(d); PCM_LOCK(d); - si->numaudios += d->devcount; + si->numaudios += PCM_CHANCOUNT(d); ++ncards; CHN_FOREACH(c, d, channels.pcm) {