Lines Matching refs:entry

54 	struct snd_info_entry *entry;
59 static void snd_info_clear_entries(struct snd_info_entry *entry);
73 static int alloc_info_private(struct snd_info_entry *entry,
78 if (!entry || !entry->p)
80 if (!try_module_get(entry->module))
84 module_put(entry->module);
87 data->entry = entry;
107 struct snd_info_entry *entry;
111 entry = data->entry;
112 mutex_lock(&entry->access);
113 if (entry->c.ops->llseek) {
114 ret = entry->c.ops->llseek(entry,
120 size = entry->size;
142 mutex_unlock(&entry->access);
150 struct snd_info_entry *entry = data->entry;
157 if (pos >= entry->size)
159 size = entry->size - pos;
161 size = entry->c.ops->read(entry, data->file_private_data,
172 struct snd_info_entry *entry = data->entry;
180 size_t maxsize = entry->size - pos;
182 size = entry->c.ops->write(entry, data->file_private_data,
193 struct snd_info_entry *entry = data->entry;
196 if (entry->c.ops->poll)
197 return entry->c.ops->poll(entry,
200 if (entry->c.ops->read)
202 if (entry->c.ops->write)
211 struct snd_info_entry *entry = data->entry;
213 if (!entry->c.ops->ioctl)
215 return entry->c.ops->ioctl(entry, data->file_private_data,
223 struct snd_info_entry *entry;
228 entry = data->entry;
229 if (!entry->c.ops->mmap)
231 return entry->c.ops->mmap(entry, data->file_private_data,
237 struct snd_info_entry *entry = pde_data(inode);
242 err = alloc_info_private(entry, &data);
247 if (((mode == O_RDONLY || mode == O_RDWR) && !entry->c.ops->read) ||
248 ((mode == O_WRONLY || mode == O_RDWR) && !entry->c.ops->write)) {
253 if (entry->c.ops->open) {
254 err = entry->c.ops->open(entry, mode, &data->file_private_data);
265 module_put(entry->module);
274 struct snd_info_entry *entry = data->entry;
276 if (entry->c.ops->release)
277 entry->c.ops->release(entry, file->f_flags & O_ACCMODE,
279 module_put(entry->module);
305 struct snd_info_entry *entry = data->entry;
311 if (!entry->c.text.write)
320 mutex_lock(&entry->access);
345 mutex_unlock(&entry->access);
355 struct snd_info_entry *entry = data->entry;
357 if (!entry->c.text.read) {
361 entry->c.text.read(entry, data->rbuffer);
368 struct snd_info_entry *entry = pde_data(inode);
373 err = alloc_info_private(entry, &data);
382 if (entry->size)
384 entry->size);
395 module_put(entry->module);
405 struct snd_info_entry *entry = data->entry;
407 if (data->wbuffer && entry->c.text.write)
408 entry->c.text.write(entry, data->wbuffer);
417 module_put(entry->module);
434 struct snd_info_entry *entry;
436 entry = snd_info_create_module_entry(mod, name, NULL);
437 if (!entry)
439 entry->mode = S_IFDIR | 0555;
440 if (snd_info_register(entry) < 0) {
441 snd_info_free_entry(entry);
444 return entry;
489 static void snd_card_id_read(struct snd_info_entry *entry,
492 struct snd_card *card = entry->private_data;
504 struct snd_info_entry *entry;
510 entry = create_subdir(card->module, str);
511 if (!entry)
513 card->proc_root = entry;
673 * snd_info_create_entry - create an info entry
677 * Creates an info entry with the given file name and initializes as
689 struct snd_info_entry *entry;
690 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
691 if (entry == NULL)
693 entry->name = kstrdup(name, GFP_KERNEL);
694 if (entry->name == NULL) {
695 kfree(entry);
698 entry->mode = S_IFREG | 0444;
699 entry->content = SNDRV_INFO_CONTENT_TEXT;
700 mutex_init(&entry->access);
701 INIT_LIST_HEAD(&entry->children);
702 INIT_LIST_HEAD(&entry->list);
703 entry->parent = parent;
704 entry->module = module;
707 list_add_tail(&entry->list, &parent->children);
710 return entry;
714 * snd_info_create_module_entry - create an info entry for the given module
719 * Creates a new info entry and assigns it to the given module.
734 * snd_info_create_card_entry - create an info entry for the given card
739 * Creates a new info entry and assigns it to the given card.
753 static void snd_info_clear_entries(struct snd_info_entry *entry)
757 if (!entry->p)
759 list_for_each_entry(p, &entry->children, list)
761 entry->p = NULL;
765 * snd_info_free_entry - release the info entry
766 * @entry: the info entry
768 * Releases the info entry.
770 void snd_info_free_entry(struct snd_info_entry * entry)
774 if (!entry)
776 if (entry->p) {
777 proc_remove(entry->p);
779 snd_info_clear_entries(entry);
784 list_for_each_entry_safe(p, n, &entry->children, list)
787 p = entry->parent;
790 list_del(&entry->list);
793 kfree(entry->name);
794 if (entry->private_free)
795 entry->private_free(entry);
796 kfree(entry);
800 static int __snd_info_register(struct snd_info_entry *entry)
804 if (snd_BUG_ON(!entry))
806 root = entry->parent == NULL ? snd_proc_root->p : entry->parent->p;
808 if (entry->p || !root)
810 if (S_ISDIR(entry->mode)) {
811 p = proc_mkdir_mode(entry->name, entry->mode, root);
818 if (entry->content == SNDRV_INFO_CONTENT_DATA)
822 p = proc_create_data(entry->name, entry->mode, root,
823 ops, entry);
828 proc_set_size(p, entry->size);
830 entry->p = p;
837 * snd_info_register - register the info entry
838 * @entry: the info entry
840 * Registers the proc info entry.
845 int snd_info_register(struct snd_info_entry *entry)
850 if (!entry->p) {
851 err = __snd_info_register(entry);
856 list_for_each_entry(p, &entry->children, list) {
867 * snd_card_rw_proc_new - Create a read/write text proc file entry for the card
874 * This proc file entry will be registered via snd_card_register() call, and
883 void (*write)(struct snd_info_entry *entry,
886 struct snd_info_entry *entry;
888 entry = snd_info_create_card_entry(card, name, card->proc_root);
889 if (!entry)
891 snd_info_set_text_ops(entry, private_data, read);
893 entry->mode |= 0200;
894 entry->c.text.write = write;
904 static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
913 struct snd_info_entry *entry;
915 entry = snd_info_create_module_entry(THIS_MODULE, "version", NULL);
916 if (entry == NULL)
918 entry->c.text.read = snd_info_version_read;
919 return snd_info_register(entry); /* freed in error path */