ASoC: regulator notifier registration should be managed
Regulator notifiers, that were registered during codec driver probing, must be unregistered during driver release, or device managed versions have to be used. This patch fixes codec drivers, that weren't explicitly unregistering notifiers and simplifies those, that did that manually. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:

committed by
Mark Brown

부모
5101355353
커밋
0bb423f2ea
@@ -2801,8 +2801,9 @@ static int wm8996_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
/* This should really be moved into the regulator core */
|
||||
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) {
|
||||
ret = regulator_register_notifier(wm8996->supplies[i].consumer,
|
||||
&wm8996->disable_nb[i]);
|
||||
ret = devm_regulator_register_notifier(
|
||||
wm8996->supplies[i].consumer,
|
||||
&wm8996->disable_nb[i]);
|
||||
if (ret != 0) {
|
||||
dev_err(&i2c->dev,
|
||||
"Failed to register regulator notifier: %d\n",
|
||||
@@ -3071,16 +3072,12 @@ err:
|
||||
static int wm8996_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct wm8996_priv *wm8996 = i2c_get_clientdata(client);
|
||||
int i;
|
||||
|
||||
wm8996_free_gpio(wm8996);
|
||||
if (wm8996->pdata.ldo_ena > 0) {
|
||||
gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
|
||||
gpio_free(wm8996->pdata.ldo_ena);
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
|
||||
regulator_unregister_notifier(wm8996->supplies[i].consumer,
|
||||
&wm8996->disable_nb[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user