Allow NULL cb_handle in libx52_hotplug_register_callback

This allows the caller to register a callback and forget about it. This
is useful in cases where a particular callback needs to be run
everytime, and there is no point in deregistering it until the
application terminates, at which point `libx52_hotplug_exit` will take
care of the cleanup.
debian-packaging
nirenjan 2020-04-18 01:28:12 -07:00
parent 79b1f930b8
commit cb050f2c30
1 changed files with 4 additions and 1 deletions

View File

@ -328,7 +328,10 @@ int libx52_hotplug_register_callback(libx52_hotplug_service *svc,
/* Insert the node into the callbacks list */
svc->callbacks[i] = hdl;
*cb_handle = hdl;
if (cb_handle != NULL) {
*cb_handle = hdl;
}
return LIBX52_SUCCESS;
}