* [PATCH v2 1/2] ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec
@ 2017-08-07 3:16 Fabio Estevam
2017-08-07 3:16 ` [PATCH v2 2/2] ASoC: soc-core: Remove unneeded error check Fabio Estevam
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2017-08-07 3:16 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, Fabio Estevam
There is no need to have the *debugfs_reg dentry member as part of
the snd_soc_codec structure as its only usage is inside
soc_init_codec_debugfs().
Use a local dentry variable instead.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- None
include/sound/soc.h | 4 ----
sound/soc/soc-core.c | 9 +++++----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9d6e1db..42e2e50 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -897,10 +897,6 @@ struct snd_soc_codec {
/* component */
struct snd_soc_component component;
-
-#ifdef CONFIG_DEBUG_FS
- struct dentry *debugfs_reg;
-#endif
};
/* codec driver */
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 13c875e..e93a72c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -339,11 +339,12 @@ static void soc_cleanup_component_debugfs(struct snd_soc_component *component)
static void soc_init_codec_debugfs(struct snd_soc_component *component)
{
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
+ struct dentry *debugfs_reg;
- codec->debugfs_reg = debugfs_create_file("codec_reg", 0644,
- codec->component.debugfs_root,
- codec, &codec_reg_fops);
- if (!codec->debugfs_reg)
+ debugfs_reg = debugfs_create_file("codec_reg", 0644,
+ codec->component.debugfs_root,
+ codec, &codec_reg_fops);
+ if (!debugfs_reg)
dev_warn(codec->dev,
"ASoC: Failed to create codec register debugfs file\n");
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] ASoC: soc-core: Remove unneeded error check
2017-08-07 3:16 [PATCH v2 1/2] ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec Fabio Estevam
@ 2017-08-07 3:16 ` Fabio Estevam
2017-08-07 11:31 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2017-08-07 3:16 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, Fabio Estevam
debugfs_create_dir() only returns an error pointer when kernel has been
built without debugfs support.
Quoting Documentation/filesystems/debugfs.txt:
"A NULL return value indicates that something went
wrong. If ERR_PTR(-ENODEV) is returned, that is an indication that the
kernel has been built without debugfs support and none of the functions
described below will work."
As snd_soc_debugfs_init() is only defined when CONFIG_DEBUG_FS=y,
there is no possibility for debugfs_create_dir() returning an error,
so remove the unneeded error check.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Remove uneeded 'snd_soc_debugfs_root = NULL;' assignment
sound/soc/soc-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e93a72c..4edd00a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -495,9 +495,8 @@ static void soc_cleanup_card_debugfs(struct snd_soc_card *card)
static void snd_soc_debugfs_init(void)
{
snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
- if (IS_ERR(snd_soc_debugfs_root) || !snd_soc_debugfs_root) {
+ if (!snd_soc_debugfs_root) {
pr_warn("ASoC: Failed to create debugfs directory\n");
- snd_soc_debugfs_root = NULL;
return;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 2/2] ASoC: soc-core: Remove unneeded error check
2017-08-07 3:16 ` [PATCH v2 2/2] ASoC: soc-core: Remove unneeded error check Fabio Estevam
@ 2017-08-07 11:31 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2017-08-07 11:31 UTC (permalink / raw)
To: Fabio Estevam; +Cc: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 703 bytes --]
On Mon, Aug 07, 2017 at 12:16:54AM -0300, Fabio Estevam wrote:
> "A NULL return value indicates that something went
> wrong. If ERR_PTR(-ENODEV) is returned, that is an indication that the
> kernel has been built without debugfs support and none of the functions
> described below will work."
> As snd_soc_debugfs_init() is only defined when CONFIG_DEBUG_FS=y,
> there is no possibility for debugfs_create_dir() returning an error,
> so remove the unneeded error check.
Removing the error handling means that if in future it does start
returning errors we'll ignore them - it's not like the error handling is
getting in the way or otherwise causing problems, removing it isn't
making things better.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-07 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 3:16 [PATCH v2 1/2] ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec Fabio Estevam
2017-08-07 3:16 ` [PATCH v2 2/2] ASoC: soc-core: Remove unneeded error check Fabio Estevam
2017-08-07 11:31 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).