summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tlv320aic31xx.c
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2017-11-29 15:32:48 -0600
committerMark Brown <broonie@kernel.org>2017-12-01 13:28:01 +0000
commite88c3881361cee9b778bf4e4ded43da7a0917ce1 (patch)
treed49b1329aa0bb15194d9b76974dd3b9d4a1d4025 /sound/soc/codecs/tlv320aic31xx.c
parent12eb4d66ba2e14072b54f37f5a4a6f70457e228a (diff)
ASoC: tlv320aic31xx: Merge init function into probe
The function aic31xx_device_init() is only called from probe and does nothing that logically shouldn't be in probe, remove this unneeded function call and move its code into probe where it was called. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/tlv320aic31xx.c')
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c55
1 files changed, 22 insertions, 33 deletions
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 07c014501e5e..c84febd991a0 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1302,9 +1302,29 @@ static const struct acpi_device_id aic31xx_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
#endif
-static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
+static int aic31xx_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
{
- int ret, i;
+ struct aic31xx_priv *aic31xx;
+ int i, ret;
+
+ dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
+ id->name, (int)id->driver_data);
+
+ aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
+ if (!aic31xx)
+ return -ENOMEM;
+
+ aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
+ if (IS_ERR(aic31xx->regmap)) {
+ ret = PTR_ERR(aic31xx->regmap);
+ dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
+ ret);
+ return ret;
+ }
+ aic31xx->dev = &i2c->dev;
+
+ aic31xx->pdata.codec_type = id->driver_data;
dev_set_drvdata(aic31xx->dev, aic31xx);
@@ -1336,37 +1356,6 @@ static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
return ret;
}
- return 0;
-}
-
-static int aic31xx_i2c_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
-{
- struct aic31xx_priv *aic31xx;
- int ret;
-
- dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
- id->name, (int) id->driver_data);
-
- aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
- if (!aic31xx)
- return -ENOMEM;
-
- aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
- if (IS_ERR(aic31xx->regmap)) {
- ret = PTR_ERR(aic31xx->regmap);
- dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
- ret);
- return ret;
- }
- aic31xx->dev = &i2c->dev;
-
- aic31xx->pdata.codec_type = id->driver_data;
-
- ret = aic31xx_device_init(aic31xx);
- if (ret)
- return ret;
-
if (aic31xx->pdata.codec_type & DAC31XX_BIT)
return snd_soc_register_codec(&i2c->dev,
&soc_codec_driver_aic31xx,