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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: codecs: wcd939x-sdw: use devres for regmap allocation

Components are bound inside a new devres group so that any resources
allocated can be released on bind failure and on unbind without
affecting anything else.

Switch to using device managed regmap allocation for consistency while
dropping the misleading comment claiming that devres cannot be used.

Cc: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251201092259.11761-1-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
7a8447fc 3622dc47

+2 -17
+2 -17
sound/soc/codecs/wcd939x-sdw.c
··· 1384 1384 } 1385 1385 1386 1386 if (wcd->is_tx) { 1387 - /* 1388 - * Do not use devres here since devres_release_group() could 1389 - * be called by component_unbind() id the aggregate device 1390 - * fails to bind. 1391 - */ 1392 - wcd->regmap = regmap_init_sdw(pdev, &wcd939x_regmap_config); 1387 + wcd->regmap = devm_regmap_init_sdw(pdev, &wcd939x_regmap_config); 1393 1388 if (IS_ERR(wcd->regmap)) 1394 1389 return dev_err_probe(dev, PTR_ERR(wcd->regmap), 1395 1390 "Regmap init failed\n"); ··· 1395 1400 1396 1401 ret = component_add(dev, &wcd_sdw_component_ops); 1397 1402 if (ret) 1398 - goto err_free_regmap; 1403 + return ret; 1399 1404 1400 1405 /* Set suspended until aggregate device is bind */ 1401 1406 pm_runtime_set_suspended(dev); 1402 1407 1403 1408 return 0; 1404 - 1405 - err_free_regmap: 1406 - if (wcd->regmap) 1407 - regmap_exit(wcd->regmap); 1408 - 1409 - return ret; 1410 1409 } 1411 1410 1412 1411 static int wcd9390_remove(struct sdw_slave *pdev) 1413 1412 { 1414 1413 struct device *dev = &pdev->dev; 1415 - struct wcd939x_sdw_priv *wcd = dev_get_drvdata(dev); 1416 1414 1417 1415 component_del(dev, &wcd_sdw_component_ops); 1418 - 1419 - if (wcd->regmap) 1420 - regmap_exit(wcd->regmap); 1421 1416 1422 1417 return 0; 1423 1418 }