Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1894809ybi; Thu, 20 Jun 2019 05:49:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhmM+IO2HDYcADDSx5xu0G9mf98g/uV1xRNQ0JRCZlQ6jfQGGdGK3UUvK90qAj194bRFnd X-Received: by 2002:a17:902:2ec5:: with SMTP id r63mr48169029plb.21.1561034964866; Thu, 20 Jun 2019 05:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561034964; cv=none; d=google.com; s=arc-20160816; b=ZkN0CHeWff/p1CIh71eFroShmDi7j3SYVXpzqZCuu5ww3Npw8MULrf+8vy6Cw0PAnX CWXK9FsZWK+8x2ecyFz28LpkgEYbB2tyTKGvBwQU3GKP5NRuv3wCOg6gr0YP2co/wvEU lMnbobVGHpU933Wi1wJdpT9iwgN5QpSJPA7w0gG5scZkXTScYYlsT/7KyvQ2YjR6gc52 FqEQHni86aNFTFq2qTd5xjvn6MwlhgcJa5blgWUc52SriidZDNSMe+1loGizJGfl6XW0 ut/FqdAqCQzTEt8hLX0PVC8NHomRvtix0hUlZHRWkuZSKt1fThhHxdpfOZHKlajg4271 mImg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=CXZC+Z0AxQP5ZOAOTHzl7csXN8GnhVbk4VgzMLgBBHI=; b=LnJu42uha6pT4j3qJkoKdVpSJw+sI++A79bvKpZNcNvdsEhvhNcyOfZsm9KDAkgJO2 jA5jfGKiuH7TtcMhK3yU1r1qoosPsW+xAaOFRr6vA0QIPX8TyYdjVCtBL9tT1Hoy60uw ucFvPaqA4QeMKjOiySZN0hNS/hTwhyWovA6wSsc5ziCo/LV/A55r07aZfmm8XRqJMsqs NQ/x+jqvFuvbDUZX5AoJiiw/gp56xXSuHDPqcWNlIBXRS/HcgXrjU8ZInoDcv22dyJmS Fm4dIy0yybB1o/GVELGm203ueebp3++jBD3qSq7K+a4Kf1Dqt2VsxAXEi76VCdagwkFE Qvvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si17469684plo.308.2019.06.20.05.49.09; Thu, 20 Jun 2019 05:49:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731913AbfFTMs5 (ORCPT + 99 others); Thu, 20 Jun 2019 08:48:57 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:34032 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726931AbfFTMsx (ORCPT ); Thu, 20 Jun 2019 08:48:53 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0CDF27CEA37C667575BA; Thu, 20 Jun 2019 20:48:48 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Thu, 20 Jun 2019 20:48:39 +0800 From: Xiaoming Ni To: , , , , , , , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH v2 3/3] kernel/notifier.c: remove blocking_notifier_chain_cond_register() Date: Thu, 20 Jun 2019 20:48:34 +0800 Message-ID: <1561034914-106990-3-git-send-email-nixiaoming@huawei.com> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1561034914-106990-1-git-send-email-nixiaoming@huawei.com> References: <1561034914-106990-1-git-send-email-nixiaoming@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.174] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() Signed-off-by: Xiaoming Ni --- include/linux/notifier.h | 4 ---- kernel/notifier.c | 23 ----------------------- net/sunrpc/rpc_pipe.c | 2 +- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 0096a05..0189476 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -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, diff --git a/kernel/notifier.c b/kernel/notifier.c index e3d221f..63d7501 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -221,29 +221,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 * @n: Entry to remove from notifier chain diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 126d314..1287f80 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -50,7 +50,7 @@ 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); -- 1.8.5.6