nvmem: sunxi_sid: use devm_nvmem_register()
Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
424d7033ad
Коммит
6eed8dd9a5
|
@ -181,15 +181,13 @@ static int sunxi_sid_probe(struct platform_device *pdev)
|
|||
else
|
||||
econfig.reg_read = sunxi_sid_read;
|
||||
econfig.priv = sid;
|
||||
nvmem = nvmem_register(&econfig);
|
||||
nvmem = devm_nvmem_register(dev, &econfig);
|
||||
if (IS_ERR(nvmem))
|
||||
return PTR_ERR(nvmem);
|
||||
|
||||
randomness = kzalloc(size, GFP_KERNEL);
|
||||
if (!randomness) {
|
||||
ret = -ENOMEM;
|
||||
goto err_unreg_nvmem;
|
||||
}
|
||||
if (!randomness)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
econfig.reg_read(sid, i, &randomness[i], 1);
|
||||
|
@ -200,17 +198,6 @@ static int sunxi_sid_probe(struct platform_device *pdev)
|
|||
platform_set_drvdata(pdev, nvmem);
|
||||
|
||||
return 0;
|
||||
|
||||
err_unreg_nvmem:
|
||||
nvmem_unregister(nvmem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sunxi_sid_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct nvmem_device *nvmem = platform_get_drvdata(pdev);
|
||||
|
||||
return nvmem_unregister(nvmem);
|
||||
}
|
||||
|
||||
static const struct sunxi_sid_cfg sun4i_a10_cfg = {
|
||||
|
@ -243,7 +230,6 @@ MODULE_DEVICE_TABLE(of, sunxi_sid_of_match);
|
|||
|
||||
static struct platform_driver sunxi_sid_driver = {
|
||||
.probe = sunxi_sid_probe,
|
||||
.remove = sunxi_sid_remove,
|
||||
.driver = {
|
||||
.name = "eeprom-sunxi-sid",
|
||||
.of_match_table = sunxi_sid_of_match,
|
||||
|
|
Загрузка…
Ссылка в новой задаче