diff mbox series

[-next] ASoC: Intel: bytcht_es8316: Set correct platform drvdata in snd_byt_cht_es8316_mc_probe()

Message ID 1547023011-8321-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] ASoC: Intel: bytcht_es8316: Set correct platform drvdata in snd_byt_cht_es8316_mc_probe() | expand

Commit Message

Wei Yongjun Jan. 9, 2019, 8:36 a.m. UTC
The snd_byt_cht_es8316_mc_remove() use the platform drvdata as a type
of 'struct byt_cht_es8316_private', but snd_byt_cht_es8316_mc_probe() set
it to 'struct snd_soc_card', fix to pass correct platform drvdata to
platform_set_drvdata().

Fixes: 0d3e91da0750 ("ASoC: Intel: bytcht_es8316: Add external speaker mux support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Carpenter Jan. 9, 2019, 9:29 a.m. UTC | #1
I think the correct fix is actually this (untested):

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index cdf2061e7613..fa9c4cf97686 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -544,7 +544,8 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 
 static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
 {
-	struct byt_cht_es8316_private *priv = platform_get_drvdata(pdev);
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
 
 	gpiod_put(priv->speaker_en_gpio);
 	return 0;
Hans de Goede Jan. 9, 2019, 9:33 a.m. UTC | #2
Hi,

On 09-01-19 10:29, Dan Carpenter wrote:
> I think the correct fix is actually this (untested):

Right, I'm pretty sure the soc framework depends on dev_get_drvdata
returning the snd_soc_card and I forgot about this when adding
the remove function.

Wei Yongjun, thank you for catching this.

Dan, thank you for the correct version of the patch :)

Dan, can you do an official submission of the correct version of the
patch, with a Reported-by: Wei Yongjun <weiyongjun1@huawei.com>
or shall I submit your version upstream ?

Regards,

Hans


> 
> diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
> index cdf2061e7613..fa9c4cf97686 100644
> --- a/sound/soc/intel/boards/bytcht_es8316.c
> +++ b/sound/soc/intel/boards/bytcht_es8316.c
> @@ -544,7 +544,8 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>   
>   static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
>   {
> -	struct byt_cht_es8316_private *priv = platform_get_drvdata(pdev);
> +	struct snd_soc_card *card = platform_get_drvdata(pdev);
> +	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
>   
>   	gpiod_put(priv->speaker_en_gpio);
>   	return 0;
>
Dan Carpenter Jan. 9, 2019, 9:40 a.m. UTC | #3
On Wed, Jan 09, 2019 at 10:33:38AM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-01-19 10:29, Dan Carpenter wrote:
> > I think the correct fix is actually this (untested):
> 
> Right, I'm pretty sure the soc framework depends on dev_get_drvdata
> returning the snd_soc_card and I forgot about this when adding
> the remove function.
> 
> Wei Yongjun, thank you for catching this.
> 
> Dan, thank you for the correct version of the patch :)
> 
> Dan, can you do an official submission of the correct version of the
> patch, with a Reported-by: Wei Yongjun <weiyongjun1@huawei.com>
> or shall I submit your version upstream ?

Wei can resend and get authorship credit.  I only wrote the patch by
accident because it was easier than explaining.  (Or if you really don't
want to, Wei, then message me and I will do it).

regards,
dan carpenter
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index cdf2061..42111d8 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -538,7 +538,7 @@  static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 		dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
 		return ret;
 	}
-	platform_set_drvdata(pdev, &byt_cht_es8316_card);
+	platform_set_drvdata(pdev, priv);
 	return 0;
 }