From patchwork Mon Feb 12 16:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29588dyb; Mon, 12 Feb 2024 08:32:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRsirwCbEncvqduF7kxD5FmNuolb0o7jXNQk2jdEGaO6UoCCxDDRDnrf29ew0EVNTy+m3a X-Received: by 2002:a05:622a:64d:b0:42c:5d16:d3e with SMTP id a13-20020a05622a064d00b0042c5d160d3emr9172339qtb.27.1707755569902; Mon, 12 Feb 2024 08:32:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755569; cv=pass; d=google.com; s=arc-20160816; b=vEr2JpiqKEl5ZdsUNTvatWXJrxitiO4aCzTMbCkCffIxU1F6RHBX0UTmm/LuWAKKRj k8uiQJ0Dc9HAK8cV66iPlsaPuS6/PD7ViJh1Mo544S8PbhclCS0/ggv0fElcJFW6DGk4 gseAoFbMpUJjxvOq+zOgzJki0dqU5qCMQPPtvp7ryrIGfSqT/KrjUFCYyKhiMCQqrGz4 pJvN407kNOUGTPjFQgjcG5/EVD6HIG7O7YCl1gOpy57hHmOgs/BohbdOevgz5P6FeXt5 kpYqAz7UdUVs2n7GFgRhS/RRoclSiwMtAnexrBBDWEohPEK1oAPX5mIYG/63KV1tWAaW RkSA== 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=5B+YzmWAg3uN++2w+PnvUYLCw+7m22OvzK6DPkBQknw=; fh=wTVTENAoUCx1Q3YE4IvmvOTWepwof4tgRMbjmuGBp68=; b=rl31MbWefv5K0mWOBw0aMuln+9fbt576oV9iwA2Wnae4b6hfmClQEtnD4SyhHFLtHE hGN+Ux2e/MLLAyztoOo736pf0aPgGEh1iwt9mTeMQzviGuBoVLOTm6qWjB5sA+Nk4pXN S5EBYsc+oADDjLOyVsQQr4DdGKXgKEWoQ5j2c5X8YAHZHadDeDvkoU5qsLLMAppnRqC8 qnv1milSXfJva5L6zP1K+I4GCDPgZAOeiQ3CTDj7B0CkLjJh8rA+8uO14u/yc1Y2KaQS 2qlEIcR7fSAqTLpR7ZwyEZXn0+ZWAdc5f1/dGboBtsR7pF3LXgHtFcDUyvkElK8CPldl DlPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tGtk41ot; 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-61965-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVmAgcxEMgqzkC3P+5TLvebK/+TIWldt8M7fQeC9AnK6eiKgFKKv4J/IABIpMDN1DlHaoYM/+nW9n5KoOG2rXQfCo5zDw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a13-20020ac8720d000000b0042bf6462ae9si670251qtp.734.2024.02.12.08.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61965-ouuuleilei=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=tGtk41ot; 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-61965-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-ouuuleilei=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 A0DDD1C218B5 for ; Mon, 12 Feb 2024 16:32:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D02A481D7; Mon, 12 Feb 2024 16:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="tGtk41ot" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 4F9E33F8D1; Mon, 12 Feb 2024 16:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755332; cv=none; b=IR9JRf+c7OfOa/vQm4pK5IMfilwi6jhF5DUw/K5fiRi+SW/WTPqxG2VlTNGchPQKBpDKkxm+O1zlc7HiOPFTyd1VPgsI3rvEKC+AsvZenaXFghbYXC/p8gd2pyOIkU2ZJj9l2h2ABefqa7ebbUvxFFCCwJ1S7mffba21Wujim0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755332; c=relaxed/simple; bh=T6MgKnVT95iOniI/Zp8Rc8iYh1eAY+UF/3b/ySVcWnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ejzkWhEWG1UokNRdFw9Gs5c4KHDVLgJZl1YyjsJeh1qR3lCW2A3ZdHs8q8Ip+OKhSpmygecGrYTWUf1/eyBEd8X7DkpAAPs53nwlU59bbQORTMFUpluHIKdFHFG0VRtx7M1SRebyvbgE2vXkT9v0PnMKV/lIBtcX/0iaL3t/Blw= 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=tGtk41ot; arc=none smtp.client-ip=198.47.23.249 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 lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSeu3004167; Mon, 12 Feb 2024 10:28:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755320; bh=5B+YzmWAg3uN++2w+PnvUYLCw+7m22OvzK6DPkBQknw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tGtk41otv6AuRaNDeKFLq2dB7xXoOiidX2/fb8aYvoZDFiiB0X+huFEfmVvdHtONy cFOkZ5nCYfwEzZLKPFg0k2XkyValJFgBWUGlmY4N1EYrgjrm1R8AiNPeNx+1IYEJhq w99Z00SFi1VjsmXRj7SEtnUeHCZwNDfzVcNF06aM= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSeHE008767 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:40 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 12 Feb 2024 10:28:40 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE107.ent.ti.com (157.170.170.37) 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; Mon, 12 Feb 2024 10:28:40 -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 41CGSWR8090688; Mon, 12 Feb 2024 10:28:39 -0600 From: Andrew Davis To: Sebastian Reichel , Manivannan Sadhasivam , Cristian Ciocaltea , Florian Fainelli , Ray Jui , Scott Branden , Bjorn Andersson , Konrad Dybcio , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , Andrew Davis Subject: [PATCH v4 12/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:24 -0600 Message-ID: <20240212162831.67838-13-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212162831.67838-1-afd@ti.com> References: <20240212162831.67838-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790711504616453185 X-GMAIL-MSGID: 1790711504616453185 Use this helper to register sys_off handler. Drivers should move away from setting pm_power_off directly as it only allows for one handler. The new way allows for trying multiple if the first one doesn't work. Signed-off-by: Andrew Davis --- drivers/power/reset/msm-poweroff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index d96d248a6e25b..3bf0ea06c4853 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -28,9 +28,11 @@ static struct notifier_block restart_nb = { .priority = 128, }; -static void do_msm_poweroff(void) +static int do_msm_poweroff(struct sys_off_data *data) { deassert_pshold(&restart_nb, 0, NULL); + + return NOTIFY_DONE; } static int msm_restart_probe(struct platform_device *pdev) @@ -41,7 +43,9 @@ static int msm_restart_probe(struct platform_device *pdev) register_restart_handler(&restart_nb); - pm_power_off = do_msm_poweroff; + devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, do_msm_poweroff, + NULL); return 0; }