ALSA: usb: Clean up with new procfs helpers
Simplify the proc fs creation code with new helper functions, snd_card_ro_proc_new() and snd_card_rw_proc_new(). Just a code refactoring and no functional changes. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3c6ee77088
commit
7449054af0
|
@ -3441,7 +3441,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
||||||
.dev_free = snd_usb_mixer_dev_free
|
.dev_free = snd_usb_mixer_dev_free
|
||||||
};
|
};
|
||||||
struct usb_mixer_interface *mixer;
|
struct usb_mixer_interface *mixer;
|
||||||
struct snd_info_entry *entry;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
strcpy(chip->card->mixername, "USB Mixer");
|
strcpy(chip->card->mixername, "USB Mixer");
|
||||||
|
@ -3497,9 +3496,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto _error;
|
goto _error;
|
||||||
|
|
||||||
if (list_empty(&chip->mixer_list) &&
|
if (list_empty(&chip->mixer_list))
|
||||||
!snd_card_proc_new(chip->card, "usbmixer", &entry))
|
snd_card_ro_proc_new(chip->card, "usbmixer", chip,
|
||||||
snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read);
|
snd_usb_mixer_proc_read);
|
||||||
|
|
||||||
list_add(&mixer->list, &chip->mixer_list);
|
list_add(&mixer->list, &chip->mixer_list);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2195,7 +2195,6 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer)
|
||||||
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
struct snd_info_entry *entry;
|
|
||||||
|
|
||||||
err = snd_usb_soundblaster_remote_init(mixer);
|
err = snd_usb_soundblaster_remote_init(mixer);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
@ -2214,9 +2213,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
||||||
err = snd_audigy2nx_controls_create(mixer);
|
err = snd_audigy2nx_controls_create(mixer);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
break;
|
break;
|
||||||
if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry))
|
snd_card_ro_proc_new(mixer->chip->card, "audigy2nx",
|
||||||
snd_info_set_text_ops(entry, mixer,
|
mixer, snd_audigy2nx_proc_read);
|
||||||
snd_audigy2nx_proc_read);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* EMU0204 */
|
/* EMU0204 */
|
||||||
|
|
|
@ -61,11 +61,10 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_
|
||||||
|
|
||||||
void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
|
void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
|
||||||
{
|
{
|
||||||
struct snd_info_entry *entry;
|
snd_card_ro_proc_new(chip->card, "usbbus", chip,
|
||||||
if (!snd_card_proc_new(chip->card, "usbbus", &entry))
|
proc_audio_usbbus_read);
|
||||||
snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read);
|
snd_card_ro_proc_new(chip->card, "usbid", chip,
|
||||||
if (!snd_card_proc_new(chip->card, "usbid", &entry))
|
proc_audio_usbid_read);
|
||||||
snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -167,12 +166,10 @@ static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_b
|
||||||
|
|
||||||
void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
|
void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
|
||||||
{
|
{
|
||||||
struct snd_info_entry *entry;
|
|
||||||
char name[32];
|
char name[32];
|
||||||
struct snd_card *card = stream->chip->card;
|
struct snd_card *card = stream->chip->card;
|
||||||
|
|
||||||
sprintf(name, "stream%d", stream->pcm_index);
|
sprintf(name, "stream%d", stream->pcm_index);
|
||||||
if (!snd_card_proc_new(card, name, &entry))
|
snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
|
||||||
snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue