All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: atmel_ssc_dai: make module reloadable
@ 2012-11-01 13:18 Alexandre Belloni
       [not found] ` <5093D9CB.7000904@atmel.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2012-11-01 13:18 UTC (permalink / raw)
  To: alsa-devel; +Cc: Alexandre Belloni, Nicolas Ferre

As the platform_devices were never unregistered, it was not possible to
unload/reload the module.

Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net>
---
 sound/soc/atmel/atmel_ssc_dai.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 354341e..07ee57b 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -155,6 +155,8 @@ static struct atmel_ssc_info ssc_info[NUM_SSC_DEVICES] = {
 #endif
 };
 
+static struct platform_device *dma_pdev;
+static struct platform_device *ssc_pdevs[NUM_SSC_DEVICES];
 
 /*
  * SSC interrupt handler.  Passes PDC interrupts to the DMA
@@ -796,6 +798,12 @@ static __devinit int asoc_ssc_probe(struct platform_device *pdev)
 
 static int __devexit asoc_ssc_remove(struct platform_device *pdev)
 {
+	int i;
+	platform_device_unregister(dma_pdev);
+
+	for(i = 0; i < NUM_SSC_DEVICES; i++)
+		platform_device_unregister(ssc_pdevs[i]);
+
 	snd_soc_unregister_dai(&pdev->dev);
 	return 0;
 }
@@ -816,7 +824,6 @@ static struct platform_driver asoc_ssc_driver = {
 int atmel_ssc_set_audio(int ssc_id)
 {
 	struct ssc_device *ssc;
-	static struct platform_device *dma_pdev;
 	struct platform_device *ssc_pdev;
 	int ret;
 
@@ -855,6 +862,8 @@ int atmel_ssc_set_audio(int ssc_id)
 	if (ret < 0)
 		platform_device_put(ssc_pdev);
 
+	ssc_pdevs[ssc_id] = ssc_pdev;
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
-- 
1.7.9.5

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

* Re: [PATCH] ASoC: atmel_ssc_dai: make module reloadable
       [not found] ` <5093D9CB.7000904@atmel.com>
@ 2012-11-05  7:29   ` Bo Shen
  0 siblings, 0 replies; 2+ messages in thread
From: Bo Shen @ 2012-11-05  7:29 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: alsa-devel, Nicolas Ferre

Hi Alexandre Belloni,

On 11/1/2012 14:18, Alexandre Belloni wrote:
> As the platform_devices were never unregistered, it was not possible to
> unload/reload the module.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net>
> ---
>   sound/soc/atmel/atmel_ssc_dai.c |   11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)

NACK - Thanks for your work on atmel ssc dai component. Now, I am 
reworking the atmel ssc dai audio framework. So, some of them will be 
none exist any more.

Thanks again.

Best regards,
Bo Shen

> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index 354341e..07ee57b 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -155,6 +155,8 @@ static struct atmel_ssc_info ssc_info[NUM_SSC_DEVICES] = {
>   #endif
>   };
>
> +static struct platform_device *dma_pdev;
> +static struct platform_device *ssc_pdevs[NUM_SSC_DEVICES];
>
>   /*
>    * SSC interrupt handler.  Passes PDC interrupts to the DMA
> @@ -796,6 +798,12 @@ static __devinit int asoc_ssc_probe(struct platform_device *pdev)
>
>   static int __devexit asoc_ssc_remove(struct platform_device *pdev)
>   {
> +	int i;
> +	platform_device_unregister(dma_pdev);
> +
> +	for(i = 0; i < NUM_SSC_DEVICES; i++)
> +		platform_device_unregister(ssc_pdevs[i]);
> +
>   	snd_soc_unregister_dai(&pdev->dev);
>   	return 0;
>   }
> @@ -816,7 +824,6 @@ static struct platform_driver asoc_ssc_driver = {
>   int atmel_ssc_set_audio(int ssc_id)
>   {
>   	struct ssc_device *ssc;
> -	static struct platform_device *dma_pdev;
>   	struct platform_device *ssc_pdev;
>   	int ret;
>
> @@ -855,6 +862,8 @@ int atmel_ssc_set_audio(int ssc_id)
>   	if (ret < 0)
>   		platform_device_put(ssc_pdev);
>
> +	ssc_pdevs[ssc_id] = ssc_pdev;
> +
>   	return ret;
>   }
>   EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
>

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

end of thread, other threads:[~2012-11-05  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 13:18 [PATCH] ASoC: atmel_ssc_dai: make module reloadable Alexandre Belloni
     [not found] ` <5093D9CB.7000904@atmel.com>
2012-11-05  7:29   ` Bo Shen

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.