Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp625137rdb; Fri, 17 Nov 2023 08:11:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5neeoVWL/4Fd+qeRWriQT6JJ2eS14+y7CaUdrh+lIlJToW+DVFFrtpJqOsf0CWuOSdu/u X-Received: by 2002:a05:6a00:240a:b0:6cb:438a:2f56 with SMTP id z10-20020a056a00240a00b006cb438a2f56mr301206pfh.1.1700237504118; Fri, 17 Nov 2023 08:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700237504; cv=none; d=google.com; s=arc-20160816; b=Rsu4uM/6wHag2p6zvkRSYmxMQ15/HXY5eZjL8yUosq6EEmpl67H417knG1m5d9/Dwo 2vQO3A7hGD9dCMdRePOs1peuOIFsTpOL+1jbqzNdy/4CRlxYN9fNZ0izURDDDcYz0Sku ZoTicVnMowIqBt0TJRo0onkif5yphjSiBT7dN5BY7AqWKDxNyz7dQp/MmVl5oYhQIRpc DzqSNYkkvaAkVYQpBbpQ3XkoGCBuVzVOHHTjYTaUS9vrU37PG4ilQiu8o7pTk+3EFXF4 kr/i6PW0AVpGUlNVosCx7Dm0sk+MVztium2wC+u/3dOx+wfRixjKkzsfoPBiz8jPjWZr lMGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F/1wswiAY1XblJ8zuw53T70Bg/cif/hAR2h+0LkgMdM=; fh=ZNXiR1CgqXSElSE++n277vbYyA5ziWtgsjdBgmIqkL4=; b=fInHGh4IkO8J0XsKTvmin+FTrdfXGAFJUOk875cW1rrmy/qLA/8QTagK1c21z7r/fe twKQReqPeSjMcZ1RnWm6YIRvSxv5Okc2PjyrlMZ3lr1KA7vboZ094HEfV8pJb1BHd4JI pr+MN4oNS7l0VPVGLeNVc+siF3oSmT+1TVH4cD9T2lslATccWPJkKrNGyw64LgYeNmsd eDy5bx+guc7nfBtZm+w3t/sTk9xCho+elJE2kpizRKEpHsB8g8vb/5dmFZ6z18g2vF+W lRDmmofRT183uSYBQ14Wm2dsHDaqb+es25NpUBtE9JnITnnT6rMiKZWTNQ7wpW7s6xVt s8+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ouR0t1e0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p13-20020a63fe0d000000b0056949ba3f3fsi2164427pgh.253.2023.11.17.08.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ouR0t1e0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 68F44809F381; Fri, 17 Nov 2023 08:11:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346097AbjKQQK6 (ORCPT + 99 others); Fri, 17 Nov 2023 11:10:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346071AbjKQQKv (ORCPT ); Fri, 17 Nov 2023 11:10:51 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 495D7E6; Fri, 17 Nov 2023 08:10:47 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AHGABSU119464; Fri, 17 Nov 2023 10:10:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1700237411; bh=F/1wswiAY1XblJ8zuw53T70Bg/cif/hAR2h+0LkgMdM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ouR0t1e0TfiMtAgC61F+w3go10AW+3lXJXXwhGuS+F/5saDJt2beKZHMmk+bOLgTd PretWxm9eimqr0NZfLfNDmNkAOocZZmjrM+mQ7PP2ehLF3fvwOM7dagYsjhI8RyklN AicFpZ/E6T6d3YlfIO2i+XVjqkeM+4gBXwCaFcR8= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AHGABaH070305 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Nov 2023 10:10:11 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 17 Nov 2023 10:10:10 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 17 Nov 2023 10:10:10 -0600 Received: from fllv0039.itg.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3AHGA8GK004950; Fri, 17 Nov 2023 10:10:09 -0600 From: Andrew Davis To: Mark Rutland , Lorenzo Pieralisi , Sebastian Reichel , Karol Gugala , Mateusz Holenko , Gabriel Somlo , Joel Stanley , Mark Brown , Orson Zhai , Baolin Wang , Chunyan Zhang , Lee Jones , Dmitry Osipenko CC: , , , , Andrew Davis Subject: [PATCH RFC 1/5] kernel/reboot: Deprecate register_restart_handler() Date: Fri, 17 Nov 2023 10:10:02 -0600 Message-ID: <20231117161006.87734-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231117161006.87734-1-afd@ti.com> References: <20231117161006.87734-1-afd@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 08:11:34 -0800 (PST) There are now two ways to add a handler to the restart_handler_list. Two ways to do the same thing is bad design, so let's unify on using the new method register_sys_off_handler() everywhere. Reasons: * The other register_*_handler functions take a callback, this old API takes a notifier_block, which makes it confusing with the register_*_notifier class of functions. * register_sys_off_handler (new API) is a more unified API allowing for registering several system off types. * The new API has more helpers built around it now, including devm and platform helpers. * The new API manages the struct notifier_block for us, simplifying using code. Mark register_restart_handler() as deprecated to try to warn off new users while we finish converting the remaining existing users. Signed-off-by: Andrew Davis --- include/linux/reboot.h | 8 ++++++-- kernel/reboot.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index c4cc3b89ced1f..c5fff3157b191 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -46,8 +46,12 @@ extern int unregister_reboot_notifier(struct notifier_block *); extern int devm_register_reboot_notifier(struct device *, struct notifier_block *); -extern int register_restart_handler(struct notifier_block *); -extern int unregister_restart_handler(struct notifier_block *); +/* + * This function is deprecated, use register_sys_off_handler(SYS_OFF_MODE_RESTART) + * or devm_register_restart_handler() instead. + */ +extern int __deprecated register_restart_handler(struct notifier_block *); +extern int __deprecated unregister_restart_handler(struct notifier_block *); extern void do_kernel_restart(char *cmd); /* diff --git a/kernel/reboot.c b/kernel/reboot.c index 395a0ea3c7a8a..768ce97829f41 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -189,6 +189,9 @@ static ATOMIC_NOTIFIER_HEAD(restart_handler_list); * * Currently always returns zero, as atomic_notifier_chain_register() * always returns zero. + * + * This function is deprecated, use register_sys_off_handler(SYS_OFF_MODE_RESTART) + * or devm_register_restart_handler() instead. */ int register_restart_handler(struct notifier_block *nb) { -- 2.39.2