Commit 7825dc05 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Lee Jones

mfd: wm8400: Use devm_mfd_add_devices() for mfd_device registration

Use devm_mfd_add_devices() for MFD devices registration and get
rid of .remove callback to remove MFD child-devices. This is done
by managed device framework.

CC: Mark Brown <broonie@kernel.org>
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent f3466e77
...@@ -70,7 +70,7 @@ static int wm8400_register_codec(struct wm8400 *wm8400) ...@@ -70,7 +70,7 @@ static int wm8400_register_codec(struct wm8400 *wm8400)
.pdata_size = sizeof(*wm8400), .pdata_size = sizeof(*wm8400),
}; };
return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0, NULL); return devm_mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0, NULL);
} }
/* /*
...@@ -111,7 +111,7 @@ static int wm8400_init(struct wm8400 *wm8400, ...@@ -111,7 +111,7 @@ static int wm8400_init(struct wm8400 *wm8400,
ret = wm8400_register_codec(wm8400); ret = wm8400_register_codec(wm8400);
if (ret != 0) { if (ret != 0) {
dev_err(wm8400->dev, "Failed to register codec\n"); dev_err(wm8400->dev, "Failed to register codec\n");
goto err_children; return ret;
} }
if (pdata && pdata->platform_init) { if (pdata && pdata->platform_init) {
...@@ -119,21 +119,12 @@ static int wm8400_init(struct wm8400 *wm8400, ...@@ -119,21 +119,12 @@ static int wm8400_init(struct wm8400 *wm8400,
if (ret != 0) { if (ret != 0) {
dev_err(wm8400->dev, "Platform init failed: %d\n", dev_err(wm8400->dev, "Platform init failed: %d\n",
ret); ret);
goto err_children; return ret;
} }
} else } else
dev_warn(wm8400->dev, "No platform initialisation supplied\n"); dev_warn(wm8400->dev, "No platform initialisation supplied\n");
return 0; return 0;
err_children:
mfd_remove_devices(wm8400->dev);
return ret;
}
static void wm8400_release(struct wm8400 *wm8400)
{
mfd_remove_devices(wm8400->dev);
} }
static const struct regmap_config wm8400_regmap_config = { static const struct regmap_config wm8400_regmap_config = {
...@@ -176,15 +167,6 @@ static int wm8400_i2c_probe(struct i2c_client *i2c, ...@@ -176,15 +167,6 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
return wm8400_init(wm8400, dev_get_platdata(&i2c->dev)); return wm8400_init(wm8400, dev_get_platdata(&i2c->dev));
} }
static int wm8400_i2c_remove(struct i2c_client *i2c)
{
struct wm8400 *wm8400 = i2c_get_clientdata(i2c);
wm8400_release(wm8400);
return 0;
}
static const struct i2c_device_id wm8400_i2c_id[] = { static const struct i2c_device_id wm8400_i2c_id[] = {
{ "wm8400", 0 }, { "wm8400", 0 },
{ } { }
...@@ -196,7 +178,6 @@ static struct i2c_driver wm8400_i2c_driver = { ...@@ -196,7 +178,6 @@ static struct i2c_driver wm8400_i2c_driver = {
.name = "WM8400", .name = "WM8400",
}, },
.probe = wm8400_i2c_probe, .probe = wm8400_i2c_probe,
.remove = wm8400_i2c_remove,
.id_table = wm8400_i2c_id, .id_table = wm8400_i2c_id,
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment