diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -52,7 +52,6 @@ SND_DECLARE_FILE(""); -#define SS_TYPE_MODULE 0 #define SS_TYPE_PCM 1 #define SS_TYPE_MIDI 2 #define SS_TYPE_SEQUENCER 3 @@ -561,8 +560,6 @@ struct snddev_info *d; nvlist_t *di; - if (ent->dev == NULL) - continue; d = device_get_softc(ent->dev); if (!PCM_REGISTERED(d)) continue; @@ -1063,21 +1060,16 @@ const char *devtype; int type, unit; - if (dev) { - unit = device_get_unit(dev); - devtype = device_get_name(dev); - if (!strcmp(devtype, "pcm")) - type = SS_TYPE_PCM; - else if (!strcmp(devtype, "midi")) - type = SS_TYPE_MIDI; - else if (!strcmp(devtype, "sequencer")) - type = SS_TYPE_SEQUENCER; - else - return (EINVAL); - } else { - type = SS_TYPE_MODULE; - unit = -1; - } + unit = device_get_unit(dev); + devtype = device_get_name(dev); + if (!strcmp(devtype, "pcm")) + type = SS_TYPE_PCM; + else if (!strcmp(devtype, "midi")) + type = SS_TYPE_MIDI; + else if (!strcmp(devtype, "sequencer")) + type = SS_TYPE_SEQUENCER; + else + return (EINVAL); ent = malloc(sizeof *ent, M_DEVBUF, M_WAITOK | M_ZERO); ent->dev = dev; @@ -1108,10 +1100,9 @@ return (0); } -int -sndstat_registerfile(char *str) +void +sndstat_registerfile(void *dummy __unused) { - return (sndstat_register(NULL, str, NULL)); } int @@ -1134,24 +1125,9 @@ return (error); } -int -sndstat_unregisterfile(char *str) +void +sndstat_unregisterfile(void *dummy __unused) { - struct sndstat_entry *ent; - int error = ENXIO; - - SNDSTAT_LOCK(); - TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL && ent->str == str) { - TAILQ_REMOVE(&sndstat_devlist, ent, link); - free(ent, M_DEVBUF); - error = 0; - break; - } - } - SNDSTAT_UNLOCK(); - - return (error); } /************************************************************************/ @@ -1177,8 +1153,6 @@ /* generate list of installed devices */ k = 0; TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL) - continue; d = device_get_softc(ent->dev); if (!PCM_REGISTERED(d)) continue; @@ -1226,19 +1200,6 @@ if (k == 0) sbuf_printf(s, "No devices installed from userspace.\n"); - /* append any file versions */ - if (snd_verbose >= 3) { - k = 0; - TAILQ_FOREACH(ent, &sndstat_devlist, link) { - if (ent->dev == NULL && ent->str != NULL) { - if (!k++) - sbuf_printf(s, "\nFile Versions:\n"); - sbuf_printf(s, "%s\n", ent->str); - } - } - if (k == 0) - sbuf_printf(s, "\nNo file versions.\n"); - } sbuf_finish(s); return (sbuf_len(s)); } 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 @@ -347,20 +347,11 @@ typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose); int sndstat_register(device_t dev, char *str, sndstat_handler handler); -int sndstat_registerfile(char *str); +void sndstat_registerfile(void *); int sndstat_unregister(device_t dev); -int sndstat_unregisterfile(char *str); +void sndstat_unregisterfile(void *); -#define SND_DECLARE_FILE(version) \ - _SND_DECLARE_FILE(__LINE__, version) - -#define _SND_DECLARE_FILE(uniq, version) \ - __SND_DECLARE_FILE(uniq, version) - -#define __SND_DECLARE_FILE(uniq, version) \ - static char sndstat_vinfo[] = version; \ - SYSINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_registerfile, sndstat_vinfo); \ - SYSUNINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_unregisterfile, sndstat_vinfo); +#define SND_DECLARE_FILE(version) /* usage of flags in device config entry (config file) */ #define DV_F_DRQ_MASK 0x00000007 /* mask for secondary drq */