From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AA3BC43603 for ; Thu, 5 Dec 2019 00:50:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 242E42245C for ; Thu, 5 Dec 2019 00:50:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="zW2VOv5T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 242E42245C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C7FDD6B0D6E; Wed, 4 Dec 2019 19:50:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C2E696B0D91; Wed, 4 Dec 2019 19:50:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B450E6B0D92; Wed, 4 Dec 2019 19:50:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 9ED836B0D6E for ; Wed, 4 Dec 2019 19:50:49 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 6924D181AEF31 for ; Thu, 5 Dec 2019 00:50:49 +0000 (UTC) X-FDA: 76229257818.18.mask97_72126aa36a2d X-HE-Tag: mask97_72126aa36a2d X-Filterd-Recvd-Size: 5599 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Dec 2019 00:50:48 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D8B022464; Thu, 5 Dec 2019 00:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575507048; bh=JE5fQsx1bhRp5z2zCjHYJY3E1GUzxpiZIRAHpmuj3Dw=; h=Date:From:To:Subject:In-Reply-To:From; b=zW2VOv5TpBn7ZGHdauAAWqyfxkWzO4zc+/KWiNPU3uyF/+iWG38C5nvAJljkIKiEq fInB0kSmRJ723m76sXfZVNp8I/NE+rIFuh3aLK9khO1acHSjK0Eleur9mZInxk/DxL Vm0rXdjIUsbBK80Wbn76fKcfZ6xlQxR3qPLV8YAc= Date: Wed, 04 Dec 2019 16:50:47 -0800 From: Andrew Morton To: adobriyan@gmail.com, akpm@linux-foundation.org, anna.schumaker@netapp.com, arjan@linux.intel.com, bfields@fieldses.org, chuck.lever@oracle.com, davem@davemloft.net, jlayton@kernel.org, linux-mm@kvack.org, luto@kernel.org, mingo@kernel.org, mm-commits@vger.kernel.org, Nadia.Derbey@bull.net, nixiaoming@huawei.com, paulmck@kernel.org, semen.protsenko@linaro.org, stern@rowland.harvard.edu, tglx@linutronix.de, torvalds@linux-foundation.org, trond.myklebust@hammerspace.com, viresh.kumar@linaro.org, vvs@virtuozzo.com, yuehaibing@huawei.com Subject: [patch 21/86] kernel/notifier.c: remove blocking_notifier_chain_cond_register() Message-ID: <20191205005047.iYBwhVP8J%akpm@linux-foundation.org> In-Reply-To: <20191204164858.fe4ed8886e34ad9f3b34ea00@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Xiaoming Ni Subject: 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 Reviewed-by: Andrew Morton Cc: Alan Stern Cc: Alexey Dobriyan Cc: Andy Lutomirski Cc: Anna Schumaker Cc: Arjan van de Ven Cc: Chuck Lever Cc: David S. Miller Cc: Ingo Molnar Cc: J. Bruce Fields Cc: Jeff Layton Cc: Nadia Derbey Cc: "Paul E. McKenney" Cc: Sam Protsenko Cc: Thomas Gleixner Cc: Trond Myklebust Cc: Vasily Averin Cc: Viresh Kumar Cc: YueHaibing Signed-off-by: Andrew Morton --- include/linux/notifier.h | 4 ---- kernel/notifier.c | 23 ----------------------- net/sunrpc/rpc_pipe.c | 2 +- 3 files changed, 1 insertion(+), 28 deletions(-) --- a/include/linux/notifier.h~kernel-notifierc-remove-blocking_notifier_chain_cond_register +++ a/include/linux/notifier.h @@ -150,10 +150,6 @@ extern int raw_notifier_chain_register(s 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, --- a/kernel/notifier.c~kernel-notifierc-remove-blocking_notifier_chain_cond_register +++ a/kernel/notifier.c @@ -221,29 +221,6 @@ int blocking_notifier_chain_register(str 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 * @n: Entry to remove from notifier chain --- a/net/sunrpc/rpc_pipe.c~kernel-notifierc-remove-blocking_notifier_chain_cond_register +++ a/net/sunrpc/rpc_pipe.c @@ -51,7 +51,7 @@ static BLOCKING_NOTIFIER_HEAD(rpc_pipefs 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); _