Lines Matching refs:entry
55 struct snd_info_entry *entry;
60 static void snd_info_clear_entries(struct snd_info_entry *entry);
74 static int alloc_info_private(struct snd_info_entry *entry,
79 if (!entry || !entry->p)
81 if (!try_module_get(entry->module))
85 module_put(entry->module);
88 data->entry = entry;
108 struct snd_info_entry *entry;
112 entry = data->entry;
113 mutex_lock(&entry->access);
114 if (entry->c.ops->llseek) {
115 ret = entry->c.ops->llseek(entry,
121 size = entry->size;
143 mutex_unlock(&entry->access);
151 struct snd_info_entry *entry = data->entry;
158 if (pos >= entry->size)
160 size = entry->size - pos;
162 size = entry->c.ops->read(entry, data->file_private_data,
173 struct snd_info_entry *entry = data->entry;
181 size_t maxsize = entry->size - pos;
183 size = entry->c.ops->write(entry, data->file_private_data,
194 struct snd_info_entry *entry = data->entry;
197 if (entry->c.ops->poll)
198 return entry->c.ops->poll(entry,
201 if (entry->c.ops->read)
203 if (entry->c.ops->write)
212 struct snd_info_entry *entry = data->entry;
214 if (!entry->c.ops->ioctl)
216 return entry->c.ops->ioctl(entry, data->file_private_data,
224 struct snd_info_entry *entry;
229 entry = data->entry;
230 if (!entry->c.ops->mmap)
232 return entry->c.ops->mmap(entry, data->file_private_data,
238 struct snd_info_entry *entry = PDE_DATA(inode);
243 err = alloc_info_private(entry, &data);
248 if (((mode == O_RDONLY || mode == O_RDWR) && !entry->c.ops->read) ||
249 ((mode == O_WRONLY || mode == O_RDWR) && !entry->c.ops->write)) {
254 if (entry->c.ops->open) {
255 err = entry->c.ops->open(entry, mode, &data->file_private_data);
266 module_put(entry->module);
275 struct snd_info_entry *entry = data->entry;
277 if (entry->c.ops->release)
278 entry->c.ops->release(entry, file->f_flags & O_ACCMODE,
280 module_put(entry->module);
306 struct snd_info_entry *entry = data->entry;
312 if (!entry->c.text.write)
321 mutex_lock(&entry->access);
346 mutex_unlock(&entry->access);
356 struct snd_info_entry *entry = data->entry;
358 if (!entry->c.text.read) {
362 entry->c.text.read(entry, data->rbuffer);
369 struct snd_info_entry *entry = PDE_DATA(inode);
374 err = alloc_info_private(entry, &data);
383 if (entry->size)
385 entry->size);
396 module_put(entry->module);
406 struct snd_info_entry *entry = data->entry;
408 if (data->wbuffer && entry->c.text.write)
409 entry->c.text.write(entry, data->wbuffer);
418 module_put(entry->module);
435 struct snd_info_entry *entry;
437 entry = snd_info_create_module_entry(mod, name, NULL);
438 if (!entry)
440 entry->mode = S_IFDIR | 0555;
441 if (snd_info_register(entry) < 0) {
442 snd_info_free_entry(entry);
445 return entry;
490 static void snd_card_id_read(struct snd_info_entry *entry,
493 struct snd_card *card = entry->private_data;
505 struct snd_info_entry *entry;
511 entry = create_subdir(card->module, str);
512 if (!entry)
514 card->proc_root = entry;
674 * snd_info_create_entry - create an info entry
678 * Creates an info entry with the given file name and initializes as
690 struct snd_info_entry *entry;
691 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
692 if (entry == NULL)
694 entry->name = kstrdup(name, GFP_KERNEL);
695 if (entry->name == NULL) {
696 kfree(entry);
699 entry->mode = S_IFREG | 0444;
700 entry->content = SNDRV_INFO_CONTENT_TEXT;
701 mutex_init(&entry->access);
702 INIT_LIST_HEAD(&entry->children);
703 INIT_LIST_HEAD(&entry->list);
704 entry->parent = parent;
705 entry->module = module;
708 list_add_tail(&entry->list, &parent->children);
711 return entry;
715 * snd_info_create_module_entry - create an info entry for the given module
720 * Creates a new info entry and assigns it to the given module.
735 * snd_info_create_card_entry - create an info entry for the given card
740 * Creates a new info entry and assigns it to the given card.
754 static void snd_info_clear_entries(struct snd_info_entry *entry)
758 if (!entry->p)
760 list_for_each_entry(p, &entry->children, list)
762 entry->p = NULL;
766 * snd_info_free_entry - release the info entry
767 * @entry: the info entry
769 * Releases the info entry.
771 void snd_info_free_entry(struct snd_info_entry * entry)
775 if (!entry)
777 if (entry->p) {
778 proc_remove(entry->p);
780 snd_info_clear_entries(entry);
785 list_for_each_entry_safe(p, n, &entry->children, list)
788 p = entry->parent;
791 list_del(&entry->list);
794 kfree(entry->name);
795 if (entry->private_free)
796 entry->private_free(entry);
797 kfree(entry);
801 static int __snd_info_register(struct snd_info_entry *entry)
805 if (snd_BUG_ON(!entry))
807 root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p;
809 if (entry->p || !root)
811 if (S_ISDIR(entry->mode)) {
812 p = proc_mkdir_mode(entry->name, entry->mode, root);
819 if (entry->content == SNDRV_INFO_CONTENT_DATA)
823 p = proc_create_data(entry->name, entry->mode, root,
824 ops, entry);
829 proc_set_size(p, entry->size);
831 entry->p = p;
838 * snd_info_register - register the info entry
839 * @entry: the info entry
841 * Registers the proc info entry.
846 int snd_info_register(struct snd_info_entry *entry)
851 if (!entry->p) {
852 err = __snd_info_register(entry);
857 list_for_each_entry(p, &entry->children, list) {
868 * snd_card_rw_proc_new - Create a read/write text proc file entry for the card
875 * This proc file entry will be registered via snd_card_register() call, and
882 void (*write)(struct snd_info_entry *entry,
885 struct snd_info_entry *entry;
887 entry = snd_info_create_card_entry(card, name, card->proc_root);
888 if (!entry)
890 snd_info_set_text_ops(entry, private_data, read);
892 entry->mode |= 0200;
893 entry->c.text.write = write;
903 static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
912 struct snd_info_entry *entry;
914 entry = snd_info_create_module_entry(THIS_MODULE, "version", NULL);
915 if (entry == NULL)
917 entry->c.text.read = snd_info_version_read;
918 return snd_info_register(entry); /* freed in error path */