2 #include <linux/list.h>
5 int notifier_chain_register(struct notifier_head
*nh
, struct notifier_block
*n
)
7 list_add_tail(&n
->list
, &nh
->blocks
);
11 int notifier_chain_unregister(struct notifier_head
*nh
, struct notifier_block
*n
)
17 int notifier_call_chain(struct notifier_head
*nh
, unsigned long val
, void *v
)
19 struct notifier_block
*entry
;
21 list_for_each_entry(entry
, &nh
->blocks
, list
)
22 entry
->notifier_call(entry
, val
, v
);
28 * Notifier list for code which wants to be called at clock
31 static NOTIFIER_HEAD(clock_notifier_list
);
34 * clock_register_client - register a client notifier
35 * @nb: notifier block to callback on events
37 int clock_register_client(struct notifier_block
*nb
)
39 return notifier_chain_register(&clock_notifier_list
, nb
);
43 * clock_register_client - unregister a client notifier
44 * @nb: notifier block to callback on events
46 int clock_unregister_client(struct notifier_block
*nb
)
48 return notifier_chain_unregister(&clock_notifier_list
, nb
);
52 * clock_register_client - notify clients of clock frequency changes
55 int clock_notifier_call_chain(void)
57 return notifier_call_chain(&clock_notifier_list
, 0, NULL
);