Skip to content

Commit

Permalink
nvmem: lpc18xx_otp: Convert to use devm_nvmem_register()
Browse files Browse the repository at this point in the history
Drop all of the code related to .remove hook and make use of
devm_nvmem_register() instead.

Cc: Srinivas Kandagatla <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Carlo Caione <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ndreys authored and gregkh committed Mar 14, 2018
1 parent 90696a4 commit b005b2f
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions drivers/nvmem/lpc18xx_otp.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,9 @@ static int lpc18xx_otp_probe(struct platform_device *pdev)
lpc18xx_otp_nvmem_config.dev = &pdev->dev;
lpc18xx_otp_nvmem_config.priv = otp;

nvmem = nvmem_register(&lpc18xx_otp_nvmem_config);
if (IS_ERR(nvmem))
return PTR_ERR(nvmem);
nvmem = devm_nvmem_register(&pdev->dev, &lpc18xx_otp_nvmem_config);

platform_set_drvdata(pdev, nvmem);

return 0;
}

static int lpc18xx_otp_remove(struct platform_device *pdev)
{
struct nvmem_device *nvmem = platform_get_drvdata(pdev);

return nvmem_unregister(nvmem);
return PTR_ERR_OR_ZERO(nvmem);
}

static const struct of_device_id lpc18xx_otp_dt_ids[] = {
Expand All @@ -110,7 +99,6 @@ MODULE_DEVICE_TABLE(of, lpc18xx_otp_dt_ids);

static struct platform_driver lpc18xx_otp_driver = {
.probe = lpc18xx_otp_probe,
.remove = lpc18xx_otp_remove,
.driver = {
.name = "lpc18xx_otp",
.of_match_table = lpc18xx_otp_dt_ids,
Expand Down

0 comments on commit b005b2f

Please sign in to comment.