summaryrefslogtreecommitdiff
path: root/include/sound/info.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-04 14:53:04 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-06 18:11:55 +0100
commit7453e1dafdec076f87384c8647d2960affd57ecc (patch)
tree2d82ae43f4669c943af79f50fc78793e6eac6000 /include/sound/info.h
parenteaffef0d5fca38939ac986de4625f4f070c49346 (diff)
ALSA: info: Add standard helpers for card proc file entries
Two new helper functions are added here for cleaning up the existing lengthy calls. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/info.h')
-rw-r--r--include/sound/info.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/sound/info.h b/include/sound/info.h
index becdf66d2825..96530f7599e1 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -160,6 +160,13 @@ static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
entry->c.text.read = read;
}
+int snd_card_rw_proc_new(struct snd_card *card, const char *name,
+ void *private_data,
+ void (*read)(struct snd_info_entry *,
+ struct snd_info_buffer *),
+ void (*write)(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer));
+
int snd_info_check_reserved_words(const char *str);
#else
@@ -189,10 +196,38 @@ static inline int snd_card_proc_new(struct snd_card *card, const char *name,
static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
void *private_data,
void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
+static inline int snd_card_rw_proc_new(struct snd_card *card, const char *name,
+ void *private_data,
+ void (*read)(struct snd_info_entry *,
+ struct snd_info_buffer *),
+ void (*write)(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer))
+{
+ return 0;
+}
static inline int snd_info_check_reserved_words(const char *str) { return 1; }
#endif
+/**
+ * snd_card_ro_proc_new - Create a read-only text proc file entry for the card
+ * @card: the card instance
+ * @name: the file name
+ * @private_data: the arbitrary private data
+ * @read: the read callback
+ *
+ * This proc file entry will be registered via snd_card_register() call, and
+ * it will be removed automatically at the card removal, too.
+ */
+static inline int
+snd_card_ro_proc_new(struct snd_card *card, const char *name,
+ void *private_data,
+ void (*read)(struct snd_info_entry *,
+ struct snd_info_buffer *))
+{
+ return snd_card_rw_proc_new(card, name, private_data, read, NULL);
+}
+
/*
* OSS info part
*/