Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353440
b: refs/heads/master
c: 9523fcd
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Jan 11, 2013
1 parent 7e5b0bd commit c111147
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 156db9f3bb3c210cdf905172f6063c90c4a62c3c
refs/heads/master: 9523fcdcc02e812f3a0f4849b3af1b295ad50470
27 changes: 10 additions & 17 deletions trunk/sound/soc/codecs/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,9 +1131,10 @@ static int twl6040_probe(struct snd_soc_codec *codec)
struct platform_device, dev);
int ret = 0;

priv = kzalloc(sizeof(struct twl6040_data), GFP_KERNEL);
priv = devm_kzalloc(codec->dev, sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;

snd_soc_codec_set_drvdata(codec, priv);

priv->codec = codec;
Expand All @@ -1158,25 +1159,23 @@ static int twl6040_probe(struct snd_soc_codec *codec)
priv->plug_irq = platform_get_irq(pdev, 0);
if (priv->plug_irq < 0) {
dev_err(codec->dev, "invalid irq\n");
ret = -EINVAL;
goto work_err;
return -EINVAL;
}

priv->workqueue = alloc_workqueue("twl6040-codec", 0, 0);
if (!priv->workqueue) {
ret = -ENOMEM;
goto work_err;
}
if (!priv->workqueue)
return -ENOMEM;

INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work);

mutex_init(&priv->mutex);

ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler,
IRQF_NO_SUSPEND, "twl6040_irq_plug", codec);
ret = devm_request_threaded_irq(codec->dev, priv->plug_irq, NULL,
twl6040_audio_handler, IRQF_NO_SUSPEND,
"twl6040_irq_plug", codec);
if (ret) {
dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
goto plugirq_err;
goto err;
}

twl6040_init_chip(codec);
Expand All @@ -1186,12 +1185,8 @@ static int twl6040_probe(struct snd_soc_codec *codec)
if (!ret)
return 0;

/* Error path */
free_irq(priv->plug_irq, codec);
plugirq_err:
err:
destroy_workqueue(priv->workqueue);
work_err:
kfree(priv);
return ret;
}

Expand All @@ -1200,9 +1195,7 @@ static int twl6040_remove(struct snd_soc_codec *codec)
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);

twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
free_irq(priv->plug_irq, codec);
destroy_workqueue(priv->workqueue);
kfree(priv);

return 0;
}
Expand Down

0 comments on commit c111147

Please sign in to comment.