Skip to content

Commit 2a433b9

Browse files
author
Peter Ujfalusi
committed
ASoC: twl6040: Do not use wrapper for irq request
The twl6040_request_irq/free_irq inline functions are going to be removed, so replace them with direct calls. The irq number is provided by the core driver via resource. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent 625cbe4 commit 2a433b9

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎sound/soc/codecs/twl6040.c‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct twl6040_jack_data {
7676

7777
/* codec private data */
7878
struct twl6040_data {
79+
int plug_irq;
7980
int codec_powered;
8081
int pll;
8182
int non_lp;
@@ -1527,6 +1528,8 @@ static int twl6040_probe(struct snd_soc_codec *codec)
15271528
{
15281529
struct twl6040_data *priv;
15291530
struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev);
1531+
struct platform_device *pdev = container_of(codec->dev,
1532+
struct platform_device, dev);
15301533
int ret = 0;
15311534

15321535
priv = kzalloc(sizeof(struct twl6040_data), GFP_KERNEL);
@@ -1553,6 +1556,13 @@ static int twl6040_probe(struct snd_soc_codec *codec)
15531556
priv->hf_right_step = 1;
15541557
}
15551558

1559+
priv->plug_irq = platform_get_irq(pdev, 0);
1560+
if (priv->plug_irq < 0) {
1561+
dev_err(codec->dev, "invalid irq\n");
1562+
ret = -EINVAL;
1563+
goto work_err;
1564+
}
1565+
15561566
priv->sysclk_constraints = &hp_constraints;
15571567
priv->workqueue = create_singlethread_workqueue("twl6040-codec");
15581568
if (!priv->workqueue) {
@@ -1581,9 +1591,8 @@ static int twl6040_probe(struct snd_soc_codec *codec)
15811591
INIT_DELAYED_WORK(&priv->hs_delayed_work, twl6040_pga_hs_work);
15821592
INIT_DELAYED_WORK(&priv->hf_delayed_work, twl6040_pga_hf_work);
15831593

1584-
ret = twl6040_request_irq(codec->control_data, TWL6040_IRQ_PLUG,
1585-
twl6040_audio_handler, 0,
1586-
"twl6040_irq_plug", codec);
1594+
ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler,
1595+
0, "twl6040_irq_plug", codec);
15871596
if (ret) {
15881597
dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
15891598
goto plugirq_err;
@@ -1604,7 +1613,7 @@ static int twl6040_probe(struct snd_soc_codec *codec)
16041613
return 0;
16051614

16061615
bias_err:
1607-
twl6040_free_irq(codec->control_data, TWL6040_IRQ_PLUG, codec);
1616+
free_irq(priv->plug_irq, codec);
16081617
plugirq_err:
16091618
destroy_workqueue(priv->hs_workqueue);
16101619
hswq_err:
@@ -1621,7 +1630,7 @@ static int twl6040_remove(struct snd_soc_codec *codec)
16211630
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
16221631

16231632
twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
1624-
twl6040_free_irq(codec->control_data, TWL6040_IRQ_PLUG, codec);
1633+
free_irq(priv->plug_irq, codec);
16251634
destroy_workqueue(priv->workqueue);
16261635
destroy_workqueue(priv->hf_workqueue);
16271636
destroy_workqueue(priv->hs_workqueue);

0 commit comments

Comments
 (0)