Commit 1ca2cf8c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: rt5659: Fix irq leak

Use devm_request_threaded_irq to ensure the irq is freed when unload the
module. The rt5659->i2c is no longer used after this conversion, thus
remove it as well.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d3cb2de2
...@@ -3985,7 +3985,6 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, ...@@ -3985,7 +3985,6 @@ static int rt5659_i2c_probe(struct i2c_client *i2c,
if (rt5659 == NULL) if (rt5659 == NULL)
return -ENOMEM; return -ENOMEM;
rt5659->i2c = i2c;
i2c_set_clientdata(i2c, rt5659); i2c_set_clientdata(i2c, rt5659);
if (pdata) if (pdata)
...@@ -4157,24 +4156,17 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, ...@@ -4157,24 +4156,17 @@ static int rt5659_i2c_probe(struct i2c_client *i2c,
INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work);
if (rt5659->i2c->irq) { if (i2c->irq) {
ret = request_threaded_irq(rt5659->i2c->irq, NULL, rt5659_irq, ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING rt5659_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
| IRQF_ONESHOT, "rt5659", rt5659); | IRQF_ONESHOT, "rt5659", rt5659);
if (ret) if (ret)
dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret);
} }
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659,
rt5659_dai, ARRAY_SIZE(rt5659_dai)); rt5659_dai, ARRAY_SIZE(rt5659_dai));
if (ret) {
if (rt5659->i2c->irq)
free_irq(rt5659->i2c->irq, rt5659);
}
return 0;
} }
static int rt5659_i2c_remove(struct i2c_client *i2c) static int rt5659_i2c_remove(struct i2c_client *i2c)
......
...@@ -1792,7 +1792,6 @@ struct rt5659_priv { ...@@ -1792,7 +1792,6 @@ struct rt5659_priv {
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct rt5659_platform_data pdata; struct rt5659_platform_data pdata;
struct regmap *regmap; struct regmap *regmap;
struct i2c_client *i2c;
struct gpio_desc *gpiod_ldo1_en; struct gpio_desc *gpiod_ldo1_en;
struct gpio_desc *gpiod_reset; struct gpio_desc *gpiod_reset;
struct snd_soc_jack *hs_jack; struct snd_soc_jack *hs_jack;
......
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