Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp598576rdb; Tue, 23 Jan 2024 08:50:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuuMAjzzEYSUz6kpshCuuJvv0L13+wAeTakBL1p+UF+9GgRtE54GGhJ9mvSPm6ilea47aT X-Received: by 2002:a05:622a:181b:b0:429:bf1b:2b49 with SMTP id t27-20020a05622a181b00b00429bf1b2b49mr1100607qtc.111.1706028659040; Tue, 23 Jan 2024 08:50:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706028659; cv=pass; d=google.com; s=arc-20160816; b=mLNiDN3mkId8bVJhkfYqaiUn5mEF6nfFQrl/H8/k0kJ4PnIEnvUl0lqsbuPQO9iO/6 E5LyhPBN1Gazjlb29udGx3ayJEXlONYGTKi/lNPnG+g2nDCV8FsgctdOpg7nRf7TKu1K ECGaHVsJkrqjITNJtHrVU75B6+qs+NL5XKbAGFCWiq9vA1i9I/XJyu5UqBN5PkefSP/5 JrGTiSfJKnH7v8XnbhvotCKqwPxn/av3idJqa1MZY+2BKS7nH+H8lSAGhM0YqUKg9q2Q Yfvg3VEJkiXqPRBWW+TB98DeReUSNBRaM8wQ5tWtLxW29diHFFkr+4Fm6ydTxxzzssI6 lJ2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OWBMIAYGqql0wAgfbGIt4Wt5E8wAkJwz4O3xabNraz0=; fh=ZNXiR1CgqXSElSE++n277vbYyA5ziWtgsjdBgmIqkL4=; b=NwQG1XXA5Iidrw/+syIYDsKwB/Es46pqYwatQ12GfpjgChLGHmFdae0AhOv0WLxfur gu0QfrTOZOEUBBxJGBB/v3dkpLXu5S5V/y191WyG/3M+iJGlFbN0Y5nU7v1EnvNNFhM8 xRG3r5ktxo8ecsxUIr1YEngDBM7hbT3NPCQyMfS+Q1/UnqjS6xj5e/L1NM75+C2JpcC/ U6MkoybE2J55mgz1+YCMzI+Hcgkp2A3BkxXpaUhToqyDaX6ZwwVwt+PcvwMaPXpwejKH qapNAEfN2aQLyttLbEwCbh9U/mQ7XglVLvZBf0/lchx56SJLUIve3SuLkMWcXBZH+UVE laiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P32C4sWd; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o5-20020a05622a008500b0042a43d4d5f5si3647950qtw.253.2024.01.23.08.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:50:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P32C4sWd; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 00A2D1C2185D for ; Tue, 23 Jan 2024 16:50:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED13381AA1; Tue, 23 Jan 2024 16:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="P32C4sWd" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B82811EF; Tue, 23 Jan 2024 16:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706028339; cv=none; b=poM5ZNnSRn8aJHJ+diMqDo0pZbidrryQ4fxnbv3uyuHrEr3C9GxGoYpuv83BzXYbH78bB8spTfVlswWx3zFejcpT+B+DCI2B8WzYCqYEe7IfevvPDYquoLzRt/XVHpm7ZU259MdvOd+a8nOWFd8Qi3jSIgOM9jHegQw6H5+gPGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706028339; c=relaxed/simple; bh=6DBAlHKtgTdDUg9RwXBHxBhu0U9svjp5OINIPB4+uQg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RzNS7wW1E3X85BaLZA7eNxXz+rg4Nv/V2ETlYRHi5JLMYNBCfRfZ+lPdj3UQ1cK6RE/jwhBw0S1YOlU+Y6QjEfAWJcFFQZAVFcLB7cSK/4scIOAATyOi4vRFLeowMim09o1Keya2ia0H+23kSqkT11DIhVoUdNxfP9r17DXBxmU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=P32C4sWd; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NGikgJ078231; Tue, 23 Jan 2024 10:44:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706028286; bh=OWBMIAYGqql0wAgfbGIt4Wt5E8wAkJwz4O3xabNraz0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=P32C4sWd5ISMqmsIw2A7ZleCJwNam9rf6cShR4bRElMrHQfghWuwC3/ybPjlCvhY0 3SM7OkUHwJejJHGom32T7hS8W5ECrSCI0pGuQs804DqdvZiknOyRJ/zA2Ux5eqpznw TxdzgfJy3hf+IZ70As4HtYiocvQjrD5LkRaBC7ng= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NGikBi008941 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:44:46 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 23 Jan 2024 10:44:46 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE115.ent.ti.com (10.64.6.36) 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; Tue, 23 Jan 2024 10:44:46 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40NGiiKG022038; Tue, 23 Jan 2024 10:44:45 -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 1/4] kernel/reboot: Deprecate register_restart_handler() Date: Tue, 23 Jan 2024 10:44:40 -0600 Message-ID: <20240123164443.394642-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123164443.394642-1-afd@ti.com> References: <20240123164443.394642-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 abcdde4df6979..186291e9bf3bb 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 22c16e2564cca..38d6933fe892e 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -197,6 +197,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