Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sean Anderson and committed by
Greg Kroah-Hartman
671aa5a4 673d2cc5

+11 -10
+11 -10
Documentation/driver-api/nvmem.rst
··· 43 43 44 44 nvmem_unregister(nvmem) is used to unregister a previously registered provider. 45 45 46 - For example, a simple qfprom case:: 46 + For example, a simple nvram case:: 47 47 48 - static struct nvmem_config econfig = { 49 - .name = "qfprom", 50 - .owner = THIS_MODULE, 51 - }; 52 - 53 - static int qfprom_probe(struct platform_device *pdev) 48 + static int brcm_nvram_probe(struct platform_device *pdev) 54 49 { 50 + struct nvmem_config config = { 51 + .name = "brcm-nvram", 52 + .reg_read = brcm_nvram_read, 53 + }; 55 54 ... 56 - econfig.dev = &pdev->dev; 57 - nvmem = nvmem_register(&econfig); 58 - ... 55 + config.dev = &pdev->dev; 56 + config.priv = priv; 57 + config.size = resource_size(res); 58 + 59 + devm_nvmem_register(&config); 59 60 } 60 61 61 62 Users of board files can define and register nvmem cells using the