Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()

Add enum aic32x4_type to aic32x4_probe() and drop using dev_set_drvdata()
from tlv320aic32x4_{i2c,spi} drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230831194622.87653-2-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Biju Das and committed by
Mark Brown
cac1636e 0bb80ecc

+13 -9
+4 -3
sound/soc/codecs/tlv320aic32x4-i2c.c
··· 23 23 { 24 24 struct regmap *regmap; 25 25 struct regmap_config config; 26 + enum aic32x4_type type; 26 27 27 28 config = aic32x4_regmap_config; 28 29 config.reg_bits = 8; ··· 35 34 const struct of_device_id *oid; 36 35 37 36 oid = of_match_node(aic32x4_of_id, i2c->dev.of_node); 38 - dev_set_drvdata(&i2c->dev, (void *)oid->data); 37 + type = (uintptr_t)oid->data; 39 38 } else { 40 39 const struct i2c_device_id *id; 41 40 42 41 id = i2c_match_id(aic32x4_i2c_id, i2c); 43 - dev_set_drvdata(&i2c->dev, (void *)id->driver_data); 42 + type = id->driver_data; 44 43 } 45 44 46 - return aic32x4_probe(&i2c->dev, regmap); 45 + return aic32x4_probe(&i2c->dev, regmap, type); 47 46 } 48 47 49 48 static void aic32x4_i2c_remove(struct i2c_client *i2c)
+4 -3
sound/soc/codecs/tlv320aic32x4-spi.c
··· 22 22 { 23 23 struct regmap *regmap; 24 24 struct regmap_config config; 25 + enum aic32x4_type type; 25 26 26 27 config = aic32x4_regmap_config; 27 28 config.reg_bits = 7; ··· 36 35 const struct of_device_id *oid; 37 36 38 37 oid = of_match_node(aic32x4_of_id, spi->dev.of_node); 39 - dev_set_drvdata(&spi->dev, (void *)oid->data); 38 + type = (uintptr_t)oid->data; 40 39 } else { 41 40 const struct spi_device_id *id_entry; 42 41 43 42 id_entry = spi_get_device_id(spi); 44 - dev_set_drvdata(&spi->dev, (void *)id_entry->driver_data); 43 + type = id_entry->driver_data; 45 44 } 46 45 47 - return aic32x4_probe(&spi->dev, regmap); 46 + return aic32x4_probe(&spi->dev, regmap, type); 48 47 } 49 48 50 49 static void aic32x4_spi_remove(struct spi_device *spi)
+3 -2
sound/soc/codecs/tlv320aic32x4.c
··· 1333 1333 return ret; 1334 1334 } 1335 1335 1336 - int aic32x4_probe(struct device *dev, struct regmap *regmap) 1336 + int aic32x4_probe(struct device *dev, struct regmap *regmap, 1337 + enum aic32x4_type type) 1337 1338 { 1338 1339 struct aic32x4_priv *aic32x4; 1339 1340 struct aic32x4_pdata *pdata = dev->platform_data; ··· 1350 1349 return -ENOMEM; 1351 1350 1352 1351 aic32x4->dev = dev; 1353 - aic32x4->type = (uintptr_t)dev_get_drvdata(dev); 1352 + aic32x4->type = type; 1354 1353 1355 1354 dev_set_drvdata(dev, aic32x4); 1356 1355
+2 -1
sound/soc/codecs/tlv320aic32x4.h
··· 17 17 }; 18 18 19 19 extern const struct regmap_config aic32x4_regmap_config; 20 - int aic32x4_probe(struct device *dev, struct regmap *regmap); 20 + int aic32x4_probe(struct device *dev, struct regmap *regmap, 21 + enum aic32x4_type type); 21 22 void aic32x4_remove(struct device *dev); 22 23 int aic32x4_register_clocks(struct device *dev, const char *mclk_name); 23 24