Skip to content

Commit 7449054

Browse files
committed
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>
1 parent 3c6ee77 commit 7449054

3 files changed

Lines changed: 10 additions & 16 deletions

File tree

‎sound/usb/mixer.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
34413441
.dev_free = snd_usb_mixer_dev_free
34423442
};
34433443
struct usb_mixer_interface *mixer;
3444-
struct snd_info_entry *entry;
34453444
int err;
34463445

34473446
strcpy(chip->card->mixername, "USB Mixer");
@@ -3497,9 +3496,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
34973496
if (err < 0)
34983497
goto _error;
34993498

3500-
if (list_empty(&chip->mixer_list) &&
3501-
!snd_card_proc_new(chip->card, "usbmixer", &entry))
3502-
snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read);
3499+
if (list_empty(&chip->mixer_list))
3500+
snd_card_ro_proc_new(chip->card, "usbmixer", chip,
3501+
snd_usb_mixer_proc_read);
35033502

35043503
list_add(&mixer->list, &chip->mixer_list);
35053504
return 0;

‎sound/usb/mixer_quirks.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,6 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer)
21952195
int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
21962196
{
21972197
int err = 0;
2198-
struct snd_info_entry *entry;
21992198

22002199
err = snd_usb_soundblaster_remote_init(mixer);
22012200
if (err < 0)
@@ -2214,9 +2213,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
22142213
err = snd_audigy2nx_controls_create(mixer);
22152214
if (err < 0)
22162215
break;
2217-
if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry))
2218-
snd_info_set_text_ops(entry, mixer,
2219-
snd_audigy2nx_proc_read);
2216+
snd_card_ro_proc_new(mixer->chip->card, "audigy2nx",
2217+
mixer, snd_audigy2nx_proc_read);
22202218
break;
22212219

22222220
/* EMU0204 */

‎sound/usb/proc.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_
6161

6262
void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
6363
{
64-
struct snd_info_entry *entry;
65-
if (!snd_card_proc_new(chip->card, "usbbus", &entry))
66-
snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read);
67-
if (!snd_card_proc_new(chip->card, "usbid", &entry))
68-
snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
64+
snd_card_ro_proc_new(chip->card, "usbbus", chip,
65+
proc_audio_usbbus_read);
66+
snd_card_ro_proc_new(chip->card, "usbid", chip,
67+
proc_audio_usbid_read);
6968
}
7069

7170
/*
@@ -167,12 +166,10 @@ static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_b
167166

168167
void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
169168
{
170-
struct snd_info_entry *entry;
171169
char name[32];
172170
struct snd_card *card = stream->chip->card;
173171

174172
sprintf(name, "stream%d", stream->pcm_index);
175-
if (!snd_card_proc_new(card, name, &entry))
176-
snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
173+
snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
177174
}
178175

0 commit comments

Comments
 (0)