Skip to content

Commit 260a267

Browse files
nixiaomingtorvalds
authored andcommitted
kernel/notifier.c: remove blocking_notifier_chain_cond_register()
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: http://lkml.kernel.org/r/1568861888-34045-4-git-send-email-nixiaoming@huawei.com Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Anna Schumaker <anna.schumaker@netapp.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Chuck Lever <chuck.lever@oracle.com> Cc: David S. Miller <davem@davemloft.net> Cc: Ingo Molnar <mingo@kernel.org> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Jeff Layton <jlayton@kernel.org> Cc: Nadia Derbey <Nadia.Derbey@bull.net> Cc: "Paul E. McKenney" <paulmck@kernel.org> Cc: Sam Protsenko <semen.protsenko@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: Vasily Averin <vvs@virtuozzo.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5adaabb commit 260a267

3 files changed

Lines changed: 1 addition & 28 deletions

File tree

‎include/linux/notifier.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
150150
extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
151151
struct notifier_block *nb);
152152

153-
extern int blocking_notifier_chain_cond_register(
154-
struct blocking_notifier_head *nh,
155-
struct notifier_block *nb);
156-
157153
extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
158154
struct notifier_block *nb);
159155
extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,

‎kernel/notifier.c‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -220,29 +220,6 @@ int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
220220
}
221221
EXPORT_SYMBOL_GPL(blocking_notifier_chain_register);
222222

223-
/**
224-
* blocking_notifier_chain_cond_register - Cond add notifier to a blocking notifier chain
225-
* @nh: Pointer to head of the blocking notifier chain
226-
* @n: New entry in notifier chain
227-
*
228-
* Adds a notifier to a blocking notifier chain, only if not already
229-
* present in the chain.
230-
* Must be called in process context.
231-
*
232-
* Currently always returns zero.
233-
*/
234-
int blocking_notifier_chain_cond_register(struct blocking_notifier_head *nh,
235-
struct notifier_block *n)
236-
{
237-
int ret;
238-
239-
down_write(&nh->rwsem);
240-
ret = notifier_chain_register(&nh->head, n);
241-
up_write(&nh->rwsem);
242-
return ret;
243-
}
244-
EXPORT_SYMBOL_GPL(blocking_notifier_chain_cond_register);
245-
246223
/**
247224
* blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain
248225
* @nh: Pointer to head of the blocking notifier chain

‎net/sunrpc/rpc_pipe.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static BLOCKING_NOTIFIER_HEAD(rpc_pipefs_notifier_list);
5151

5252
int rpc_pipefs_notifier_register(struct notifier_block *nb)
5353
{
54-
return blocking_notifier_chain_cond_register(&rpc_pipefs_notifier_list, nb);
54+
return blocking_notifier_chain_register(&rpc_pipefs_notifier_list, nb);
5555
}
5656
EXPORT_SYMBOL_GPL(rpc_pipefs_notifier_register);
5757

0 commit comments

Comments
 (0)