notifier: Return an error when a callback has already been registered
Return -EEXIST when a notifier callback has already been registered on a
notifier chain.
This should avoid any homegrown registration tracking at the callsite
like
https://lore.kernel.org/amd-gfx/
20210512013058.6827-1-mukul.joshi@amd.com
for example.
This version is an alternative of
https://lore.kernel.org/r/
20211108101157.15189-1-bp@alien8.de
which needed to touch every caller not checking the registration
routine's return value.
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/YcSWNdUBS8A2ZB3s@zn.tnic