Skip to content

Commit bf85020

Browse files
tiwaiJaroslav Kysela
authored andcommitted
[ALSA] Remove unneeded read/write_size fields in proc text ops
Remove unneeded read/write_size fields in proc text ops. snd_info_set_text_ops() is fixed, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7e4eeec commit bf85020

61 files changed

Lines changed: 81 additions & 146 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5333,7 +5333,7 @@ struct _snd_pcm_runtime {
53335333
<informalexample>
53345334
<programlisting>
53355335
<![CDATA[
5336-
snd_info_set_text_ops(entry, chip, read_size, my_proc_read);
5336+
snd_info_set_text_ops(entry, chip, my_proc_read);
53375337
]]>
53385338
</programlisting>
53395339
</informalexample>
@@ -5394,29 +5394,12 @@ struct _snd_pcm_runtime {
53945394
<informalexample>
53955395
<programlisting>
53965396
<![CDATA[
5397-
entry->c.text.write_size = 256;
53985397
entry->c.text.write = my_proc_write;
53995398
]]>
54005399
</programlisting>
54015400
</informalexample>
54025401
</para>
54035402

5404-
<para>
5405-
The buffer size for read is set to 1024 implicitly by
5406-
<function>snd_info_set_text_ops()</function>. It should suffice
5407-
in most cases (the size will be aligned to
5408-
<constant>PAGE_SIZE</constant> anyway), but if you need to handle
5409-
very large text files, you can set it explicitly, too.
5410-
5411-
<informalexample>
5412-
<programlisting>
5413-
<![CDATA[
5414-
entry->c.text.read_size = 65536;
5415-
]]>
5416-
</programlisting>
5417-
</informalexample>
5418-
</para>
5419-
54205403
<para>
54215404
For the write callback, you can use
54225405
<function>snd_info_get_line()</function> to get a text line, and

‎include/sound/info.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ struct snd_info_buffer {
4040
struct snd_info_entry;
4141

4242
struct snd_info_entry_text {
43-
unsigned long read_size;
44-
unsigned long write_size;
4543
void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
4644
void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
4745
};
@@ -132,11 +130,9 @@ int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_e
132130

133131
static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
134132
void *private_data,
135-
long read_size,
136133
void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
137134
{
138135
entry->private_data = private_data;
139-
entry->c.text.read_size = read_size;
140136
entry->c.text.read = read;
141137
}
142138

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

173168
static inline int snd_info_check_reserved_words(const char *str) { return 1; }

‎sound/core/hwdep.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ static void __init snd_hwdep_proc_init(void)
486486
struct snd_info_entry *entry;
487487

488488
if ((entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL)) != NULL) {
489-
entry->c.text.read_size = PAGE_SIZE;
490489
entry->c.text.read = snd_hwdep_proc_read;
491490
if (snd_info_register(entry) < 0) {
492491
snd_info_free_entry(entry);

‎sound/core/info_oss.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ int snd_info_minor_register(void)
119119

120120
memset(snd_sndstat_strings, 0, sizeof(snd_sndstat_strings));
121121
if ((entry = snd_info_create_module_entry(THIS_MODULE, "sndstat", snd_oss_root)) != NULL) {
122-
entry->c.text.read_size = 2048;
123122
entry->c.text.read = snd_sndstat_proc_read;
124123
if (snd_info_register(entry) < 0) {
125124
snd_info_free_entry(entry);

‎sound/core/init.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ static inline int init_info_for_card(struct snd_card *card)
6969
snd_printd("unable to create card entry\n");
7070
return err;
7171
}
72-
entry->c.text.read_size = PAGE_SIZE;
7372
entry->c.text.read = snd_card_id_read;
7473
if (snd_info_register(entry) < 0) {
7574
snd_info_free_entry(entry);
@@ -592,7 +591,6 @@ int __init snd_card_info_init(void)
592591
entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL);
593592
if (! entry)
594593
return -ENOMEM;
595-
entry->c.text.read_size = PAGE_SIZE;
596594
entry->c.text.read = snd_card_info_read;
597595
if (snd_info_register(entry) < 0) {
598596
snd_info_free_entry(entry);
@@ -603,7 +601,6 @@ int __init snd_card_info_init(void)
603601
#ifdef MODULE
604602
entry = snd_info_create_module_entry(THIS_MODULE, "modules", NULL);
605603
if (entry) {
606-
entry->c.text.read_size = PAGE_SIZE;
607604
entry->c.text.read = snd_card_module_info_read;
608605
if (snd_info_register(entry) < 0)
609606
snd_info_free_entry(entry);

‎sound/core/oss/mixer_oss.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,9 +1182,7 @@ static void snd_mixer_oss_proc_init(struct snd_mixer_oss *mixer)
11821182
return;
11831183
entry->content = SNDRV_INFO_CONTENT_TEXT;
11841184
entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
1185-
entry->c.text.read_size = 8192;
11861185
entry->c.text.read = snd_mixer_oss_proc_read;
1187-
entry->c.text.write_size = 8192;
11881186
entry->c.text.write = snd_mixer_oss_proc_write;
11891187
entry->private_data = mixer;
11901188
if (snd_info_register(entry) < 0) {

‎sound/core/oss/pcm_oss.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,9 +2823,7 @@ static void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
28232823
if ((entry = snd_info_create_card_entry(pcm->card, "oss", pstr->proc_root)) != NULL) {
28242824
entry->content = SNDRV_INFO_CONTENT_TEXT;
28252825
entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
2826-
entry->c.text.read_size = 8192;
28272826
entry->c.text.read = snd_pcm_oss_proc_read;
2828-
entry->c.text.write_size = 8192;
28292827
entry->c.text.write = snd_pcm_oss_proc_write;
28302828
entry->private_data = pstr;
28312829
if (snd_info_register(entry) < 0) {

‎sound/core/pcm.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
472472
pstr->proc_root = entry;
473473

474474
if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) {
475-
snd_info_set_text_ops(entry, pstr, 256, snd_pcm_stream_proc_info_read);
475+
snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read);
476476
if (snd_info_register(entry) < 0) {
477477
snd_info_free_entry(entry);
478478
entry = NULL;
@@ -483,9 +483,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
483483
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
484484
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
485485
pstr->proc_root)) != NULL) {
486-
entry->c.text.read_size = 64;
487486
entry->c.text.read = snd_pcm_xrun_debug_read;
488-
entry->c.text.write_size = 64;
489487
entry->c.text.write = snd_pcm_xrun_debug_write;
490488
entry->mode |= S_IWUSR;
491489
entry->private_data = pstr;
@@ -537,7 +535,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
537535
substream->proc_root = entry;
538536

539537
if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) {
540-
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_info_read);
538+
snd_info_set_text_ops(entry, substream,
539+
snd_pcm_substream_proc_info_read);
541540
if (snd_info_register(entry) < 0) {
542541
snd_info_free_entry(entry);
543542
entry = NULL;
@@ -546,7 +545,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
546545
substream->proc_info_entry = entry;
547546

548547
if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) {
549-
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_hw_params_read);
548+
snd_info_set_text_ops(entry, substream,
549+
snd_pcm_substream_proc_hw_params_read);
550550
if (snd_info_register(entry) < 0) {
551551
snd_info_free_entry(entry);
552552
entry = NULL;
@@ -555,7 +555,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
555555
substream->proc_hw_params_entry = entry;
556556

557557
if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) {
558-
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_sw_params_read);
558+
snd_info_set_text_ops(entry, substream,
559+
snd_pcm_substream_proc_sw_params_read);
559560
if (snd_info_register(entry) < 0) {
560561
snd_info_free_entry(entry);
561562
entry = NULL;
@@ -564,7 +565,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
564565
substream->proc_sw_params_entry = entry;
565566

566567
if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) {
567-
snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_status_read);
568+
snd_info_set_text_ops(entry, substream,
569+
snd_pcm_substream_proc_status_read);
568570
if (snd_info_register(entry) < 0) {
569571
snd_info_free_entry(entry);
570572
entry = NULL;
@@ -1062,8 +1064,7 @@ static void snd_pcm_proc_init(void)
10621064
struct snd_info_entry *entry;
10631065

10641066
if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
1065-
snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128,
1066-
snd_pcm_proc_read);
1067+
snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read);
10671068
if (snd_info_register(entry) < 0) {
10681069
snd_info_free_entry(entry);
10691070
entry = NULL;

‎sound/core/pcm_memory.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
193193
struct snd_info_entry *entry;
194194

195195
if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) {
196-
entry->c.text.read_size = 64;
197196
entry->c.text.read = snd_pcm_lib_preallocate_proc_read;
198-
entry->c.text.write_size = 64;
199197
entry->c.text.write = snd_pcm_lib_preallocate_proc_write;
200198
entry->mode |= S_IWUSR;
201199
entry->private_data = substream;

‎sound/core/rawmidi.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,6 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
15611561
entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root);
15621562
if (entry) {
15631563
entry->private_data = rmidi;
1564-
entry->c.text.read_size = 1024;
15651564
entry->c.text.read = snd_rawmidi_proc_info_read;
15661565
if (snd_info_register(entry) < 0) {
15671566
snd_info_free_entry(entry);

0 commit comments

Comments
 (0)