ANDROID: GKI: ALSA: core: modify, rename and export create_subdir API
Modify create_subdir API, so that it can create a subdir
under a given parent directory and then register the info
entry. Also rename and export the API so that it can be
used to expose ID and version related information.
Test: build
Bug: 151372815
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
(cherry picked from commit 454c5b5c34
)
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Change-Id: I8876b7ab22594766c9ec08c7289d8f38de7f00fa
This commit is contained in:
parent
f7fbc946c2
commit
b224f6a82f
2 changed files with 24 additions and 9 deletions
|
@ -161,7 +161,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_info_create_subdir(struct module *mod,
|
||||
const char *name,
|
||||
struct snd_info_entry *parent);
|
||||
#else
|
||||
|
||||
#define snd_seq_root NULL
|
||||
|
@ -190,7 +192,9 @@ static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribut
|
|||
void *private_data,
|
||||
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_info_create_subdir(
|
||||
struct module *mod, const char *name,
|
||||
struct snd_info_entry *parent) { return NULL; }
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -446,12 +446,23 @@ static const struct file_operations snd_info_text_entry_ops =
|
|||
.read = seq_read,
|
||||
};
|
||||
|
||||
static struct snd_info_entry *create_subdir(struct module *mod,
|
||||
const char *name)
|
||||
/*
|
||||
* snd_info_create_subdir - create and register a subdir for a given parent
|
||||
* @mod: the module pointer
|
||||
* @name: the module name
|
||||
* @parent: the parent directory
|
||||
*
|
||||
* Creates and registers new subdir entry inside a given parent.
|
||||
*
|
||||
* Return: The pointer of the new instance, or NULL on failure.
|
||||
*/
|
||||
struct snd_info_entry *snd_info_create_subdir(struct module *mod,
|
||||
const char *name,
|
||||
struct snd_info_entry *parent)
|
||||
{
|
||||
struct snd_info_entry *entry;
|
||||
|
||||
entry = snd_info_create_module_entry(mod, name, NULL);
|
||||
entry = snd_info_create_module_entry(mod, name, parent);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
entry->mode = S_IFDIR | 0555;
|
||||
|
@ -461,6 +472,7 @@ static struct snd_info_entry *create_subdir(struct module *mod,
|
|||
}
|
||||
return entry;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_info_create_subdir);
|
||||
|
||||
static struct snd_info_entry *
|
||||
snd_info_create_entry(const char *name, struct snd_info_entry *parent);
|
||||
|
@ -475,12 +487,12 @@ int __init snd_info_init(void)
|
|||
if (!snd_proc_root->p)
|
||||
goto error;
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
snd_oss_root = create_subdir(THIS_MODULE, "oss");
|
||||
snd_oss_root = snd_info_create_subdir(THIS_MODULE, "oss", NULL);
|
||||
if (!snd_oss_root)
|
||||
goto error;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
|
||||
snd_seq_root = create_subdir(THIS_MODULE, "seq");
|
||||
snd_seq_root = snd_info_create_subdir(THIS_MODULE, "seq", NULL);
|
||||
if (!snd_seq_root)
|
||||
goto error;
|
||||
#endif
|
||||
|
@ -516,7 +528,7 @@ int snd_info_card_create(struct snd_card *card)
|
|||
return -ENXIO;
|
||||
|
||||
sprintf(str, "card%i", card->number);
|
||||
entry = create_subdir(card->module, str);
|
||||
entry = snd_info_create_subdir(card->module, str, NULL);
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
card->proc_root = entry;
|
||||
|
@ -619,7 +631,6 @@ int snd_info_card_free(struct snd_card *card)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* snd_info_get_line - read one line from the procfs buffer
|
||||
* @buffer: the procfs buffer
|
||||
|
|
Loading…
Reference in a new issue