Skip to content

Commit

Permalink
kernel/notifier.c: remove blocking_notifier_chain_cond_register()
Browse files Browse the repository at this point in the history
blocking_notifier_chain_cond_register() does not consider system_booting
state, which is the only difference between this function and
blocking_notifier_cain_register().  This can be a bug and is a piece of
duplicate code.

Delete blocking_notifier_chain_cond_register()

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Xiaoming Ni <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Anna Schumaker <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: Chuck Lever <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: J. Bruce Fields <[email protected]>
Cc: Jeff Layton <[email protected]>
Cc: Nadia Derbey <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Sam Protsenko <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Trond Myklebust <[email protected]>
Cc: Vasily Averin <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: YueHaibing <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
nixiaoming authored and torvalds committed Dec 5, 2019
1 parent 5adaabb commit 260a267
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions include/linux/notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
struct notifier_block *nb);

extern int blocking_notifier_chain_cond_register(
struct blocking_notifier_head *nh,
struct notifier_block *nb);

extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
struct notifier_block *nb);
extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
Expand Down
23 changes: 0 additions & 23 deletions kernel/notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,29 +220,6 @@ int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
}
EXPORT_SYMBOL_GPL(blocking_notifier_chain_register);

/**
* blocking_notifier_chain_cond_register - Cond add notifier to a blocking notifier chain
* @nh: Pointer to head of the blocking notifier chain
* @n: New entry in notifier chain
*
* Adds a notifier to a blocking notifier chain, only if not already
* present in the chain.
* Must be called in process context.
*
* Currently always returns zero.
*/
int blocking_notifier_chain_cond_register(struct blocking_notifier_head *nh,
struct notifier_block *n)
{
int ret;

down_write(&nh->rwsem);
ret = notifier_chain_register(&nh->head, n);
up_write(&nh->rwsem);
return ret;
}
EXPORT_SYMBOL_GPL(blocking_notifier_chain_cond_register);

/**
* blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain
* @nh: Pointer to head of the blocking notifier chain
Expand Down
2 changes: 1 addition & 1 deletion net/sunrpc/rpc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static BLOCKING_NOTIFIER_HEAD(rpc_pipefs_notifier_list);

int rpc_pipefs_notifier_register(struct notifier_block *nb)
{
return blocking_notifier_chain_cond_register(&rpc_pipefs_notifier_list, nb);
return blocking_notifier_chain_register(&rpc_pipefs_notifier_list, nb);
}
EXPORT_SYMBOL_GPL(rpc_pipefs_notifier_register);

Expand Down

0 comments on commit 260a267

Please sign in to comment.