[PATCH v2 0/3] nvmem: Add support for write-only instances, and clean-up

From: Nicholas Johnson
Date: Mon Mar 02 2020 - 10:42:01 EST


Hello all,

Previous version: https://lkml.org/lkml/2020/2/24/973

Changed since previous version:

- No longer looking to drop read_only flag in this series because of
reasons given by Srinivas. Fixed some areas where I was ignoring the
read_only flag and relying solely on presence of reg_read to determine
if read only.

- Changed nvmem_register() to return failure if group is NULL from
nvmem_sysfs_get_groups().

- Added commit to check for NULL reg_read and reg_write before
dereferencing

- No longer using WARN_ON() because now we can return NULL from
nvmem_sysfs_get_groups() if the inputs are unacceptable. Much nicer.

- No longer providing global writable entry - my bad.

Not changed since previous version despite discussion:

- Not changing read_only flag to world_writable and inverting logic - it
would mean that all of the drivers that do not set the flag now need
to set it and vice-versa. Too much verification for now. I might come
back to these things later, but for now, I realised my eyes should be
on the main goal.

- Not documented kernel-doc of struct nvmem_config. Unclear if this was
required because of WARN_ON() - if so, this no longer applies, as
WARN_ON() was removed. If this is still an issue, please clarify whether
this means Documentation/driver-api/nvmem.rst or just the blurb in
include/linux/nvmem-provider.h, and what specific change needs
documenting.

Nicholas Johnson (3):
nvmem: Add support for write-only instances
nvmem: check for NULL reg_read and reg_write before dereferencing
Revert "thunderbolt: Prevent crash if non-active NVMem file is read"

drivers/nvmem/core.c | 2 ++
drivers/nvmem/nvmem-sysfs.c | 59 +++++++++++++++++++++++++++++++-----
drivers/thunderbolt/switch.c | 7 -----
3 files changed, 54 insertions(+), 14 deletions(-)

--
2.25.1