Skip to content

Commit

Permalink
[ALSA] Remove unneeded read/write_size fields in proc text ops
Browse files Browse the repository at this point in the history
Remove unneeded read/write_size fields in proc text ops.
snd_info_set_text_ops() is fixed, too.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai authored and Jaroslav Kysela committed Jun 22, 2006
1 parent 7e4eeec commit bf85020
Show file tree
Hide file tree
Showing 61 changed files with 81 additions and 146 deletions.
19 changes: 1 addition & 18 deletions Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5333,7 +5333,7 @@ struct _snd_pcm_runtime {
<informalexample>
<programlisting>
<![CDATA[
snd_info_set_text_ops(entry, chip, read_size, my_proc_read);
snd_info_set_text_ops(entry, chip, my_proc_read);
]]>
</programlisting>
</informalexample>
Expand Down Expand Up @@ -5394,29 +5394,12 @@ struct _snd_pcm_runtime {
<informalexample>
<programlisting>
<![CDATA[
entry->c.text.write_size = 256;
entry->c.text.write = my_proc_write;
]]>
</programlisting>
</informalexample>
</para>

<para>
The buffer size for read is set to 1024 implicitly by
<function>snd_info_set_text_ops()</function>. It should suffice
in most cases (the size will be aligned to
<constant>PAGE_SIZE</constant> anyway), but if you need to handle
very large text files, you can set it explicitly, too.

<informalexample>
<programlisting>
<![CDATA[
entry->c.text.read_size = 65536;
]]>
</programlisting>
</informalexample>
</para>

<para>
For the write callback, you can use
<function>snd_info_get_line()</function> to get a text line, and
Expand Down
5 changes: 0 additions & 5 deletions include/sound/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ struct snd_info_buffer {
struct snd_info_entry;

struct snd_info_entry_text {
unsigned long read_size;
unsigned long write_size;
void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
};
Expand Down Expand Up @@ -132,11 +130,9 @@ int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_e

static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
void *private_data,
long read_size,
void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
{
entry->private_data = private_data;
entry->c.text.read_size = read_size;
entry->c.text.read = read;
}

Expand Down Expand Up @@ -167,7 +163,6 @@ static inline int snd_card_proc_new(struct snd_card *card, const char *name,
struct snd_info_entry **entryp) { return -EINVAL; }
static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
void *private_data,
long read_size,
void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}

static inline int snd_info_check_reserved_words(const char *str) { return 1; }
Expand Down
1 change: 0 additions & 1 deletion sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ static void __init snd_hwdep_proc_init(void)
struct snd_info_entry *entry;

if ((entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL)) != NULL) {
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_hwdep_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
1 change: 0 additions & 1 deletion sound/core/info_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ int snd_info_minor_register(void)

memset(snd_sndstat_strings, 0, sizeof(snd_sndstat_strings));
if ((entry = snd_info_create_module_entry(THIS_MODULE, "sndstat", snd_oss_root)) != NULL) {
entry->c.text.read_size = 2048;
entry->c.text.read = snd_sndstat_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
3 changes: 0 additions & 3 deletions sound/core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static inline int init_info_for_card(struct snd_card *card)
snd_printd("unable to create card entry\n");
return err;
}
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_card_id_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down Expand Up @@ -592,7 +591,6 @@ int __init snd_card_info_init(void)
entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL);
if (! entry)
return -ENOMEM;
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_card_info_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand All @@ -603,7 +601,6 @@ int __init snd_card_info_init(void)
#ifdef MODULE
entry = snd_info_create_module_entry(THIS_MODULE, "modules", NULL);
if (entry) {
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_card_module_info_read;
if (snd_info_register(entry) < 0)
snd_info_free_entry(entry);
Expand Down
2 changes: 0 additions & 2 deletions sound/core/oss/mixer_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,9 +1182,7 @@ static void snd_mixer_oss_proc_init(struct snd_mixer_oss *mixer)
return;
entry->content = SNDRV_INFO_CONTENT_TEXT;
entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
entry->c.text.read_size = 8192;
entry->c.text.read = snd_mixer_oss_proc_read;
entry->c.text.write_size = 8192;
entry->c.text.write = snd_mixer_oss_proc_write;
entry->private_data = mixer;
if (snd_info_register(entry) < 0) {
Expand Down
2 changes: 0 additions & 2 deletions sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2823,9 +2823,7 @@ static void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
if ((entry = snd_info_create_card_entry(pcm->card, "oss", pstr->proc_root)) != NULL) {
entry->content = SNDRV_INFO_CONTENT_TEXT;
entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
entry->c.text.read_size = 8192;
entry->c.text.read = snd_pcm_oss_proc_read;
entry->c.text.write_size = 8192;
entry->c.text.write = snd_pcm_oss_proc_write;
entry->private_data = pstr;
if (snd_info_register(entry) < 0) {
Expand Down
19 changes: 10 additions & 9 deletions sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
pstr->proc_root = entry;

if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) {
snd_info_set_text_ops(entry, pstr, 256, snd_pcm_stream_proc_info_read);
snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand All @@ -483,9 +483,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
pstr->proc_root)) != NULL) {
entry->c.text.read_size = 64;
entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write_size = 64;
entry->c.text.write = snd_pcm_xrun_debug_write;
entry->mode |= S_IWUSR;
entry->private_data = pstr;
Expand Down Expand Up @@ -537,7 +535,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
substream->proc_root = entry;

if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) {
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_info_read);
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_info_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand All @@ -546,7 +545,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
substream->proc_info_entry = entry;

if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) {
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_hw_params_read);
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_hw_params_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand All @@ -555,7 +555,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
substream->proc_hw_params_entry = entry;

if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) {
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_sw_params_read);
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_sw_params_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand All @@ -564,7 +565,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
substream->proc_sw_params_entry = entry;

