All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
@ 2017-02-03 10:10 Vincent Abriou
  2017-02-03 10:14 ` Philipp Zabel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vincent Abriou @ 2017-02-03 10:10 UTC (permalink / raw)
  To: alsa-devel
  Cc: Kuninori Morimoto, Arnaud Pouliquen, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Mark Brown, Philipp Zabel, Vincent Abriou

While unregistering the hdmi-codec, the hdmi device list must be
cleaned up. It avoids kernel page fault when registering again the
hdmi-codec.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
---
 sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 90b5948..1ca405e 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
 
 static int hdmi_codec_remove(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
+	struct list_head *pos;
+
+	list_for_each(pos, &hdmi_device_list) {
+		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
+
+		if (tmp->dev == dev->parent) {
+			list_del(pos);
+			break;
+		}
+	}
+
 	snd_soc_unregister_codec(&pdev->dev);
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-03 10:10 [PATCH] ASoc: hdmi-codec: remove HDMI device unregister Vincent Abriou
@ 2017-02-03 10:14 ` Philipp Zabel
  2017-02-03 14:29 ` Lars-Peter Clausen
  2017-02-06  0:09 ` Kuninori Morimoto
  2 siblings, 0 replies; 8+ messages in thread
From: Philipp Zabel @ 2017-02-03 10:14 UTC (permalink / raw)
  To: Vincent Abriou
  Cc: alsa-devel, Kuninori Morimoto, Arnaud Pouliquen, Takashi Iwai,
	Jyri Sarha, Liam Girdwood, Mark Brown

On Fri, 2017-02-03 at 11:10 +0100, Vincent Abriou wrote:
> While unregistering the hdmi-codec, the hdmi device list must be
> cleaned up. It avoids kernel page fault when registering again the
> hdmi-codec.
> 
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> 
> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> ---
>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 90b5948..1ca405e 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>  
>  static int hdmi_codec_remove(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;

Seems unnecessary for a single use.

> +	struct list_head *pos;
> +
> +	list_for_each(pos, &hdmi_device_list) {
> +		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
> +
> +		if (tmp->dev == dev->parent) {
> +			list_del(pos);
> +			break;
> +		}
> +	}
> +
>  	snd_soc_unregister_codec(&pdev->dev);

Or, if dev was available, it should be used here, too.

>  	return 0;
>  }

regards
Philipp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-03 10:10 [PATCH] ASoc: hdmi-codec: remove HDMI device unregister Vincent Abriou
  2017-02-03 10:14 ` Philipp Zabel
@ 2017-02-03 14:29 ` Lars-Peter Clausen
  2017-02-06  0:09 ` Kuninori Morimoto
  2 siblings, 0 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2017-02-03 14:29 UTC (permalink / raw)
  To: Vincent Abriou, alsa-devel
  Cc: Kuninori Morimoto, Arnaud Pouliquen, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Mark Brown, Philipp Zabel

On 02/03/2017 11:10 AM, Vincent Abriou wrote:
> While unregistering the hdmi-codec, the hdmi device list must be
> cleaned up. It avoids kernel page fault when registering again the
> hdmi-codec.
> 
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> 
> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> ---
>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 90b5948..1ca405e 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>  
>  static int hdmi_codec_remove(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
> +	struct list_head *pos;
> +
> +	list_for_each(pos, &hdmi_device_list) {

This needs some kind of lock to protect against concurrent iteration and
modification.

> +		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
> +
> +		if (tmp->dev == dev->parent) {
> +			list_del(pos);
> +			break;
> +		}
> +	}
> +
>  	snd_soc_unregister_codec(&pdev->dev);
>  	return 0;
>  }
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-03 10:10 [PATCH] ASoc: hdmi-codec: remove HDMI device unregister Vincent Abriou
  2017-02-03 10:14 ` Philipp Zabel
  2017-02-03 14:29 ` Lars-Peter Clausen
@ 2017-02-06  0:09 ` Kuninori Morimoto
  2017-02-06  8:35   ` Vincent ABRIOU
  2 siblings, 1 reply; 8+ messages in thread
From: Kuninori Morimoto @ 2017-02-06  0:09 UTC (permalink / raw)
  To: Vincent Abriou
  Cc: alsa-devel, Arnaud Pouliquen, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Mark Brown, Philipp Zabel


Hi Vincent

> While unregistering the hdmi-codec, the hdmi device list must be
> cleaned up. It avoids kernel page fault when registering again the
> hdmi-codec.
> 
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> 
> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> ---

Thank you about this patch.
I added original "hdmi_device_list" to this driver for DW-HDMI device purpose.
But, actually, 1) DW-HDMI binding method was exchanged, 2) I assumed it
will not be exchanged, and 3) this patch was accepted under such
(wrong) assumption.

Thus, this "hdmi_device_list" is no longer needed.
So, I'm planing to remove 9731f82d60166a19af6914f998092bbd1560f783
("ASoC: hdmi-codec: enable multi probe for same device")
and its related patch soon.

Can you agree about it ?

>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 90b5948..1ca405e 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>  
>  static int hdmi_codec_remove(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
> +	struct list_head *pos;
> +
> +	list_for_each(pos, &hdmi_device_list) {
> +		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
> +
> +		if (tmp->dev == dev->parent) {
> +			list_del(pos);
> +			break;
> +		}
> +	}
> +
>  	snd_soc_unregister_codec(&pdev->dev);
>  	return 0;
>  }
> -- 
> 2.7.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-06  0:09 ` Kuninori Morimoto
@ 2017-02-06  8:35   ` Vincent ABRIOU
  2017-02-07  0:07     ` Kuninori Morimoto
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent ABRIOU @ 2017-02-06  8:35 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: alsa-devel, Arnaud POULIQUEN, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Mark Brown, Philipp Zabel

