On 7/15/24 06:54, Rafał Miłecki wrote:
From: Rafał Miłecki <rafal@xxxxxxxxxx>
U-Boot environment variables are stored in a specific format. Actual
data can be placed in various storage sources (MTD, UBI volume, EEPROM,
NVRAM, etc.).
Move all generic (NVMEM device independent) code from NVMEM device
driver to an NVMEM layout driver. Then add a simple NVMEM layout code on
top of it.
This allows using NVMEM layout for parsing U-Boot env data stored in any
kind of NVMEM device.
The old NVMEM glue driver stays in place for handling bindings in the
MTD context. To avoid code duplication it uses exported layout parsing
function. Please note that handling MTD & NVMEM layout bindings may be
refactored in the future.
Signed-off-by: Rafał Miłecki <rafal@xxxxxxxxxx>
Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
This change was originally sent (and approved by Miquel) as a
[PATCH V3 6/6] nvmem: layouts: add U-Boot env layout
I just adjusted it to the approved binding and updated commit message.
I kept Miquel's Reviewed-by tag due to minimal changes.
I've successfully tested this code using it in both ways: as NVMEM
device driver & NVMEM layout.
MAINTAINERS | 1 +
drivers/nvmem/Kconfig | 3 +-
drivers/nvmem/layouts/Kconfig | 11 ++
drivers/nvmem/layouts/Makefile | 1 +
drivers/nvmem/layouts/u-boot-env.c | 203 +++++++++++++++++++++++++++++
drivers/nvmem/layouts/u-boot-env.h | 15 +++
drivers/nvmem/u-boot-env.c | 158 +---------------------
7 files changed, 234 insertions(+), 158 deletions(-)
create mode 100644 drivers/nvmem/layouts/u-boot-env.c
create mode 100644 drivers/nvmem/layouts/u-boot-env.h
...
+module_nvmem_layout_driver(u_boot_env_layout);
+
+MODULE_AUTHOR("Rafał Miłecki");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, u_boot_env_of_match_table);
Is this missing a MODULE_DESCRIPTION()?
Since commit 1fffe7a34c89 ("script: modpost: emit a warning when the
description is missing") a module without a MODULE_DESCRIPTION() will
result in a warning with make W=1.
I'll hopefully have all existing warnings fixed in 6.11 so please avoid
adding new ones :)
/jeff