From patchwork Mon Feb 12 16:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30193dyb; Mon, 12 Feb 2024 08:33:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPElzajjcgcyWfx4QsTmHYKzdgN284ca/RML+M/qVTf22x/VuUwfT6C95SNYhTLekn9lHGCVbjSeCXWHfIkTMQtLAlMQ== X-Google-Smtp-Source: AGHT+IG6NdsGp+AYXK18/xFj3d97GnvkPT03yxTXb3VYS38ENG9QL5J58IFU+V2C/pWqpWhgJ7sU X-Received: by 2002:a17:906:685a:b0:a38:2ba9:7f8c with SMTP id a26-20020a170906685a00b00a382ba97f8cmr12138ejs.21.1707755631643; Mon, 12 Feb 2024 08:33:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755631; cv=pass; d=google.com; s=arc-20160816; b=RFz9ZarD6DAvDma8LfJdxjFWs8aneoxQFfVXrXQhv/DfeLwHkhQAtzM9KCgT1Xbn+y nQjsrSdkohjBEYNmLwLgdntLVCI+1S33qeodooI1YaCxzN3DWvNSIGdwH0cTfx77US7Q wRtICpI4Bh8heazmztp4EBRFD6Yp45+7/G4lseMGCIvAXyDgEMxF1MGJ/o4aXahd7iWk V6McXHLqJgVp9KaYhxABlKyxILrKLQIiBpyhNqAEsKBptsLo2w+tBFMHPZOw8lEoyky5 7+md31pNFPl6Y8usQ3SfSSWV4aWPRE171tUt4BWtNBfOZRsijHpU40RA8yLN67r9FNRC 2OfQ== 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=5yT8z6101FegqnCWOdNRzgX95I/RK7WLUUhdSWlfyIs=; fh=LVE+MP85Erulp2aJEnQFpYb9RKNKV60PFiyzVudhhCc=; b=i/ketaUCv50wwxk8PVTRZYBY3KUFIazrRLO58JRp7ZchVsuMD/emcQz1bEEBiuHMGD On894GKkeM0iKxBmRStcB1mPsRTa1Ed0iwrEaJDSrMC72ulfb9IbQxi/F6DOkW31LV20 gihlhy8D4DFSDbNODCEjXdeqN+BJCUkhMMS1C9lmL6H4O1RLVYM1NUR70qNf5RxyqgMB 53qSPQzfbLSv6dmOpq4mS32htXQaeRY0Cycvi7iXNTSyz6ovNowL4/gNcR0gUhwnCOv0 ueSVZcjWMfAyDGtJZcTnlVqlR0LKaGRp0+T1sGYvyaUChoe7I8CRRE6Im0da3X1CCtf5 Y+Aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Am0deps7; 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-61970-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61970-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWe4SUwJT49tKrHwrNrcFUSq9XnT1ERd7xmnqXeFcFs7S+wDt8THW36S8wJTTNNpz4+t9iO7AoRVl6QtsqeVPTz4VwR0A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z22-20020a170906669600b00a3bf369b885si323067ejo.918.2024.02.12.08.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:33:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61970-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Am0deps7; 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-61970-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61970-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 461831F22877 for ; Mon, 12 Feb 2024 16:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BF074CE1B; Mon, 12 Feb 2024 16:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Am0deps7" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 9B219405FB; Mon, 12 Feb 2024 16:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755335; cv=none; b=CvXp4EHmHhNI9dJLvpE+NNHh48jkcRyoz8bVUO7zoZPTzLP7gLF2gMrwZgeKl8iJgI3Vl18XVhnXjJcMfnY0z/59aEpi56r4TRgpjF0E3qKCjU+FhsO061rRtkgFxhdVJ09iwNWRh2A0YR8ucdmA3r4upSk3dApdzQwrB9pt/ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755335; c=relaxed/simple; bh=BuseNTmNQHKa6n9amDOBClsdZ0D9LZdzj/CNbNLRzZo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q0U/0Ruudu1i5MPixJs6T7g0YP+/pYJbQGfls7BQ9wN8QtSG8kzptXOfdXy66g+7OXGfOqda8EIveK2HfT1Ji+OuKjpZZPACcUpkaUr8pCVxu64l7xpd3hNJfIQQc7DZznIyi0aVtyMaK6o7QdjhtCFC1RfDwT3DQnXsA1lkxBg= 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=Am0deps7; arc=none smtp.client-ip=198.47.19.142 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 fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSfIH080188; Mon, 12 Feb 2024 10:28:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755321; bh=5yT8z6101FegqnCWOdNRzgX95I/RK7WLUUhdSWlfyIs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Am0deps7rurZ3m5+7WIRYEImqzpVhDUoJtS4qJdjbom+FBqGon9vKaG5loMrRQPUD /ONxtxIPmcCIkon+2rjSHfDetSxan/bXJvaI9IMYM46oaGmnlTNLqGt3rg8M9+j/UX 5g4xHMLYzqC+xPoZqCdBaU+tpjBEnXjyMLNKaelQ= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSfGc024907 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:41 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE108.ent.ti.com (157.170.170.38) 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:41 -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; Mon, 12 Feb 2024 10:28:41 -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 41CGSWR9090688; Mon, 12 Feb 2024 10:28:40 -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 13/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:25 -0600 Message-ID: <20240212162831.67838-14-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: 1790711569452353266 X-GMAIL-MSGID: 1790711569452353266 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/msm-poweroff.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 3bf0ea06c4853..c7eb6dc8e90ae 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -14,23 +14,11 @@ #include static void __iomem *msm_ps_hold; -static int deassert_pshold(struct notifier_block *nb, unsigned long action, - void *data) -{ - writel(0, msm_ps_hold); - mdelay(10000); - - return NOTIFY_DONE; -} - -static struct notifier_block restart_nb = { - .notifier_call = deassert_pshold, - .priority = 128, -}; static int do_msm_poweroff(struct sys_off_data *data) { - deassert_pshold(&restart_nb, 0, NULL); + writel(0, msm_ps_hold); + mdelay(10000); return NOTIFY_DONE; } @@ -41,7 +29,8 @@ static int msm_restart_probe(struct platform_device *pdev) if (IS_ERR(msm_ps_hold)) return PTR_ERR(msm_ps_hold); - register_restart_handler(&restart_nb); + devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, + 128, do_msm_poweroff, NULL); devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_DEFAULT, do_msm_poweroff,