Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332076
b: refs/heads/master
c: b61d6d4
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Sep 11, 2012
1 parent 215dff5 commit 3487a5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 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: 19ace0e97a605042c481c2ea3f7aeb59c0eb54ed
refs/heads/master: b61d6d40323997d9da3b95ecce2570f0b782a07f
46 changes: 19 additions & 27 deletions trunk/sound/soc/codecs/cs4270.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ static struct snd_soc_dai_driver cs4270_dai = {
static int cs4270_probe(struct snd_soc_codec *codec)
{
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
int i, ret;
int ret;

/* Tell ASoC what kind of I/O to use to read the registers. ASoC will
* then do the I2C transactions itself.
Expand Down Expand Up @@ -521,25 +521,8 @@ static int cs4270_probe(struct snd_soc_codec *codec)
return ret;
}

/* get the power supply regulators */
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
cs4270->supplies[i].supply = supply_names[i];

ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
if (ret < 0)
return ret;

ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
if (ret < 0)
goto error_free_regulators;

return 0;

error_free_regulators:
regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);

return ret;
}
Expand All @@ -555,7 +538,6 @@ static int cs4270_remove(struct snd_soc_codec *codec)
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);

regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
regulator_bulk_free(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);

return 0;
};
Expand Down Expand Up @@ -658,7 +640,24 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
{
struct device_node *np = i2c_client->dev.of_node;
struct cs4270_private *cs4270;
int ret;
int ret, i;

cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private),
GFP_KERNEL);
if (!cs4270) {
dev_err(&i2c_client->dev, "could not allocate codec\n");
return -ENOMEM;
}

/* get the power supply regulators */
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
cs4270->supplies[i].supply = supply_names[i];

ret = devm_regulator_bulk_get(&i2c_client->dev,
ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
if (ret < 0)
return ret;

/* See if we have a way to bring the codec out of reset */
if (np) {
Expand Down Expand Up @@ -694,13 +693,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
i2c_client->addr);
dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF);

cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private),
GFP_KERNEL);
if (!cs4270) {
dev_err(&i2c_client->dev, "could not allocate codec\n");
return -ENOMEM;
}

i2c_set_clientdata(i2c_client, cs4270);
cs4270->control_type = SND_SOC_I2C;

Expand Down

0 comments on commit 3487a5d

Please sign in to comment.