Skip to content

Commit eb176cb

Browse files
miquelraynalgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b974009 commit eb176cb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/nvmem/core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,16 @@ int __nvmem_layout_register(struct nvmem_layout *layout, struct module *owner)
771771
list_add(&layout->node, &nvmem_layouts);
772772
spin_unlock(&nvmem_layout_lock);
773773

774+
blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout);
775+
774776
return 0;
775777
}
776778
EXPORT_SYMBOL_GPL(__nvmem_layout_register);
777779

778780
void nvmem_layout_unregister(struct nvmem_layout *layout)
779781
{
782+
blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout);
783+
780784
spin_lock(&nvmem_layout_lock);
781785
list_del(&layout->node);
782786
spin_unlock(&nvmem_layout_lock);

include/linux/nvmem-consumer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ enum {
4343
NVMEM_REMOVE,
4444
NVMEM_CELL_ADD,
4545
NVMEM_CELL_REMOVE,
46+
NVMEM_LAYOUT_ADD,
47+
NVMEM_LAYOUT_REMOVE,
4648
};
4749

4850
#if IS_ENABLED(CONFIG_NVMEM)

0 commit comments

Comments
 (0)