summaryrefslogtreecommitdiff
path: root/Documentation/driver-api
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2022-02-20 15:15:25 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-21 18:00:30 +0100
commit671aa5a4d493f46ff9720bd2544bae00271be116 (patch)
treef6118d9894a32351d9ff58ece8bf5aec2e79e448 /Documentation/driver-api
parent673d2cc5c1e7d31ee0597f6e18b45dcd257bc5d2 (diff)
doc: nvmem: Update example
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>
Diffstat (limited to 'Documentation/driver-api')
-rw-r--r--Documentation/driver-api/nvmem.rst21
1 files changed, 11 insertions, 10 deletions
diff --git a/Documentation/driver-api/nvmem.rst b/Documentation/driver-api/nvmem.rst
index 56352ad1b1b0..e3366322d46c 100644
--- a/Documentation/driver-api/nvmem.rst
+++ b/Documentation/driver-api/nvmem.rst
@@ -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