doc: nvmem: Update example
authorSean Anderson <sean.anderson@seco.com>
Sun, 20 Feb 2022 15:15:25 +0000 (15:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Feb 2022 17:00:30 +0000 (18:00 +0100)
Update the example to reflect the new API. I have chosen the brcm-nvram
driver since it seems to be simpler than the qfprom driver.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220220151527.17216-12-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/driver-api/nvmem.rst

index 56352ad1b1b094c7ca1041d7542d4da7aecc65e2..e3366322d46c0cc496cfe9b1a6f94a06355de10b 100644 (file)
@@ -43,19 +43,20 @@ nvmem_device pointer.
 
 nvmem_unregister(nvmem) is used to unregister a previously registered provider.
 
-For example, a simple qfprom case::
+For example, a simple nvram case::
 
-  static struct nvmem_config econfig = {
-       .name = "qfprom",
-       .owner = THIS_MODULE,
-  };
-
-  static int qfprom_probe(struct platform_device *pdev)
+  static int brcm_nvram_probe(struct platform_device *pdev)
   {
+       struct nvmem_config config = {
+               .name = "brcm-nvram",
+               .reg_read = brcm_nvram_read,
+       };
        ...
-       econfig.dev = &pdev->dev;
-       nvmem = nvmem_register(&econfig);
-       ...
+       config.dev = &pdev->dev;
+       config.priv = priv;
+       config.size = resource_size(res);
+
+       devm_nvmem_register(&config);
   }
 
 Users of board files can define and register nvmem cells using the