Skip to contentSkip to conversation

Add remove path for Tegra audio graph card

PATCH In review Sameer Pujar 3 participants 10 messages Feb 3, 2021 – Feb 4, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add remove path for Tegra audio graph card

Audio graph driver cleans up phandle references of CPU/CODEC nodes in graph_remove() path. As Tegra graph card driver is based on this populate remove callback for it.

Sameer Pujar (2):
ASoC: audio-graph: Export graph_remove() function
ASoC: tegra: Add driver remove() callback

 include/sound/graph_card.h               | 2 ++
 sound/soc/generic/audio-graph-card.c     | 3 ++-
 sound/soc/tegra/tegra_audio_graph_card.c | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 ASoC: audio-graph: Export graph_remove() function

Audio graph based sound card drivers can call graph_remove() function for cleanups during driver removal. To facilitate this export above mentioned function.

Cc Kuninori Morimoto <[email protected]>
---
 include/sound/graph_card.h           | 2 ++
 sound/soc/generic/audio-graph-card.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
include/sound/graph_card.h +2 -0
index bbb5a13..dfa8e56 100644
@@ -13,4 +13,6 @@ int graph_card_probe(struct snd_soc_card *card);
 
 int graph_parse_of(struct asoc_simple_priv *priv, struct device *dev);
 
+int graph_remove(struct platform_device *pdev);
+
 #endif /* __GRAPH_CARD_H */
sound/soc/generic/audio-graph-card.c +2 -1
index 16a04a6..93f6d57f 100644
@@ -744,12 +744,13 @@ static int graph_probe(struct platform_device *pdev)
 	return graph_parse_of(priv, dev);
 }
 
-static int graph_remove(struct platform_device *pdev)
+int graph_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
 	return asoc_simple_clean_reference(card);
 }
+EXPORT_SYMBOL_GPL(graph_remove);
 
 static const struct of_device_id graph_of_match[] = {
 	{ .compatible = "audio-graph-card", },
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Quoted 1 line · Sameer Pujar

+int graph_remove(struct platform_device *pdev);

I think this needs better namespacing if it's going to be exported.

#3 lore raw

Re: Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Quoted 4 lines · Mark Brown
Quoted 1 line · Sameer Pujar

+int graph_remove(struct platform_device *pdev);

I think this needs better namespacing if it's going to be exported.

audio_graph_remove() can be a better choice?

maintainer
#4 lore raw

Re: Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Quoted 8 lines · Sameer Pujar
Quoted 5 lines · Mark Brown
Quoted 1 line · Sameer Pujar

+int graph_remove(struct platform_device *pdev);

I think this needs better namespacing if it's going to be exported.

audio_graph_remove() can be a better choice?

Yeah, that looks reasonable.

#5 lore raw

Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Hi

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+int graph_remove(struct platform_device *pdev);

I think this needs better namespacing if it's going to be exported.

audio_graph_remove() can be a better choice?

Yeah, that looks reasonable.

Nice naming I think.
In such case, update also graph_parse_of() is nice idea for me.

- int graph_parse_of(...)
+ int audio_graph_parse_of()

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#6 lore raw

Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Quoted 6 lines · Kuninori Morimoto

External email: Use caution opening links or attachments

Hi

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+int graph_remove(struct platform_device *pdev);

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

I think this needs better namespacing if it's going to be exported.

audio_graph_remove() can be a better choice?

Yeah, that looks reasonable.

Nice naming I think.
In such case, update also graph_parse_of() is nice idea for me.

- int graph_parse_of(...)
+ int audio_graph_parse_of()

OK, Will update following.

graph_remove()     --> audio_graph_remove()
graph_parse_of()   --> audio_graph_parse_of()
graph_card_probe() --> audio_graph_card_probe()

#7 lore raw

Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

In reply to Sameer Pujar

Hi Sameer

Quoted 6 lines

Audio graph based sound card drivers can call graph_remove() function for cleanups during driver removal. To facilitate this export above mentioned function.

Cc Kuninori Morimoto <[email protected]>

(snip)

sound/soc/generic/audio-graph-card.c static int graph_probe(struct platform_device *pdev) · line 753

Quoted 8 lines
sound/soc/generic/audio-graph-card.c +2 -1
-static int graph_remove(struct platform_device *pdev)
+int graph_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
 	return asoc_simple_clean_reference(card);
 }
+EXPORT_SYMBOL_GPL(graph_remove);

Not a big deal, but
it is just calling asoc_simple_clean_reference() which is already global function.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#8 lore raw

Re: [PATCH 1/2] ASoC: audio-graph: Export graph_remove() function

Quoted 12 lines · Kuninori Morimoto
Quoted 6 lines

Audio graph based sound card drivers can call graph_remove() function for cleanups during driver removal. To facilitate this export above mentioned function.

Cc Kuninori Morimoto <[email protected]>

(snip)

Quoted 5 lines
sound/soc/generic/audio-graph-card.c +1 -1
-static int graph_remove(struct platform_device *pdev)
+int graph_remove(struct platform_device *pdev)
  {
       struct snd_soc_card *card = platform_get_drvdata(pdev);
Quoted 6 lines
Quoted 3 lines
       return asoc_simple_clean_reference(card);

}
+EXPORT_SYMBOL_GPL(graph_remove);

Not a big deal, but
it is just calling asoc_simple_clean_reference() which is already global function.

Yes that is true, but idea was to put dependency on graph_remove() so that any additions/changes here in future will be automatically taken care for Tegra graph card.

#9 lore raw

PATCH 2/2 ASoC: tegra: Add driver remove() callback

In reply to Sameer Pujar

There is cleanup required, related to release of phandles, during driver removal and hence point remove function pointer to graph_remove().

Fixes 202e2f774543 ("ASoC: tegra: Add audio graph based card driver")
---
 sound/soc/tegra/tegra_audio_graph_card.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra_audio_graph_card.c +2 -1
index 9e43f16..f43d302 100644
@@ -2,7 +2,7 @@
 //
 // tegra_audio_graph_card.c - Audio Graph based Tegra Machine Driver
 //
-// Copyright (c) 2020 NVIDIA CORPORATION.  All rights reserved.
+// Copyright (c) 2020-2021 NVIDIA CORPORATION.  All rights reserved.
 
 #include <linux/math64.h>
 #include <linux/module.h>
@@ -243,6 +243,7 @@ static struct platform_driver tegra_audio_graph_card = {
 		.of_match_table = graph_of_tegra_match,
 	},
 	.probe = tegra_audio_graph_probe,
+	.remove = graph_remove,
 };
 module_platform_driver(tegra_audio_graph_card);
 
Signature · 1 line
2.7.4