Hi Kuninori,

On 02/06/2017 01:09 AM, Kuninori Morimoto wrote:
>
> Hi Vincent
>
>> While unregistering the hdmi-codec, the hdmi device list must be
>> cleaned up. It avoids kernel page fault when registering again the
>> hdmi-codec.
>>
>> Cc: Liam Girdwood <lgirdwood@gmail.com>
>> Cc: Mark Brown <broonie@kernel.org>
>> Cc: Jaroslav Kysela <perex@perex.cz>
>> Cc: Takashi Iwai <tiwai@suse.com>
>> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>> Cc: Jyri Sarha <jsarha@ti.com>
>> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>>
>> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
>> ---
>
> Thank you about this patch.
> I added original "hdmi_device_list" to this driver for DW-HDMI device purpose.
> But, actually, 1) DW-HDMI binding method was exchanged, 2) I assumed it
> will not be exchanged, and 3) this patch was accepted under such
> (wrong) assumption.
>
> Thus, this "hdmi_device_list" is no longer needed.
> So, I'm planing to remove 9731f82d60166a19af6914f998092bbd1560f783
> ("ASoC: hdmi-codec: enable multi probe for same device")
> and its related patch soon.
>
> Can you agree about it ?
>

I am fine with you proposal.
Can you keep Arnaud Pouliquen and myself in the loop of your new patche 
series so that we are able to test it on our side.

Thanks.
Vincent

