diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-08-23 14:27:44 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-23 16:34:02 +0200 |
commit | eb176cb46191f20314878222d8186106e23cb711 (patch) | |
tree | 4783cce9edd41f396258ef52476c879adc734d81 | |
parent | b97400912a08dae6c1c1779a05157f2ab0180f4f (diff) | |
download | lwn-eb176cb46191f20314878222d8186106e23cb711.tar.gz lwn-eb176cb46191f20314878222d8186106e23cb711.zip |
nvmem: core: Notify when a new layout is registered
Tell listeners a new layout was introduced and is now available.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-23-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/nvmem/core.c | 4 | ||||
-rw-r--r-- | include/linux/nvmem-consumer.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 12d05aea0b41..eaf6a3fe8ca6 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -771,12 +771,16 @@ int __nvmem_layout_register(struct nvmem_layout *layout, struct module *owner) list_add(&layout->node, &nvmem_layouts); spin_unlock(&nvmem_layout_lock); + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout); + return 0; } EXPORT_SYMBOL_GPL(__nvmem_layout_register); void nvmem_layout_unregister(struct nvmem_layout *layout) { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout); + spin_lock(&nvmem_layout_lock); list_del(&layout->node); spin_unlock(&nvmem_layout_lock); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 27373024856d..4523e4e83319 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -43,6 +43,8 @@ enum { NVMEM_REMOVE, NVMEM_CELL_ADD, NVMEM_CELL_REMOVE, + NVMEM_LAYOUT_ADD, + NVMEM_LAYOUT_REMOVE, }; #if IS_ENABLED(CONFIG_NVMEM) |