From patchwork Thu Feb 1 18:00:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 195415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp338953dyb; Thu, 1 Feb 2024 10:03:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMcT9rfQ0z5Fo8Y93FaBpH4Heto/wOokNrzy/2d0n/IxuLV1F40wCSrHdLySSoxuG1WaCp X-Received: by 2002:aa7:c988:0:b0:55f:327c:d18a with SMTP id c8-20020aa7c988000000b0055f327cd18amr3726338edt.36.1706810607981; Thu, 01 Feb 2024 10:03:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706810607; cv=pass; d=google.com; s=arc-20160816; b=M539ULsUpiGCkeInM47clI1qDfq7XWHNWR1MQMQfeZ/mlmQs5ja9DLSDlk9WE60P9D 1aIf+ISFhfLGQDUTKIpAvhj3IGq6QQrOdjkSpL9PxPogQO1kn0WAJXzSY/VZKkjcxCkJ 7lgI7vcv7cQGAKBV2OAnr0cxn/GbRBgjNyPCY3FI+GBMgXLkPrYEIihynO+x9AGbpbfG xnqDU5A7kJRTObD1DJqoJIEaqiYbXyIXVDmxnNBw9Q5dKcrZDeWKAMtTSVQBExKlgD9O oFKZTqlHMhbfgiOcxF7cOr98bptrN3a64IcY0Y5lhjZ3F6H3xrfsEr/XJ+4NsvAtO42m OPMw== 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=+iboSw0kHr/XQ2F6mUqPjCZdFfbDSD+ql6zjttiLFSU=; fh=bethv8rbEtWQ4Q2GLts2be7F/kQbtt7BOodJqLN+6KE=; b=KjM0p53/CBHlDFPympW7p2yYrwZWVhDmOQOUjJfZvcIhd4paC/ZPVdHcKuq7HLDzY0 oaOFanFv1+w5UgUJWfiNl1aJbGe9K7h3e6/jLYNUt8vL04rkM5R6FU9b9sxL5PZDtpK+ r+MMBsuiEonLVr2mku++6CT2cdPTbBENlnisLtoOuO+/S5uZvN+nZANsgwkfEmIejuja hxoW6RS+xT4u1TRVO3wCXhz5LYi44iy4Yv+Uk7RVpCrFFKXDU/pHt12qs/lsX2hShZRA vYdPrESlvxv7m+zgU8j+ayPQlj7nnjL6rkN/FqsB8enXyjKTI+vs7FB6S5HRmHVlpyzY NMMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tyMEeCj1; 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-48638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48638-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCXCOiDXu5o3amA8aIqa5DCEjDsQ5FJ9Fg6yy0kOSg5oyj8TwxR4pTIQzUdT3IdaRO5QUBqh7AMwER34iLba3KB6IMq6Xw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p21-20020a056402075500b0055ec0610657si30035edy.517.2024.02.01.10.03.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:03:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tyMEeCj1; 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-48638-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48638-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7A9CB1F2155C for ; Thu, 1 Feb 2024 18:03:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EFC7127B70; Thu, 1 Feb 2024 18:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="tyMEeCj1" 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 2202F84047; Thu, 1 Feb 2024 18:01:28 +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=1706810489; cv=none; b=J1SVuDmYl0OAV8gZs5cAR6nIm8hbctOHep1MaS/y7GyyApZDGT/6cg1kX1vishsAPd2Y80vOHeDB38h9lks8yt1QCCFXP2lZ14SlWRCmisgtDlGABLcG+f/M4gMrK5swCsK3TB5jz4A+zzcRCq3zyoeg1qRmDl6+zffvMeEBMU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706810489; c=relaxed/simple; bh=BvK8IwqnEFboy699PAEmSTVNPQ3C5pW/mK6yHdKKsaA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=piitROrhq1hWX02Z9noM1+WJdz+BKzpND+pWpnnE37ah4TtdzDc03vCNVBr4Ht5BlZnqPzOcgVos6x4cdcUgfCyao3yOmNdiksfGro/O3Uo0W20izaFy2n7U8cMshLJc6McGeEjnW36Y6dtNr4CDQjLp5xpAAl69eAwJJQh0nEA= 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=tyMEeCj1; 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 411I1Boq049613; Thu, 1 Feb 2024 12:01:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706810471; bh=+iboSw0kHr/XQ2F6mUqPjCZdFfbDSD+ql6zjttiLFSU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tyMEeCj1fPmmpSRTUugtA3JXIw2BLd3voyMAK+H1o1ri8TRYBSGil6K6Pph/3LzDr 3B8RWfZGnEqLzaYhsUCFx3bbSEwjfowhTX7Ox25oF48u6IdQRLrobxcUM61Dr15ER4 3OwoQL4VnZGHXtznw3cPfhjvTlLE4AywOaqNCDjA= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 411I1BuU004593 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2024 12:01:11 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 1 Feb 2024 12:01:10 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE110.ent.ti.com (157.170.170.21) 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; Thu, 1 Feb 2024 12:01:10 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 411I12Gp117221; Thu, 1 Feb 2024 12:01:09 -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 11/18] power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Thu, 1 Feb 2024 12:00:55 -0600 Message-ID: <20240201180102.70395-12-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201180102.70395-1-afd@ti.com> References: <20240201180102.70395-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: 1789720639707219434 X-GMAIL-MSGID: 1789720639707219434 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..bcf04491e7022 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, + msm_ps_hold); return 0; }