* [PATCH 1/1] ASoC: tpa6130a2: Use devm_* APIs
@ 2012-12-07 11:02 Sachin Kamat
2012-12-09 15:17 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Sachin Kamat @ 2012-12-07 11:02 UTC (permalink / raw)
To: alsa-devel; +Cc: patches, tiwai, broonie, Peter Ujfalusi, sachin.kamat, lrg
Converted to use devm_gpio_request and devm_regulator_get APIs.
These are device managed and make error handling and cleanup
a bit simpler.
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested on for-next branch of following tree:
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
---
sound/soc/codecs/tpa6130a2.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 565ff39..ec78073 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -398,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
TPA6130A2_MUTE_L;
if (data->power_gpio >= 0) {
- ret = gpio_request(data->power_gpio, "tpa6130a2 enable");
+ ret = devm_gpio_request(dev, data->power_gpio,
+ "tpa6130a2 enable");
if (ret < 0) {
dev_err(dev, "Failed to request power GPIO (%d)\n",
data->power_gpio);
@@ -419,16 +420,16 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
break;
}
- data->supply = regulator_get(dev, regulator);
+ data->supply = devm_regulator_get(dev, regulator);
if (IS_ERR(data->supply)) {
ret = PTR_ERR(data->supply);
dev_err(dev, "Failed to request supply: %d\n", ret);
- goto err_regulator;
+ goto err_gpio;
}
ret = tpa6130a2_power(1);
if (ret != 0)
- goto err_power;
+ goto err_gpio;
/* Read version */
@@ -440,15 +441,10 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
/* Disable the chip */
ret = tpa6130a2_power(0);
if (ret != 0)
- goto err_power;
+ goto err_gpio;
return 0;
-err_power:
- regulator_put(data->supply);
-err_regulator:
- if (data->power_gpio >= 0)
- gpio_free(data->power_gpio);
err_gpio:
tpa6130a2_client = NULL;
@@ -457,14 +453,7 @@ err_gpio:
static int __devexit tpa6130a2_remove(struct i2c_client *client)
{
- struct tpa6130a2_data *data = i2c_get_clientdata(client);
-
tpa6130a2_power(0);
-
- if (data->power_gpio >= 0)
- gpio_free(data->power_gpio);
-
- regulator_put(data->supply);
tpa6130a2_client = NULL;
return 0;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] ASoC: tpa6130a2: Use devm_* APIs
2012-12-07 11:02 [PATCH 1/1] ASoC: tpa6130a2: Use devm_* APIs Sachin Kamat
@ 2012-12-09 15:17 ` Mark Brown
2012-12-12 11:28 ` Sachin Kamat
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-12-09 15:17 UTC (permalink / raw)
To: Sachin Kamat; +Cc: alsa-devel, patches, tiwai, Peter Ujfalusi, lrg
[-- Attachment #1.1: Type: text/plain, Size: 226 bytes --]
On Fri, Dec 07, 2012 at 04:32:26PM +0530, Sachin Kamat wrote:
> Converted to use devm_gpio_request and devm_regulator_get APIs.
> These are device managed and make error handling and cleanup
> a bit simpler.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] ASoC: tpa6130a2: Use devm_* APIs
2012-12-09 15:17 ` Mark Brown
@ 2012-12-12 11:28 ` Sachin Kamat
2012-12-13 2:33 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Sachin Kamat @ 2012-12-12 11:28 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, patches, tiwai, Peter Ujfalusi, lrg
Hi Mark,
On 9 December 2012 20:47, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Dec 07, 2012 at 04:32:26PM +0530, Sachin Kamat wrote:
>> Converted to use devm_gpio_request and devm_regulator_get APIs.
>> These are device managed and make error handling and cleanup
>> a bit simpler.
>
> Applied, thanks.
This patch is missing in your tree.
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-13 2:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07 11:02 [PATCH 1/1] ASoC: tpa6130a2: Use devm_* APIs Sachin Kamat
2012-12-09 15:17 ` Mark Brown
2012-12-12 11:28 ` Sachin Kamat
2012-12-13 2:33 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).