if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) {
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_status_read);
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_status_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand Down Expand Up @@ -1062,8 +1064,7 @@ static void snd_pcm_proc_init(void)
struct snd_info_entry *entry;

if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128,
snd_pcm_proc_read);
snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand Down
2 changes: 0 additions & 2 deletions sound/core/pcm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
struct snd_info_entry *entry;

if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) {
entry->c.text.read_size = 64;
entry->c.text.read = snd_pcm_lib_preallocate_proc_read;
entry->c.text.write_size = 64;
entry->c.text.write = snd_pcm_lib_preallocate_proc_write;
entry->mode |= S_IWUSR;
entry->private_data = substream;
Expand Down
1 change: 0 additions & 1 deletion sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,6 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root);
if (entry) {
entry->private_data = rmidi;
entry->c.text.read_size = 1024;
entry->c.text.read = snd_rawmidi_proc_info_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
1 change: 0 additions & 1 deletion sound/core/seq/oss/seq_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ register_proc(void)

entry->content = SNDRV_INFO_CONTENT_TEXT;
entry->private_data = NULL;
entry->c.text.read_size = 1024;
entry->c.text.read = info_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
1 change: 0 additions & 1 deletion sound/core/seq/seq_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ static int __init alsa_seq_device_init(void)
if (info_entry == NULL)
return -ENOMEM;
info_entry->content = SNDRV_INFO_CONTENT_TEXT;
info_entry->c.text.read_size = 2048;
info_entry->c.text.read = snd_seq_device_info;
if (snd_info_register(info_entry) < 0) {
snd_info_free_entry(info_entry);
Expand Down
11 changes: 5 additions & 6 deletions sound/core/seq/seq_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ static struct snd_info_entry *timer_entry;


static struct snd_info_entry * __init
create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
struct snd_info_buffer *))
create_info_entry(char *name, void (*read)(struct snd_info_entry *,
struct snd_info_buffer *))
{
struct snd_info_entry *entry;

entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
if (entry == NULL)
return NULL;
entry->content = SNDRV_INFO_CONTENT_TEXT;
entry->c.text.read_size = size;
entry->c.text.read = read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand All @@ -55,11 +54,11 @@ create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
/* create all our /proc entries */
int __init snd_seq_info_init(void)
{
queues_entry = create_info_entry("queues", 512 + (256 * SNDRV_SEQ_MAX_QUEUES),
queues_entry = create_info_entry("queues",
snd_seq_info_queues_read);
clients_entry = create_info_entry("clients", 512 + (256 * SNDRV_SEQ_MAX_CLIENTS),
clients_entry = create_info_entry("clients",
snd_seq_info_clients_read);
timer_entry = create_info_entry("timer", 1024, snd_seq_info_timer_read);
timer_entry = create_info_entry("timer", snd_seq_info_timer_read);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/core/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ int __init snd_minor_info_init(void)

entry = snd_info_create_module_entry(THIS_MODULE, "devices", NULL);
if (entry) {
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_minor_info_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
1 change: 0 additions & 1 deletion sound/core/sound_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ int __init snd_minor_info_oss_init(void)

entry = snd_info_create_module_entry(THIS_MODULE, "devices", snd_oss_root);
if (entry) {
entry->c.text.read_size = PAGE_SIZE;
entry->c.text.read = snd_minor_info_oss_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
1 change: 0 additions & 1 deletion sound/core/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,6 @@ static void __init snd_timer_proc_init(void)

entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
if (entry != NULL) {
entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128;
entry->c.text.read = snd_timer_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
Expand Down
2 changes: 1 addition & 1 deletion sound/drivers/vx/vx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static void vx_proc_init(struct vx_core *chip)
struct snd_info_entry *entry;

if (! snd_card_proc_new(chip->card, "vx-status", &entry))
snd_info_set_text_ops(entry, chip, 1024, vx_proc_read);
snd_info_set_text_ops(entry, chip, vx_proc_read);
}


Expand Down
4 changes: 2 additions & 2 deletions sound/i2c/l3/uda1341.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ static void __devinit snd_uda1341_proc_init(struct snd_card *card, struct l3_cli
struct snd_info_entry *entry;

if (! snd_card_proc_new(card, "uda1341", &entry))
snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_read);
snd_info_set_text_ops(entry, clnt, snd_uda1341_proc_read);
if (! snd_card_proc_new(card, "uda1341-regs", &entry))
snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_regs_read);
snd_info_set_text_ops(entry, clnt, snd_uda1341_proc_regs_read);
}

/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/gus/gus_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void snd_gus_irq_profile_init(struct snd_gus_card *gus)
struct snd_info_entry *entry;

if (! snd_card_proc_new(gus->card, "gusirq", &entry))
snd_info_set_text_ops(entry, gus, 1024, snd_gus_irq_info_read);
snd_info_set_text_ops(entry, gus, snd_gus_irq_info_read);
}

#endif
6 changes: 2 additions & 4 deletions sound/isa/gus/gus_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,8 @@ int snd_gf1_mem_init(struct snd_gus_card * gus)
if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
return -ENOMEM;
#ifdef CONFIG_SND_DEBUG
if (! snd_card_proc_new(gus->card, "gusmem", &entry)) {
snd_info_set_text_ops(entry, gus, 1024, snd_gf1_mem_info_read);
entry->c.text.read_size = 256 * 1024;
}
if (! snd_card_proc_new(gus->card, "gusmem", &entry))
snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read);
#endif
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/opti9xx/miro.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ static void __init snd_miro_proc_init(struct snd_miro * miro)
struct snd_info_entry *entry;

if (! snd_card_proc_new(miro->card, "miro", &entry))
snd_info_set_text_ops(entry, miro, 1024, snd_miro_proc_read);
snd_info_set_text_ops(entry, miro, snd_miro_proc_read);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/sb/sb16_csp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ static int init_proc_entry(struct snd_sb_csp * p, int device)
struct snd_info_entry *entry;
sprintf(name, "cspD%d", device);
if (! snd_card_proc_new(p->chip->card, name, &entry))
snd_info_set_text_ops(entry, p, 1024, info_read);
snd_info_set_text_ops(entry, p, info_read);
return 0;
}

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/ac97/ac97_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97)
prefix = ac97_is_audio(ac97) ? "ac97" : "mc97";
sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num);
if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) {
snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_read);
snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
Expand All @@ -442,10 +442,9 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97)
ac97->proc = entry;
sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num);
if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) {
snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_regs_read);
snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read);
#ifdef CONFIG_SND_DEBUG
entry->mode |= S_IWUSR;
entry->c.text.write_size = 1024;
entry->c.text.write = snd_ac97_proc_regs_write;
#endif
if (snd_info_register(entry) < 0) {
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ac97/ak4531_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak453
struct snd_info_entry *entry;

if (! snd_card_proc_new(card, "ak4531", &entry))
snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read);
snd_info_set_text_ops(entry, ak4531, snd_ak4531_proc_read);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ad1889.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ snd_ad1889_proc_init(struct snd_ad1889 *chip)
struct snd_info_entry *entry;

if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_ad1889_proc_read);
snd_info_set_text_ops(entry, chip, snd_ad1889_proc_read);
}

static struct ac97_quirk ac97_quirks[] = {
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ali5451/ali5451.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ static void __devinit snd_ali_proc_init(struct snd_ali *codec)
{
struct snd_info_entry *entry;
if(!snd_card_proc_new(codec->card, "ali5451", &entry))
snd_info_set_text_ops(entry, codec, 1024, snd_ali_proc_read);
snd_info_set_text_ops(entry, codec, snd_ali_proc_read);
}

static int __devinit snd_ali_resources(struct snd_ali *codec)
Expand Down
Loading

0 comments on commit bf85020

Please sign in to comment.