ALSA: core: Manage asound root directory with snd_info_entry
[deliverable/linux.git] / sound / core / info.c
1 /*
2 * Information interface for ALSA driver
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22 #include <linux/init.h>
23 #include <linux/time.h>
24 #include <linux/mm.h>
25 #include <linux/slab.h>
26 #include <linux/string.h>
27 #include <linux/module.h>
28 #include <sound/core.h>
29 #include <sound/minors.h>
30 #include <sound/info.h>
31 #include <linux/utsname.h>
32 #include <linux/proc_fs.h>
33 #include <linux/mutex.h>
34 #include <stdarg.h>
35
36 /*
37 *
38 */
39
40 #ifdef CONFIG_PROC_FS
41
42 int snd_info_check_reserved_words(const char *str)
43 {
44 static char *reserved[] =
45 {
46 "version",
47 "meminfo",
48 "memdebug",
49 "detect",
50 "devices",
51 "oss",
52 "cards",
53 "timers",
54 "synth",
55 "pcm",
56 "seq",
57 NULL
58 };
59 char **xstr = reserved;
60
61 while (*xstr) {
62 if (!strcmp(*xstr, str))
63 return 0;
64 xstr++;
65 }
66 if (!strncmp(str, "card", 4))
67 return 0;
68 return 1;
69 }
70
71 static DEFINE_MUTEX(info_mutex);
72
73 struct snd_info_private_data {
74 struct snd_info_buffer *rbuffer;
75 struct snd_info_buffer *wbuffer;
76 struct snd_info_entry *entry;
77 void *file_private_data;
78 };
79
80 static int snd_info_version_init(void);
81 static void snd_info_disconnect(struct snd_info_entry *entry);
82
83 /*
84
85 */
86
87 static struct snd_info_entry *snd_proc_root;
88 struct snd_info_entry *snd_seq_root;
89 EXPORT_SYMBOL(snd_seq_root);
90
91 #ifdef CONFIG_SND_OSSEMUL
92 struct snd_info_entry *snd_oss_root;
93 #endif
94
95 static int alloc_info_private(struct snd_info_entry *entry,
96 struct snd_info_private_data **ret)
97 {
98 struct snd_info_private_data *data;
99
100 if (!entry || !entry->p)
101 return -ENODEV;
102 if (!try_module_get(entry->module))
103 return -EFAULT;
104 data = kzalloc(sizeof(*data), GFP_KERNEL);
105 if (!data) {
106 module_put(entry->module);
107 return -ENOMEM;
108 }
109 data->entry = entry;
110 *ret = data;
111 return 0;
112 }
113
114 static bool valid_pos(loff_t pos, size_t count)
115 {
116 if (pos < 0 || (long) pos != pos || (ssize_t) count < 0)
117 return false;
118 if ((unsigned long) pos + (unsigned long) count < (unsigned long) pos)
119 return false;
120 return true;
121 }
122
123 /*
124 * file ops for binary proc files
125 */
126 static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig)
127 {
128 struct snd_info_private_data *data;
129 struct snd_info_entry *entry;
130 loff_t ret = -EINVAL, size;
131
132 data = file->private_data;
133 entry = data->entry;
134 mutex_lock(&entry->access);
135 if (entry->c.ops->llseek) {
136 offset = entry->c.ops->llseek(entry,
137 data->file_private_data,
138 file, offset, orig);
139 goto out;
140 }
141
142 size = entry->size;
143 switch (orig) {
144 case SEEK_SET:
145 break;
146 case SEEK_CUR:
147 offset += file->f_pos;
148 break;
149 case SEEK_END:
150 if (!size)
151 goto out;
152 offset += size;
153 break;
154 default:
155 goto out;
156 }
157 if (offset < 0)
158 goto out;
159 if (size && offset > size)
160 offset = size;
161 file->f_pos = offset;
162 ret = offset;
163 out:
164 mutex_unlock(&entry->access);
165 return ret;
166 }
167
168 static ssize_t snd_info_entry_read(struct file *file, char __user *buffer,
169 size_t count, loff_t * offset)
170 {
171 struct snd_info_private_data *data = file->private_data;
172 struct snd_info_entry *entry = data->entry;
173 size_t size;
174 loff_t pos;
175
176 pos = *offset;
177 if (!valid_pos(pos, count))
178 return -EIO;
179 if (pos >= entry->size)
180 return 0;
181 size = entry->size - pos;
182 size = min(count, size);
183 size = entry->c.ops->read(entry, data->file_private_data,
184 file, buffer, size, pos);
185 if ((ssize_t) size > 0)
186 *offset = pos + size;
187 return size;
188 }
189
190 static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer,
191 size_t count, loff_t * offset)
192 {
193 struct snd_info_private_data *data = file->private_data;
194 struct snd_info_entry *entry = data->entry;
195 ssize_t size = 0;
196 loff_t pos;
197
198 pos = *offset;
199 if (!valid_pos(pos, count))
200 return -EIO;
201 if (count > 0) {
202 size_t maxsize = entry->size - pos;
203 count = min(count, maxsize);
204 size = entry->c.ops->write(entry, data->file_private_data,
205 file, buffer, count, pos);
206 }
207 if (size > 0)
208 *offset = pos + size;
209 return size;
210 }
211
212 static unsigned int snd_info_entry_poll(struct file *file, poll_table *wait)
213 {
214 struct snd_info_private_data *data = file->private_data;
215 struct snd_info_entry *entry = data->entry;
216 unsigned int mask = 0;
217
218 if (entry->c.ops->poll)
219 return entry->c.ops->poll(entry,
220 data->file_private_data,
221 file, wait);
222 if (entry->c.ops->read)
223 mask |= POLLIN | POLLRDNORM;
224 if (entry->c.ops->write)
225 mask |= POLLOUT | POLLWRNORM;
226 return mask;
227 }
228
229 static long snd_info_entry_ioctl(struct file *file, unsigned int cmd,
230 unsigned long arg)
231 {
232 struct snd_info_private_data *data = file->private_data;
233 struct snd_info_entry *entry = data->entry;
234
235 if (!entry->c.ops->ioctl)
236 return -ENOTTY;
237 return entry->c.ops->ioctl(entry, data->file_private_data,
238 file, cmd, arg);
239 }
240
241 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
242 {
243 struct inode *inode = file_inode(file);
244 struct snd_info_private_data *data;
245 struct snd_info_entry *entry;
246
247 data = file->private_data;
248 if (data == NULL)
249 return 0;
250 entry = data->entry;
251 if (!entry->c.ops->mmap)
252 return -ENXIO;
253 return entry->c.ops->mmap(entry, data->file_private_data,
254 inode, file, vma);
255 }
256
257 static int snd_info_entry_open(struct inode *inode, struct file *file)
258 {
259 struct snd_info_entry *entry = PDE_DATA(inode);
260 struct snd_info_private_data *data;
261 int mode, err;
262
263 mutex_lock(&info_mutex);
264 err = alloc_info_private(entry, &data);
265 if (err < 0)
266 goto unlock;
267
268 mode = file->f_flags & O_ACCMODE;
269 if (((mode == O_RDONLY || mode == O_RDWR) && !entry->c.ops->read) ||
270 ((mode == O_WRONLY || mode == O_RDWR) && !entry->c.ops->write)) {
271 err = -ENODEV;
272 goto error;
273 }
274
275 if (entry->c.ops->open) {
276 err = entry->c.ops->open(entry, mode, &data->file_private_data);
277 if (err < 0)
278 goto error;
279 }
280
281 file->private_data = data;
282 mutex_unlock(&info_mutex);
283 return 0;
284
285 error:
286 kfree(data);
287 module_put(entry->module);
288 unlock:
289 mutex_unlock(&info_mutex);
290 return err;
291 }
292
293 static int snd_info_entry_release(struct inode *inode, struct file *file)
294 {
295 struct snd_info_private_data *data = file->private_data;
296 struct snd_info_entry *entry = data->entry;
297
298 if (entry->c.ops->release)
299 entry->c.ops->release(entry, file->f_flags & O_ACCMODE,
300 data->file_private_data);
301 module_put(entry->module);
302 kfree(data);
303 return 0;
304 }
305
306 static const struct file_operations snd_info_entry_operations =
307 {
308 .owner = THIS_MODULE,
309 .llseek = snd_info_entry_llseek,
310 .read = snd_info_entry_read,
311 .write = snd_info_entry_write,
312 .poll = snd_info_entry_poll,
313 .unlocked_ioctl = snd_info_entry_ioctl,
314 .mmap = snd_info_entry_mmap,
315 .open = snd_info_entry_open,
316 .release = snd_info_entry_release,
317 };
318
319 /*
320 * file ops for text proc files
321 */
322 static ssize_t snd_info_text_entry_write(struct file *file,
323 const char __user *buffer,
324 size_t count, loff_t *offset)
325 {
326 struct seq_file *m = file->private_data;
327 struct snd_info_private_data *data = m->private;
328 struct snd_info_entry *entry = data->entry;
329 struct snd_info_buffer *buf;
330 loff_t pos;
331 size_t next;
332 int err = 0;
333
334 pos = *offset;
335 if (!valid_pos(pos, count))
336 return -EIO;
337 next = pos + count;
338 mutex_lock(&entry->access);
339 buf = data->wbuffer;
340 if (!buf) {
341 data->wbuffer = buf = kzalloc(sizeof(*buf), GFP_KERNEL);
342 if (!buf) {
343 err = -ENOMEM;
344 goto error;
345 }
346 }
347 if (next > buf->len) {
348 char *nbuf = krealloc(buf->buffer, PAGE_ALIGN(next),
349 GFP_KERNEL | __GFP_ZERO);
350 if (!nbuf) {
351 err = -ENOMEM;
352 goto error;
353 }
354 buf->buffer = nbuf;
355 buf->len = PAGE_ALIGN(next);
356 }
357 if (copy_from_user(buf->buffer + pos, buffer, count)) {
358 err = -EFAULT;
359 goto error;
360 }
361 buf->size = next;
362 error:
363 mutex_unlock(&entry->access);
364 if (err < 0)
365 return err;
366 *offset = next;
367 return count;
368 }
369
370 static int snd_info_seq_show(struct seq_file *seq, void *p)
371 {
372 struct snd_info_private_data *data = seq->private;
373 struct snd_info_entry *entry = data->entry;
374
375 if (entry->c.text.read) {
376 data->rbuffer->buffer = (char *)seq; /* XXX hack! */
377 entry->c.text.read(entry, data->rbuffer);
378 }
379 return 0;
380 }
381
382 static int snd_info_text_entry_open(struct inode *inode, struct file *file)
383 {
384 struct snd_info_entry *entry = PDE_DATA(inode);
385 struct snd_info_private_data *data;
386 int err;
387
388 mutex_lock(&info_mutex);
389 err = alloc_info_private(entry, &data);
390 if (err < 0)
391 goto unlock;
392
393 data->rbuffer = kzalloc(sizeof(*data->rbuffer), GFP_KERNEL);
394 if (!data->rbuffer) {
395 err = -ENOMEM;
396 goto error;
397 }
398 if (entry->size)
399 err = single_open_size(file, snd_info_seq_show, data,
400 entry->size);
401 else
402 err = single_open(file, snd_info_seq_show, data);
403 if (err < 0)
404 goto error;
405 mutex_unlock(&info_mutex);
406 return 0;
407
408 error:
409 kfree(data->rbuffer);
410 kfree(data);
411 module_put(entry->module);
412 unlock:
413 mutex_unlock(&info_mutex);
414 return err;
415 }
416
417 static int snd_info_text_entry_release(struct inode *inode, struct file *file)
418 {
419 struct seq_file *m = file->private_data;
420 struct snd_info_private_data *data = m->private;
421 struct snd_info_entry *entry = data->entry;
422
423 if (data->wbuffer && entry->c.text.write)
424 entry->c.text.write(entry, data->wbuffer);
425
426 single_release(inode, file);
427 kfree(data->rbuffer);
428 if (data->wbuffer) {
429 kfree(data->wbuffer->buffer);
430 kfree(data->wbuffer);
431 }
432
433 module_put(entry->module);
434 kfree(data);
435 return 0;
436 }
437
438 static const struct file_operations snd_info_text_entry_ops =
439 {
440 .owner = THIS_MODULE,
441 .open = snd_info_text_entry_open,
442 .release = snd_info_text_entry_release,
443 .write = snd_info_text_entry_write,
444 .llseek = seq_lseek,
445 .read = seq_read,
446 };
447
448 static struct snd_info_entry *create_subdir(struct module *mod,
449 const char *name)
450 {
451 struct snd_info_entry *entry;
452
453 entry = snd_info_create_module_entry(mod, name, NULL);
454 if (!entry)
455 return NULL;
456 entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
457 if (snd_info_register(entry) < 0) {
458 snd_info_free_entry(entry);
459 return NULL;
460 }
461 return entry;
462 }
463
464 static struct snd_info_entry *snd_info_create_entry(const char *name);
465
466 int __init snd_info_init(void)
467 {
468 snd_proc_root = snd_info_create_entry("asound");
469 if (!snd_proc_root)
470 return -ENOMEM;
471 snd_proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
472 snd_proc_root->p = proc_mkdir("asound", NULL);
473 if (!snd_proc_root->p)
474 goto error;
475 #ifdef CONFIG_SND_OSSEMUL
476 snd_oss_root = create_subdir(THIS_MODULE, "oss");
477 if (!snd_oss_root)
478 goto error;
479 #endif
480 #if IS_ENABLED(CONFIG_SND_SEQUENCER)
481 snd_seq_root = create_subdir(THIS_MODULE, "seq");
482 if (!snd_seq_root)
483 goto error;
484 #endif
485 snd_info_version_init();
486 snd_minor_info_init();
487 snd_minor_info_oss_init();
488 snd_card_info_init();
489 return 0;
490
491 error:
492 snd_info_free_entry(snd_proc_root);
493 return -ENOMEM;
494 }
495
496 int __exit snd_info_done(void)
497 {
498 snd_card_info_done();
499 snd_minor_info_oss_done();
500 snd_minor_info_done();
501 snd_info_free_entry(snd_proc_root);
502 return 0;
503 }
504
505 /*
506 * create a card proc file
507 * called from init.c
508 */
509 int snd_info_card_create(struct snd_card *card)
510 {
511 char str[8];
512 struct snd_info_entry *entry;
513
514 if (snd_BUG_ON(!card))
515 return -ENXIO;
516
517 sprintf(str, "card%i", card->number);
518 entry = create_subdir(card->module, str);
519 if (!entry)
520 return -ENOMEM;
521 card->proc_root = entry;
522 return 0;
523 }
524
525 /*
526 * register the card proc file
527 * called from init.c
528 */
529 int snd_info_card_register(struct snd_card *card)
530 {
531 struct proc_dir_entry *p;
532
533 if (snd_BUG_ON(!card))
534 return -ENXIO;
535
536 if (!strcmp(card->id, card->proc_root->name))
537 return 0;
538
539 p = proc_symlink(card->id, snd_proc_root->p, card->proc_root->name);
540 if (p == NULL)
541 return -ENOMEM;
542 card->proc_root_link = p;
543 return 0;
544 }
545
546 /*
547 * called on card->id change
548 */
549 void snd_info_card_id_change(struct snd_card *card)
550 {
551 mutex_lock(&info_mutex);
552 if (card->proc_root_link) {
553 proc_remove(card->proc_root_link);
554 card->proc_root_link = NULL;
555 }
556 if (strcmp(card->id, card->proc_root->name))
557 card->proc_root_link = proc_symlink(card->id,
558 snd_proc_root->p,
559 card->proc_root->name);
560 mutex_unlock(&info_mutex);
561 }
562
563 /*
564 * de-register the card proc file
565 * called from init.c
566 */
567 void snd_info_card_disconnect(struct snd_card *card)
568 {
569 if (!card)
570 return;
571 mutex_lock(&info_mutex);
572 proc_remove(card->proc_root_link);
573 card->proc_root_link = NULL;
574 if (card->proc_root)
575 snd_info_disconnect(card->proc_root);
576 mutex_unlock(&info_mutex);
577 }
578
579 /*
580 * release the card proc file resources
581 * called from init.c
582 */
583 int snd_info_card_free(struct snd_card *card)
584 {
585 if (!card)
586 return 0;
587 snd_info_free_entry(card->proc_root);
588 card->proc_root = NULL;
589 return 0;
590 }
591
592
593 /**
594 * snd_info_get_line - read one line from the procfs buffer
595 * @buffer: the procfs buffer
596 * @line: the buffer to store
597 * @len: the max. buffer size
598 *
599 * Reads one line from the buffer and stores the string.
600 *
601 * Return: Zero if successful, or 1 if error or EOF.
602 */
603 int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
604 {
605 int c = -1;
606
607 if (snd_BUG_ON(!buffer || !buffer->buffer))
608 return 1;
609 if (len <= 0 || buffer->stop || buffer->error)
610 return 1;
611 while (!buffer->stop) {
612 c = buffer->buffer[buffer->curr++];
613 if (buffer->curr >= buffer->size)
614 buffer->stop = 1;
615 if (c == '\n')
616 break;
617 if (len > 1) {
618 len--;
619 *line++ = c;
620 }
621 }
622 *line = '\0';
623 return 0;
624 }
625
626 EXPORT_SYMBOL(snd_info_get_line);
627
628 /**
629 * snd_info_get_str - parse a string token
630 * @dest: the buffer to store the string token
631 * @src: the original string
632 * @len: the max. length of token - 1
633 *
634 * Parses the original string and copy a token to the given
635 * string buffer.
636 *
637 * Return: The updated pointer of the original string so that
638 * it can be used for the next call.
639 */
640 const char *snd_info_get_str(char *dest, const char *src, int len)
641 {
642 int c;
643
644 while (*src == ' ' || *src == '\t')
645 src++;
646 if (*src == '"' || *src == '\'') {
647 c = *src++;
648 while (--len > 0 && *src && *src != c) {
649 *dest++ = *src++;
650 }
651 if (*src == c)
652 src++;
653 } else {
654 while (--len > 0 && *src && *src != ' ' && *src != '\t') {
655 *dest++ = *src++;
656 }
657 }
658 *dest = 0;
659 while (*src == ' ' || *src == '\t')
660 src++;
661 return src;
662 }
663
664 EXPORT_SYMBOL(snd_info_get_str);
665
666 /**
667 * snd_info_create_entry - create an info entry
668 * @name: the proc file name
669 *
670 * Creates an info entry with the given file name and initializes as
671 * the default state.
672 *
673 * Usually called from other functions such as
674 * snd_info_create_card_entry().
675 *
676 * Return: The pointer of the new instance, or %NULL on failure.
677 */
678 static struct snd_info_entry *snd_info_create_entry(const char *name)
679 {
680 struct snd_info_entry *entry;
681 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
682 if (entry == NULL)
683 return NULL;
684 entry->name = kstrdup(name, GFP_KERNEL);
685 if (entry->name == NULL) {
686 kfree(entry);
687 return NULL;
688 }
689 entry->mode = S_IFREG | S_IRUGO;
690 entry->content = SNDRV_INFO_CONTENT_TEXT;
691 mutex_init(&entry->access);
692 INIT_LIST_HEAD(&entry->children);
693 INIT_LIST_HEAD(&entry->list);
694 return entry;
695 }
696
697 /**
698 * snd_info_create_module_entry - create an info entry for the given module
699 * @module: the module pointer
700 * @name: the file name
701 * @parent: the parent directory
702 *
703 * Creates a new info entry and assigns it to the given module.
704 *
705 * Return: The pointer of the new instance, or %NULL on failure.
706 */
707 struct snd_info_entry *snd_info_create_module_entry(struct module * module,
708 const char *name,
709 struct snd_info_entry *parent)
710 {
711 struct snd_info_entry *entry = snd_info_create_entry(name);
712 if (entry) {
713 entry->module = module;
714 entry->parent = parent;
715 }
716 return entry;
717 }
718
719 EXPORT_SYMBOL(snd_info_create_module_entry);
720
721 /**
722 * snd_info_create_card_entry - create an info entry for the given card
723 * @card: the card instance
724 * @name: the file name
725 * @parent: the parent directory
726 *
727 * Creates a new info entry and assigns it to the given card.
728 *
729 * Return: The pointer of the new instance, or %NULL on failure.
730 */
731 struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
732 const char *name,
733 struct snd_info_entry * parent)
734 {
735 struct snd_info_entry *entry = snd_info_create_entry(name);
736 if (entry) {
737 entry->module = card->module;
738 entry->card = card;
739 entry->parent = parent;
740 }
741 return entry;
742 }
743
744 EXPORT_SYMBOL(snd_info_create_card_entry);
745
746 static void snd_info_disconnect(struct snd_info_entry *entry)
747 {
748 struct snd_info_entry *p, *n;
749
750 if (!entry->p)
751 return;
752 list_for_each_entry_safe(p, n, &entry->children, list)
753 snd_info_disconnect(p);
754 list_del_init(&entry->list);
755 proc_remove(entry->p);
756 entry->p = NULL;
757 }
758
759 /**
760 * snd_info_free_entry - release the info entry
761 * @entry: the info entry
762 *
763 * Releases the info entry.
764 */
765 void snd_info_free_entry(struct snd_info_entry * entry)
766 {
767 struct snd_info_entry *p, *n;
768
769 if (!entry)
770 return;
771 if (entry->p) {
772 mutex_lock(&info_mutex);
773 snd_info_disconnect(entry);
774 mutex_unlock(&info_mutex);
775 }
776
777 /* free all children at first */
778 list_for_each_entry_safe(p, n, &entry->children, list)
779 snd_info_free_entry(p);
780
781 kfree(entry->name);
782 if (entry->private_free)
783 entry->private_free(entry);
784 kfree(entry);
785 }
786
787 EXPORT_SYMBOL(snd_info_free_entry);
788
789 /**
790 * snd_info_register - register the info entry
791 * @entry: the info entry
792 *
793 * Registers the proc info entry.
794 *
795 * Return: Zero if successful, or a negative error code on failure.
796 */
797 int snd_info_register(struct snd_info_entry * entry)
798 {
799 struct proc_dir_entry *root, *p = NULL;
800
801 if (snd_BUG_ON(!entry))
802 return -ENXIO;
803 root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p;
804 mutex_lock(&info_mutex);
805 if (S_ISDIR(entry->mode)) {
806 p = proc_mkdir_mode(entry->name, entry->mode, root);
807 if (!p) {
808 mutex_unlock(&info_mutex);
809 return -ENOMEM;
810 }
811 } else {
812 const struct file_operations *ops;
813 if (entry->content == SNDRV_INFO_CONTENT_DATA)
814 ops = &snd_info_entry_operations;
815 else
816 ops = &snd_info_text_entry_ops;
817 p = proc_create_data(entry->name, entry->mode, root,
818 ops, entry);
819 if (!p) {
820 mutex_unlock(&info_mutex);
821 return -ENOMEM;
822 }
823 proc_set_size(p, entry->size);
824 }
825 entry->p = p;
826 if (entry->parent)
827 list_add_tail(&entry->list, &entry->parent->children);
828 mutex_unlock(&info_mutex);
829 return 0;
830 }
831
832 EXPORT_SYMBOL(snd_info_register);
833
834 /*
835
836 */
837
838 static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
839 {
840 snd_iprintf(buffer,
841 "Advanced Linux Sound Architecture Driver Version k%s.\n",
842 init_utsname()->release);
843 }
844
845 static int __init snd_info_version_init(void)
846 {
847 struct snd_info_entry *entry;
848
849 entry = snd_info_create_module_entry(THIS_MODULE, "version", NULL);
850 if (entry == NULL)
851 return -ENOMEM;
852 entry->c.text.read = snd_info_version_read;
853 if (snd_info_register(entry) < 0) {
854 snd_info_free_entry(entry);
855 return -ENOMEM;
856 }
857 return 0;
858 }
859
860 #endif /* CONFIG_PROC_FS */
This page took 0.132845 seconds and 6 git commands to generate.