Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2557641rdb; Mon, 12 Feb 2024 08:32:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2sAXHTUFv/rXIX17BhioeYzaopomtU2mXmJqLHRY6HnqpM2nai+Qh9bHbrcksr7JrsUOt X-Received: by 2002:a17:90a:43a2:b0:296:15ed:b220 with SMTP id r31-20020a17090a43a200b0029615edb220mr3118418pjg.45.1707755538772; Mon, 12 Feb 2024 08:32:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755538; cv=pass; d=google.com; s=arc-20160816; b=vg63d1FvMXsmEiMAwSq1XYgESarAL8llKWhaZ9ZL83Jy5g1rvEtc+mzPhWXUFDNNrq JCMB1KFXxjqUmYk0HE77l/C76qiXBZx0ho8v5vAL8p7U3jhwrU6N1puour2u3CAOeBHI N6FS4loVaEG0Ut/Tkqrntw1kMUDzlqAjHFCgXYuvT4FX5fK0KpcktWnZfSDy2PcZMXIa gp3i817hne8+bAv1Txj9q4/wRGpz+ehYUy3/utltUVjwmcxcLkeX0/1eMHpda4aJQ5Z5 SXF9H4RKBu79yhkzLwwzxRRoUTCQhaaGPQWSxX8mEc6uvuIHAqgJzVbigluR1osA5Im3 YTng== 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=Sw8/BY48M+8Lu7Des2rmI7EQERXS0vYY7bL6Rz+DR2U=; b=BaTYgu7moGwgmrwEi5OcmOpMYLl9WF/G8WhROMxDmwPvtAcHCpNWw2lWkauFTmN8ic AvVs1+4TxCjdgxq3+jfqQqJKq/p1IWzy10LXHRYqBmJ8miwSJh4CzKIr8r7nuX+GPn2R l8QQKPjYAWzZajQSWBQtctYZ+4sMCM85To1+SvdEnjcYihqkUyQclH+TBRJCPlEYdz51 4pIDaH0OP1t5MoMMahVDBjKxz2qOW0s38RuCJkpYIcEiG0updg2D0Sqwad3TlWc0+DCL 5CRM8MLoLRnQF46xbw3C7yFYNkR/Iz++Kh6DPrqgUhZUv+18z6rKyi0r945gyGTFGBJc eMBA==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-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; AJvYcCV4DycW1HgU8V7O0aWDsJ0oQc0Rb6vzwj5V5IvkbkukkILGsq/8sjtE6Jq2uqo+bBndsa/7YS19BiVqvPJPeLm0tykJ0RZvl5uWA/AxCA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id qa4-20020a17090b4fc400b0029704c6e223si517676pjb.113.2024.02.12.08.32.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BF360B22892 for ; Mon, 12 Feb 2024 16:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B49541775; Mon, 12 Feb 2024 16:28:54 +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 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..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; } -- 2.39.2