void __init notifier_chain_register(
struct notifier_head *nh, struct notifier_block *n)
{
- struct list_head *chain = &nh->head.chain;
+ struct list_head *chain = &nh->head;
struct notifier_block *nb;
- while ( chain->next != &nh->head.chain )
+ while ( chain->next != &nh->head )
{
nb = list_entry(chain->next, struct notifier_block, chain);
if ( n->priority > nb->priority )
{
int ret = NOTIFY_DONE;
struct list_head *cursor;
- struct notifier_block *nb;
+ struct notifier_block *nb = NULL;
bool_t reverse = !!(val & NOTIFY_REVERSE);
- cursor = &(pcursor && *pcursor ? *pcursor : &nh->head)->chain;
+ cursor = pcursor && *pcursor ? &(*pcursor)->chain : &nh->head;
do {
cursor = reverse ? cursor->prev : cursor->next;
- nb = list_entry(cursor, struct notifier_block, chain);
- if ( cursor == &nh->head.chain )
+ if ( cursor == &nh->head )
break;
+ nb = list_entry(cursor, struct notifier_block, chain);
ret = nb->notifier_call(nb, val, v);
} while ( !(ret & NOTIFY_STOP_MASK) );
};
struct notifier_head {
- struct notifier_block head;
+ struct list_head head;
};
-#define NOTIFIER_INIT(name) { .head.chain = LIST_HEAD_INIT(name.head.chain) }
-
#define NOTIFIER_HEAD(name) \
- struct notifier_head name = NOTIFIER_INIT(name)
+ struct notifier_head name = { .head = LIST_HEAD_INIT(name.head) }
+
void notifier_chain_register(
struct notifier_head *nh, struct notifier_block *nb);