aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-04 10:07:35 -0500
committerTakashi Iwai <tiwai@suse.de>2019-02-06 12:11:57 -0500
commit7449054af0dcfa2839bb2da0a393bd35cf08daff (patch)
tree3b83650e4a1b82e7c922b4658f9d815542386267
parent3c6ee77088a9b5188d065780b1c540f5e3d879c8 (diff)
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>
-rw-r--r--sound/usb/mixer.c7
-rw-r--r--sound/usb/mixer_quirks.c6
-rw-r--r--sound/usb/proc.c13
3 files changed, 10 insertions, 16 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 8ad1a24c8f28..73d7dff425c1 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3441,7 +3441,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
3441 .dev_free = snd_usb_mixer_dev_free 3441 .dev_free = snd_usb_mixer_dev_free
3442 }; 3442 };
3443 struct usb_mixer_interface *mixer; 3443 struct usb_mixer_interface *mixer;
3444 struct snd_info_entry *entry;
3445 int err; 3444 int err;
3446 3445
3447 strcpy(chip->card->mixername, "USB Mixer"); 3446 strcpy(chip->card->mixername, "USB Mixer");
@@ -3497,9 +3496,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
3497 if (err < 0) 3496 if (err < 0)
3498 goto _error; 3497 goto _error;
3499 3498
3500 if (list_empty(&chip->mixer_list) && 3499 if (list_empty(&chip->mixer_list))
3501 !snd_card_proc_new(chip->card, "usbmixer", &entry)) 3500 snd_card_ro_proc_new(chip->card, "usbmixer", chip,
3502 snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read); 3501 snd_usb_mixer_proc_read);
3503 3502
3504 list_add(&mixer->list, &chip->mixer_list); 3503 list_add(&mixer->list, &chip->mixer_list);
3505 return 0; 3504 return 0;
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 85ae0ff2382a..a751a18ca4c2 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2195,7 +2195,6 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer)
2195int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) 2195int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
2196{ 2196{
2197 int err = 0; 2197 int err = 0;
2198 struct snd_info_entry *entry;
2199 2198
2200 err = snd_usb_soundblaster_remote_init(mixer); 2199 err = snd_usb_soundblaster_remote_init(mixer);
2201 if (err < 0) 2200 if (err < 0)
@@ -2214,9 +2213,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
2214 err = snd_audigy2nx_controls_create(mixer); 2213 err = snd_audigy2nx_controls_create(mixer);
2215 if (err < 0) 2214 if (err < 0)
2216 break; 2215 break;
2217 if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) 2216 snd_card_ro_proc_new(mixer->chip->card, "audigy2nx",
2218 snd_info_set_text_ops(entry, mixer, 2217 mixer, snd_audigy2nx_proc_read);
2219 snd_audigy2nx_proc_read);
2220 break; 2218 break;
2221 2219
2222 /* EMU0204 */ 2220 /* EMU0204 */
diff --git a/sound/usb/proc.c b/sound/usb/proc.c
index 0ac89e294d31..e80c9d0749c9 100644
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -61,11 +61,10 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_
61 61
62void snd_usb_audio_create_proc(struct snd_usb_audio *chip) 62void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
63{ 63{
64 struct snd_info_entry *entry; 64 snd_card_ro_proc_new(chip->card, "usbbus", chip,
65 if (!snd_card_proc_new(chip->card, "usbbus", &entry)) 65 proc_audio_usbbus_read);
66 snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); 66 snd_card_ro_proc_new(chip->card, "usbid", chip,
67 if (!snd_card_proc_new(chip->card, "usbid", &entry)) 67 proc_audio_usbid_read);
68 snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
69} 68}
70 69
71/* 70/*
@@ -167,12 +166,10 @@ static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_b
167 166
168void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream) 167void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
169{ 168{
170 struct snd_info_entry *entry;
171 char name[32]; 169 char name[32];
172 struct snd_card *card = stream->chip->card; 170 struct snd_card *card = stream->chip->card;
173 171
174 sprintf(name, "stream%d", stream->pcm_index); 172 sprintf(name, "stream%d", stream->pcm_index);
175 if (!snd_card_proc_new(card, name, &entry)) 173 snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
176 snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
177} 174}
178 175