Merge "ALSA: core: Add an API to create and register module"

This commit is contained in:
Linux Build Service Account 2015-07-22 13:06:36 -07:00 committed by Gerrit - the friendly Code Review server
commit c9f748c828
2 changed files with 36 additions and 2 deletions

View File

@ -147,7 +147,9 @@ static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
}
int snd_info_check_reserved_words(const char *str);
struct snd_info_entry *snd_register_module_info(struct module *module,
const char *name,
struct snd_info_entry *parent);
#else
#define snd_seq_root NULL
@ -177,7 +179,9 @@ static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribut
void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
static inline int snd_info_check_reserved_words(const char *str) { return 1; }
static inline struct snd_info_entry *snd_register_module_info(
struct module *module, const char *name,
struct snd_info_entry *parent) { return NULL; }
#endif
/*

View File

@ -674,6 +674,36 @@ int snd_info_card_free(struct snd_card *card)
return 0;
}
/*
* snd_register_module_info - create and register module
* @module: the module pointer
* @name: the module name
* @parent: the parent directory
*
* Creates and registers new module entry.
*
* Return: The pointer of the new instance, or NULL on failure.
*/
struct snd_info_entry *snd_register_module_info(struct module *module,
const char *name,
struct snd_info_entry *parent)
{
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(module, name, parent);
if (!entry)
return NULL;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return NULL;
}
return entry;
}
EXPORT_SYMBOL(snd_register_module_info);
/**
* snd_info_get_line - read one line from the procfs buffer