Commit 815d808c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: drivers: 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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7453e1da
...@@ -1133,16 +1133,10 @@ static void print_cable_info(struct snd_info_entry *entry, ...@@ -1133,16 +1133,10 @@ static void print_cable_info(struct snd_info_entry *entry,
static int loopback_proc_new(struct loopback *loopback, int cidx) static int loopback_proc_new(struct loopback *loopback, int cidx)
{ {
char name[32]; char name[32];
struct snd_info_entry *entry;
int err;
snprintf(name, sizeof(name), "cable#%d", cidx); snprintf(name, sizeof(name), "cable#%d", cidx);
err = snd_card_proc_new(loopback->card, name, &entry); return snd_card_ro_proc_new(loopback->card, name, loopback,
if (err < 0) print_cable_info);
return err;
snd_info_set_text_ops(entry, loopback, print_cable_info);
return 0;
} }
static int loopback_probe(struct platform_device *devptr) static int loopback_probe(struct platform_device *devptr)
......
...@@ -1037,14 +1037,8 @@ static void dummy_proc_write(struct snd_info_entry *entry, ...@@ -1037,14 +1037,8 @@ static void dummy_proc_write(struct snd_info_entry *entry,
static void dummy_proc_init(struct snd_dummy *chip) static void dummy_proc_init(struct snd_dummy *chip)
{ {
struct snd_info_entry *entry; snd_card_rw_proc_new(chip->card, "dummy_pcm", chip,
dummy_proc_read, dummy_proc_write);
if (!snd_card_proc_new(chip->card, "dummy_pcm", &entry)) {
snd_info_set_text_ops(entry, chip, dummy_proc_read);
entry->c.text.write = dummy_proc_write;
entry->mode |= 0200;
entry->private_data = chip;
}
} }
#else #else
#define dummy_proc_init(x) #define dummy_proc_init(x)
......
...@@ -643,10 +643,7 @@ static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *b ...@@ -643,10 +643,7 @@ static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *b
static void vx_proc_init(struct vx_core *chip) static void vx_proc_init(struct vx_core *chip)
{ {
struct snd_info_entry *entry; snd_card_ro_proc_new(chip->card, "vx-status", chip, vx_proc_read);
if (! snd_card_proc_new(chip->card, "vx-status", &entry))
snd_info_set_text_ops(entry, chip, vx_proc_read);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment