Lines Matching full:entry

54 	struct snd_info_entry *entry;  member
59 static void snd_info_clear_entries(struct snd_info_entry *entry);
73 static int alloc_info_private(struct snd_info_entry *entry, in alloc_info_private() argument
78 if (!entry || !entry->p) in alloc_info_private()
80 if (!try_module_get(entry->module)) in alloc_info_private()
84 module_put(entry->module); in alloc_info_private()
87 data->entry = entry; in alloc_info_private()
107 struct snd_info_entry *entry; in snd_info_entry_llseek() local
111 entry = data->entry; in snd_info_entry_llseek()
112 guard(mutex)(&entry->access); in snd_info_entry_llseek()
113 if (entry->c.ops->llseek) in snd_info_entry_llseek()
114 return entry->c.ops->llseek(entry, in snd_info_entry_llseek()
118 size = entry->size; in snd_info_entry_llseek()
145 struct snd_info_entry *entry = data->entry; in snd_info_entry_read() local
152 if (pos >= entry->size) in snd_info_entry_read()
154 size = entry->size - pos; in snd_info_entry_read()
156 size = entry->c.ops->read(entry, data->file_private_data, in snd_info_entry_read()
167 struct snd_info_entry *entry = data->entry; in snd_info_entry_write() local
175 size_t maxsize = entry->size - pos; in snd_info_entry_write()
177 size = entry->c.ops->write(entry, data->file_private_data, in snd_info_entry_write()
188 struct snd_info_entry *entry = data->entry; in snd_info_entry_poll() local
191 if (entry->c.ops->poll) in snd_info_entry_poll()
192 return entry->c.ops->poll(entry, in snd_info_entry_poll()
195 if (entry->c.ops->read) in snd_info_entry_poll()
197 if (entry->c.ops->write) in snd_info_entry_poll()
206 struct snd_info_entry *entry = data->entry; in snd_info_entry_ioctl() local
208 if (!entry->c.ops->ioctl) in snd_info_entry_ioctl()
210 return entry->c.ops->ioctl(entry, data->file_private_data, in snd_info_entry_ioctl()
218 struct snd_info_entry *entry; in snd_info_entry_mmap() local
223 entry = data->entry; in snd_info_entry_mmap()
224 if (!entry->c.ops->mmap) in snd_info_entry_mmap()
226 return entry->c.ops->mmap(entry, data->file_private_data, in snd_info_entry_mmap()
232 struct snd_info_entry *entry = pde_data(inode); in snd_info_entry_open() local
237 err = alloc_info_private(entry, &data); in snd_info_entry_open()
242 if (((mode == O_RDONLY || mode == O_RDWR) && !entry->c.ops->read) || in snd_info_entry_open()
243 ((mode == O_WRONLY || mode == O_RDWR) && !entry->c.ops->write)) { in snd_info_entry_open()
248 if (entry->c.ops->open) { in snd_info_entry_open()
249 err = entry->c.ops->open(entry, mode, &data->file_private_data); in snd_info_entry_open()
259 module_put(entry->module); in snd_info_entry_open()
266 struct snd_info_entry *entry = data->entry; in snd_info_entry_release() local
268 if (entry->c.ops->release) in snd_info_entry_release()
269 entry->c.ops->release(entry, file->f_flags & O_ACCMODE, in snd_info_entry_release()
271 module_put(entry->module); in snd_info_entry_release()
297 struct snd_info_entry *entry = data->entry; in snd_info_text_entry_write() local
302 if (!entry->c.text.write) in snd_info_text_entry_write()
311 guard(mutex)(&entry->access); in snd_info_text_entry_write()
336 struct snd_info_entry *entry = data->entry; in snd_info_seq_show() local
338 if (!entry->c.text.read) { in snd_info_seq_show()
342 entry->c.text.read(entry, data->rbuffer); in snd_info_seq_show()
349 struct snd_info_entry *entry = pde_data(inode); in snd_info_text_entry_open() local
354 err = alloc_info_private(entry, &data); in snd_info_text_entry_open()
363 if (entry->size) in snd_info_text_entry_open()
365 entry->size); in snd_info_text_entry_open()
375 module_put(entry->module); in snd_info_text_entry_open()
383 struct snd_info_entry *entry = data->entry; in snd_info_text_entry_release() local
385 if (data->wbuffer && entry->c.text.write) in snd_info_text_entry_release()
386 entry->c.text.write(entry, data->wbuffer); in snd_info_text_entry_release()
395 module_put(entry->module); in snd_info_text_entry_release()
412 struct snd_info_entry *entry; in create_subdir() local
414 entry = snd_info_create_module_entry(mod, name, NULL); in create_subdir()
415 if (!entry) in create_subdir()
417 entry->mode = S_IFDIR | 0555; in create_subdir()
418 if (snd_info_register(entry) < 0) { in create_subdir()
419 snd_info_free_entry(entry); in create_subdir()
422 return entry; in create_subdir()
467 static void snd_card_id_read(struct snd_info_entry *entry, in snd_card_id_read() argument
470 struct snd_card *card = entry->private_data; in snd_card_id_read()
482 struct snd_info_entry *entry; in snd_info_card_create() local
488 entry = create_subdir(card->module, str); in snd_info_card_create()
489 if (!entry) in snd_info_card_create()
491 card->proc_root = entry; in snd_info_card_create()
649 * snd_info_create_entry - create an info entry
653 * Creates an info entry with the given file name and initializes as
665 struct snd_info_entry *entry; in snd_info_create_entry() local
666 entry = kzalloc(sizeof(*entry), GFP_KERNEL); in snd_info_create_entry()
667 if (entry == NULL) in snd_info_create_entry()
669 entry->name = kstrdup(name, GFP_KERNEL); in snd_info_create_entry()
670 if (entry->name == NULL) { in snd_info_create_entry()
671 kfree(entry); in snd_info_create_entry()
674 entry->mode = S_IFREG | 0444; in snd_info_create_entry()
675 entry->content = SNDRV_INFO_CONTENT_TEXT; in snd_info_create_entry()
676 mutex_init(&entry->access); in snd_info_create_entry()
677 INIT_LIST_HEAD(&entry->children); in snd_info_create_entry()
678 INIT_LIST_HEAD(&entry->list); in snd_info_create_entry()
679 entry->parent = parent; in snd_info_create_entry()
680 entry->module = module; in snd_info_create_entry()
683 list_add_tail(&entry->list, &parent->children); in snd_info_create_entry()
685 return entry; in snd_info_create_entry()
689 * snd_info_create_module_entry - create an info entry for the given module
694 * Creates a new info entry and assigns it to the given module.
709 * snd_info_create_card_entry - create an info entry for the given card
714 * Creates a new info entry and assigns it to the given card.
728 static void snd_info_clear_entries(struct snd_info_entry *entry) in snd_info_clear_entries() argument
732 if (!entry->p) in snd_info_clear_entries()
734 list_for_each_entry(p, &entry->children, list) in snd_info_clear_entries()
736 entry->p = NULL; in snd_info_clear_entries()
740 * snd_info_free_entry - release the info entry
741 * @entry: the info entry
743 * Releases the info entry.
745 void snd_info_free_entry(struct snd_info_entry * entry) in snd_info_free_entry() argument
749 if (!entry) in snd_info_free_entry()
751 if (entry->p) { in snd_info_free_entry()
752 proc_remove(entry->p); in snd_info_free_entry()
754 snd_info_clear_entries(entry); in snd_info_free_entry()
758 list_for_each_entry_safe(p, n, &entry->children, list) in snd_info_free_entry()
761 p = entry->parent; in snd_info_free_entry()
764 list_del(&entry->list); in snd_info_free_entry()
766 kfree(entry->name); in snd_info_free_entry()
767 if (entry->private_free) in snd_info_free_entry()
768 entry->private_free(entry); in snd_info_free_entry()
769 kfree(entry); in snd_info_free_entry()
773 static int __snd_info_register(struct snd_info_entry *entry) in __snd_info_register() argument
777 if (snd_BUG_ON(!entry)) in __snd_info_register()
779 root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p; in __snd_info_register()
781 if (entry->p || !root) in __snd_info_register()
783 if (S_ISDIR(entry->mode)) { in __snd_info_register()
784 p = proc_mkdir_mode(entry->name, entry->mode, root); in __snd_info_register()
789 if (entry->content == SNDRV_INFO_CONTENT_DATA) in __snd_info_register()
793 p = proc_create_data(entry->name, entry->mode, root, in __snd_info_register()
794 ops, entry); in __snd_info_register()
797 proc_set_size(p, entry->size); in __snd_info_register()
799 entry->p = p; in __snd_info_register()
804 * snd_info_register - register the info entry
805 * @entry: the info entry
807 * Registers the proc info entry.
812 int snd_info_register(struct snd_info_entry *entry) in snd_info_register() argument
817 if (!entry->p) { in snd_info_register()
818 err = __snd_info_register(entry); in snd_info_register()
823 list_for_each_entry(p, &entry->children, list) { in snd_info_register()
834 * snd_card_rw_proc_new - Create a read/write text proc file entry for the card
841 * This proc file entry will be registered via snd_card_register() call, and
850 void (*write)(struct snd_info_entry *entry, in snd_card_rw_proc_new() argument
853 struct snd_info_entry *entry; in snd_card_rw_proc_new() local
855 entry = snd_info_create_card_entry(card, name, card->proc_root); in snd_card_rw_proc_new()
856 if (!entry) in snd_card_rw_proc_new()
858 snd_info_set_text_ops(entry, private_data, read); in snd_card_rw_proc_new()
860 entry->mode |= 0200; in snd_card_rw_proc_new()
861 entry->c.text.write = write; in snd_card_rw_proc_new()
871 static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) in snd_info_version_read() argument
880 struct snd_info_entry *entry; in snd_info_version_init() local
882 entry = snd_info_create_module_entry(THIS_MODULE, "version", NULL); in snd_info_version_init()
883 if (entry == NULL) in snd_info_version_init()
885 entry->c.text.read = snd_info_version_read; in snd_info_version_init()
886 return snd_info_register(entry); /* freed in error path */ in snd_info_version_init()