Skip to content

Commit

Permalink
nvmem: core: Notify when a new layout is registered
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
miquelraynal authored and gregkh committed Aug 23, 2023
1 parent b974009 commit eb176cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/nvmem/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions include/linux/nvmem-consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ enum {
NVMEM_REMOVE,
NVMEM_CELL_ADD,
NVMEM_CELL_REMOVE,
NVMEM_LAYOUT_ADD,
NVMEM_LAYOUT_REMOVE,
};

#if IS_ENABLED(CONFIG_NVMEM)
Expand Down

0 comments on commit eb176cb

Please sign in to comment.