ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec
PATCH 1/2 ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec
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.
--- include/sound/soc.h | 4 ---- sound/soc/soc-core.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-)
include/sound/soc.h +0 -4
@@ -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 */
sound/soc/soc-core.c +5 -4
@@ -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" ); }
Signature · 1 line
2.7.4
PATCH 2/2 ASoC: soc-core: Remove unneeded error check
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.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -495,7 +495,7 @@ 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 ;
Signature · 1 line
2.7.4
Mark Brown
maintainerApplied "ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec" to the asoc tree
In reply to Fabio EstevamThe patch
ASoC: soc-core: Remove unneeded dentry member from snd_soc_codec
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
353c64dd19ebc99786c3578ea0444e1b5b1bb172Mon Sep 17 00:00:00 2001
From: Fabio Estevam <[email protected]>
Date: Mon, 7 Aug 2017 09:08:52 -0300
Subject: [PATCH] ASoC: soc-core: Remove unneeded dentry member from
snd_soc_codec
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.
--- include/sound/soc.h | 4 ---- sound/soc/soc-core.c | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-)
include/sound/soc.h +0 -4
@@ -903,10 +903,6 @@ struct snd_soc_codec {/* component */ struct snd_soc_component component; - -#ifdef CONFIG_DEBUG_FS -struct dentry *debugfs_reg; -#endif };/* codec driver */
sound/soc/soc-core.c +5 -4
@@ -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" ); }
Signature · 1 line
2.13.3