Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp407050rdb; Thu, 8 Feb 2024 09:09:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwxnVRJQXERCRvqor3iS9qhB7rBcxH9Kq0Kjdcl8Y5JGrlLMAnKYS3RUWTKjygxGn+YNIBqT+PwD+pNhz+ibK9QkJqgzK4QNOy0ZDuQA== X-Google-Smtp-Source: AGHT+IFOXfyc30uRz/sbd5VWVIACxP7LvTpPrXPSonTrjz1HXdg7j14xOHmTnFPS6vgXbrtMudNa X-Received: by 2002:a05:6402:797:b0:560:8385:811b with SMTP id d23-20020a056402079700b005608385811bmr6668718edy.36.1707412181901; Thu, 08 Feb 2024 09:09:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707412181; cv=pass; d=google.com; s=arc-20160816; b=hKXauOjAJGxl3zrkyk31rAb4iG42toNJSuurQTlB/OINmJIt48h6nVbYr5f39BN4am 6Wct/2Y0MVdFkoNW1o7Sc+E6bQZQJlGdqaZpYt9iscJVPALuGQKrn9NX6YbVbmDP9OYc t/HDOf802Q75km/RnC1umrcMTySZauRKMGXpF1sKDgEYP4VJqs+HS/IZ5ZLXkJsmKvSN eTFB7vQlUJmXxlhjJ/bTD+BIeZX6/Gn725XDcUmsPTuHN3Yw+ptXBymZsydhmHGI4gJi brR9EJ8jyK2SUKbqxEt8s5lwdl6sOkGTfSD3Q/Kb3bt/aZEfiJULE1aWPLooKMySlkm3 nPfg== 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=8uZIueoQZHF0Qt5HM9KiNuuAUF0VupmN9vnl6SN1ujA=; b=jrUckspC4CsOK8s5+xnTj4+OUg3L/xMQHNrVN64m+nk82yzh9e3J/JxQVPL/vkgmKd GzbA7nrI9oKyYH9h1NsOsRPtS6seY3yZKPoxjmzDHfPPrJU2TML8mrmK52VnNOmXnbM/ uZ9z3RauVgSOHQMaCas3h1lnW5b5QGhmFrRBwBUcSvIIY9lNu/6bSuQRHBrQIKzZJlQR 46mHFGiOi/zBeix+mQDJpK3asjUrl4PxAYD2FjGRP1+kYC8juvv84xwfpRoiv+50m8qH 5BLdxkIcgitjS7MrJ7PmvquKUFA6JR7ZDdj0vdXx8iJxlAXrJcPN35DYWBkNBAlJO5Jc UhwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qFBzFgPW; 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-58420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCUeYGAGciagAT+g8CAnNlP46pVMz66NBpE0EJ3nyxaXnA0RT0DpvEncFYjHbRR84ihr3iC1ndJGovmI2jPG6/FffnEUwdb5j37qzKagGg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b2-20020a50ccc2000000b00560b6503b71si1072172edj.45.2024.02.08.09.09.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:09:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58420-linux.lists.archive=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=qFBzFgPW; 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-58420-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58420-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7BBBF1F26546 for ; Thu, 8 Feb 2024 17:09:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D5E3134CEB; Thu, 8 Feb 2024 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="qFBzFgPW" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 022AC1272AD; Thu, 8 Feb 2024 17:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411882; cv=none; b=Dz4QzEKS6P7TDk35Mri/WjN6BWVxSR1ZHc9rfqwEGZW1TrL4Y8E/fPh4EjshnOcBFpKWZQBH1uY6UkxWBOX/fuSQjbGuBZXennW1ge+mW40ES0Ic3lComnw8dtCZc8WqvkAJhbUH0OadmB1br1lrHRoB6j7VaEm3wUvP5iOiS7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411882; c=relaxed/simple; bh=BvK8IwqnEFboy699PAEmSTVNPQ3C5pW/mK6yHdKKsaA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H6j9ISQyL6IxWuxMywPxpw7y+FXtAHIfloenJWmFgXWVEX1OUF3MbOFXumP6mRaT02SBrNBPBYaqU5mVBpXYrOq9e553eYlgxMOihItgKqhBDEHvw5JVLAxr2ae52f5PEtlMpaZJRA6HY+XgpKQ+Vwmay6sVo1C9dTXOLR5DDAA= 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=qFBzFgPW; arc=none smtp.client-ip=198.47.23.248 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418H4KtK018166; Thu, 8 Feb 2024 11:04:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411860; bh=+iboSw0kHr/XQ2F6mUqPjCZdFfbDSD+ql6zjttiLFSU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qFBzFgPWIfVCJ8td3HE0ND29xlvtSztIedeQtMbPqqnEICeRYcXaTDB5n343gjgoR FO11sZucI54YGwpQaPVN1q3UyqL/4Hti5PLDWgLPt8Z9rrrYixAWQkj+RGqHzAXICK rkas9W7QeLxV+qMyMpb3zGYTJ81oco9iTMgQZQjE= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418H4Keg042444 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 11:04:20 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 11:04:20 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE102.ent.ti.com (157.170.170.32) 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, 8 Feb 2024 11:04:20 -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 418H4B6E091006; Thu, 8 Feb 2024 11:04:19 -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 v3 12/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Thu, 8 Feb 2024 11:04:03 -0600 Message-ID: <20240208170410.67975-13-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208170410.67975-1-afd@ti.com> References: <20240208170410.67975-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 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; } -- 2.39.2