1 From 0991afbe4b1805e7f0113ef10d7c5f0698a739e4 Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Tue, 8 Aug 2023 08:29:29 +0200
4 Subject: [PATCH] nvmem: core: Notify when a new layout is registered
6 Tell listeners a new layout was introduced and is now available.
8 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
9 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
11 drivers/nvmem/core.c | 4 ++++
12 include/linux/nvmem-consumer.h | 2 ++
13 2 files changed, 6 insertions(+)
15 --- a/drivers/nvmem/core.c
16 +++ b/drivers/nvmem/core.c
17 @@ -772,12 +772,16 @@ int __nvmem_layout_register(struct nvmem
18 list_add(&layout->node, &nvmem_layouts);
19 spin_unlock(&nvmem_layout_lock);
21 + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout);
25 EXPORT_SYMBOL_GPL(__nvmem_layout_register);
27 void nvmem_layout_unregister(struct nvmem_layout *layout)
29 + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout);
31 spin_lock(&nvmem_layout_lock);
32 list_del(&layout->node);
33 spin_unlock(&nvmem_layout_lock);
34 --- a/include/linux/nvmem-consumer.h
35 +++ b/include/linux/nvmem-consumer.h
36 @@ -43,6 +43,8 @@ enum {
41 + NVMEM_LAYOUT_REMOVE,
44 #if IS_ENABLED(CONFIG_NVMEM)