>>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
>> index 90b5948..1ca405e 100644
>> --- a/sound/soc/codecs/hdmi-codec.c
>> +++ b/sound/soc/codecs/hdmi-codec.c
>> @@ -479,6 +479,18 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>>
>>  static int hdmi_codec_remove(struct platform_device *pdev)
>>  {
>> +	struct device *dev = &pdev->dev;
>> +	struct list_head *pos;
>> +
>> +	list_for_each(pos, &hdmi_device_list) {
>> +		struct hdmi_device *tmp = pos_to_hdmi_device(pos);
>> +
>> +		if (tmp->dev == dev->parent) {
>> +			list_del(pos);
>> +			break;
>> +		}
>> +	}
>> +
>>  	snd_soc_unregister_codec(&pdev->dev);
>>  	return 0;
>>  }
>> --
>> 2.7.4
>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-06  8:35   ` Vincent ABRIOU
@ 2017-02-07  0:07     ` Kuninori Morimoto
  2017-02-08  2:00       ` Kuninori Morimoto
  0 siblings, 1 reply; 8+ messages in thread
From: Kuninori Morimoto @ 2017-02-07  0:07 UTC (permalink / raw)
  To: Vincent ABRIOU
  Cc: alsa-devel, Arnaud POULIQUEN, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Mark Brown, Philipp Zabel


Hi Vincent

> >> While unregistering the hdmi-codec, the hdmi device list must be
> >> cleaned up. It avoids kernel page fault when registering again the
> >> hdmi-codec.
> >>
> >> Cc: Liam Girdwood <lgirdwood@gmail.com>
> >> Cc: Mark Brown <broonie@kernel.org>
> >> Cc: Jaroslav Kysela <perex@perex.cz>
> >> Cc: Takashi Iwai <tiwai@suse.com>
> >> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >> Cc: Jyri Sarha <jsarha@ti.com>
> >> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> >> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> >>
> >> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> >> ---
> >
> > Thank you about this patch.
> > I added original "hdmi_device_list" to this driver for DW-HDMI device purpose.
> > But, actually, 1) DW-HDMI binding method was exchanged, 2) I assumed it
> > will not be exchanged, and 3) this patch was accepted under such
> > (wrong) assumption.
> >
> > Thus, this "hdmi_device_list" is no longer needed.
> > So, I'm planing to remove 9731f82d60166a19af6914f998092bbd1560f783
> > ("ASoC: hdmi-codec: enable multi probe for same device")
> > and its related patch soon.
> >
> > Can you agree about it ?
> >
> 
> I am fine with you proposal.
> Can you keep Arnaud Pouliquen and myself in the loop of your new patche 
> series so that we are able to test it on our side.

Thanks.
Above remove patch is one of my next patch-set which is
based on my current OF-graph sound card patch-set.
Thus, I'm waiting its result.

But above removing patch itself is just single patch.
So, I will post it if OF-graph patch-set progress was too late.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-07  0:07     ` Kuninori Morimoto
@ 2017-02-08  2:00       ` Kuninori Morimoto
  2017-02-08 10:53         ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Kuninori Morimoto @ 2017-02-08  2:00 UTC (permalink / raw)
  To: Vincent ABRIOU, Mark Brown
  Cc: alsa-devel, Arnaud POULIQUEN, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Philipp Zabel


Hi Mark

> > >> While unregistering the hdmi-codec, the hdmi device list must be
> > >> cleaned up. It avoids kernel page fault when registering again the
> > >> hdmi-codec.
> > >>
> > >> Cc: Liam Girdwood <lgirdwood@gmail.com>
> > >> Cc: Mark Brown <broonie@kernel.org>
> > >> Cc: Jaroslav Kysela <perex@perex.cz>
> > >> Cc: Takashi Iwai <tiwai@suse.com>
> > >> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > >> Cc: Jyri Sarha <jsarha@ti.com>
> > >> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> > >> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> > >>
> > >> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> > >> ---
(snip)
> Thanks.
> Above remove patch is one of my next patch-set which is
> based on my current OF-graph sound card patch-set.
> Thus, I'm waiting its result.
> 
> But above removing patch itself is just single patch.
> So, I will post it if OF-graph patch-set progress was too late.

But... this patch is anyway bugfix patch.
And my remove patch posting will be delayed
(= based on OF-graph which will take long).

Thus, I think applying this patch as bugfix so far,
and remove/cleanup all after that seems reasonable.

I guess this patch got 2 reviews, thus it needs v2 (?)

For basic idea
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoc: hdmi-codec: remove HDMI device unregister
  2017-02-08  2:00       ` Kuninori Morimoto
@ 2017-02-08 10:53         ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2017-02-08 10:53 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: alsa-devel, Arnaud POULIQUEN, Takashi Iwai, Jyri Sarha,
	Liam Girdwood, Philipp Zabel, Vincent ABRIOU


[-- Attachment #1.1: Type: text/plain, Size: 131 bytes --]

On Wed, Feb 08, 2017 at 02:00:22AM +0000, Kuninori Morimoto wrote:

> I guess this patch got 2 reviews, thus it needs v2 (?)

Yes.

[-- 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] 8+ messages in thread

end of thread, other threads:[~2017-02-08 10:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-03 10:10 [PATCH] ASoc: hdmi-codec: remove HDMI device unregister Vincent Abriou
2017-02-03 10:14 ` Philipp Zabel
2017-02-03 14:29 ` Lars-Peter Clausen
2017-02-06  0:09 ` Kuninori Morimoto
2017-02-06  8:35   ` Vincent ABRIOU
2017-02-07  0:07     ` Kuninori Morimoto
2017-02-08  2:00       ` Kuninori Morimoto
2017-02-08 10:53         ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.