Commit 30facd4d authored by Mark Brown's avatar Mark Brown

ASoC: wm8350: Don't use locally allocated codec struct

The core allocates the live copies, we shouldn't try to duplicate it and
were buggy trying to do so as we were using uninitialised data for the
control data.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent e875c1e3
...@@ -60,7 +60,7 @@ struct wm8350_jack_data { ...@@ -60,7 +60,7 @@ struct wm8350_jack_data {
}; };
struct wm8350_data { struct wm8350_data {
struct snd_soc_codec codec; struct wm8350 *wm8350;
struct wm8350_output out1; struct wm8350_output out1;
struct wm8350_output out2; struct wm8350_output out2;
struct wm8350_jack_data hpl; struct wm8350_jack_data hpl;
...@@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv, ...@@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv,
struct wm8350_jack_data *jack, struct wm8350_jack_data *jack,
u16 mask) u16 mask)
{ {
struct wm8350 *wm8350 = priv->codec.control_data; struct wm8350 *wm8350 = priv->wm8350;
u16 reg; u16 reg;
int report; int report;
...@@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work) ...@@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work)
static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
{ {
struct wm8350_data *priv = data; struct wm8350_data *priv = data;
struct wm8350 *wm8350 = priv->codec.control_data; struct wm8350 *wm8350 = priv->wm8350;
struct wm8350_jack_data *jack = NULL; struct wm8350_jack_data *jack = NULL;
switch (irq - wm8350->irq_base) { switch (irq - wm8350->irq_base) {
...@@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect); ...@@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect);
static irqreturn_t wm8350_mic_handler(int irq, void *data) static irqreturn_t wm8350_mic_handler(int irq, void *data)
{ {
struct wm8350_data *priv = data; struct wm8350_data *priv = data;
struct wm8350 *wm8350 = priv->codec.control_data; struct wm8350 *wm8350 = priv->wm8350;
u16 reg; u16 reg;
int report = 0; int report = 0;
...@@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) ...@@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
return -ENOMEM; return -ENOMEM;
snd_soc_codec_set_drvdata(codec, priv); snd_soc_codec_set_drvdata(codec, priv);
priv->wm8350 = wm8350;
for (i = 0; i < ARRAY_SIZE(supply_names); i++) for (i = 0; i < ARRAY_SIZE(supply_names); i++)
priv->supplies[i].supply = supply_names[i]; priv->supplies[i].supply = supply_names[i];
...@@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) ...@@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
if (ret != 0) if (ret != 0)
return ret; return ret;
wm8350->codec.codec = codec;
codec->control_data = wm8350; codec->control_data = wm8350;
/* Put the codec into reset if it wasn't already */ /* Put the codec into reset if it wasn't already */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment