The previous register_notifier() checks whether the function pointer
of callback is already registered or not. But it is wrong because
the different receivers are able to use the same callback function
with the different own user_data.
Change-Id: If9f4a80e91c48f7964f05009dc6ee7098d72f9cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
int register_notifier(enum device_notifier_type status,
int (*func)(void *data, void *user_data), void *user_data)
{
- dd_list *n;
struct device_notifier *notifier;
if (!func) {
return -EINVAL;
}
- FIND_NOTIFIER(device_notifier_list, n, notifier, status, func) {
- _E("function is already registered! [%d, %x]",
- status, func);
- return -EINVAL;
- }
-
notifier = calloc(1, sizeof(struct device_notifier));
if (!notifier) {
_E("Fail to malloc for notifier!");