From patchwork Thu Feb 1 18:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 195421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp341683dyb; Thu, 1 Feb 2024 10:06:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIxqIR5a6lk/sXqF87F7CcIvktRT9xv4sEl68qddFbdEEmDFshj6hsB9kxDm7x+QzbL73u X-Received: by 2002:a05:6214:20c3:b0:680:b7fa:15c3 with SMTP id 3-20020a05621420c300b00680b7fa15c3mr7032027qve.50.1706810792798; Thu, 01 Feb 2024 10:06:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706810792; cv=pass; d=google.com; s=arc-20160816; b=pR3D8RyIIcY9ZFJzLgQR11bcORembGCadWqa7q0f/44s89nRteAaoh/3Tf7Z8hMc3N J3unx1dO4f4JikpNN4LphVir7HsA6lWHEEnbZSv5MZF+4HkLhw29ilIjdpvJMogz/wAI iJHinluwGsG8hEt2ltPHuSU2B0MPa9EdpOpqhCep+8C0euSYgD9xW9tgOKeJrl/mz/dm IPiE7ZZ1XfzhEfrr/KBijiWTqEKP8LX5YmmUx0dLhPUaD9qOpPPeF1bKGmU6Q9HobQqY aBYQg+bZlJS9/D+vT0sZUR2EeuhzTbTKL3WNEM3yaK6bhbpsO8TFU/3hswUWHOXBDQuN SibA== 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=5a2BDxvry/mDEJhidMjtTRkucrmFZYMP54rfoZVMxFg=; fh=Sde+W2EausNp7VWAZVenI+h+E+wt7paRRBDr/aFtlRU=; b=avAUpLz9Yl0PmVL/vy8zR8XC1Myg+eru5swLI1OwNJqROtYL1FhrRSC758ZqEyfrQ6 QyYvgLSBwmpx+qI803GHdCQuorb5ICDRfMXFIgrSq39ztfAaukf3kxCGPKH8NlA3aBoc VFVqcn0sP57F33iRmm8F2o4Tvks6ZLOfM9cbI4TK0KZI9QEmC3B6Bp+Tsm8uZEoaaHnZ qzdMhg1e+7xpxdQVqQLj6XC/X/AwV5bTR9fYnqw2CWZi0bUX82n1RJVthqIKuQa5bc9h iem7Jhx/QmnmD9taLPJZ3H4+ea0gVVfiUXqd5dUeE8omuPM1vvHMkON+pcKUhLOhdWOk 8X8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=LAT0O6ph; 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-48642-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48642-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCVttRGgOlUPcNerRQmiTM4XHQa3eYe9ixgssJJc980w3W1XDX7VEWIQWpXjOHS0odH/hb8/9wITQEA2IqmGAzzJINcagQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x21-20020ae9f815000000b007833a6cf962si58399qkh.299.2024.02.01.10.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48642-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=LAT0O6ph; 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-48642-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48642-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 CA05F1C28151 for ; Thu, 1 Feb 2024 18:05:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E52DC12D14A; Thu, 1 Feb 2024 18:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="LAT0O6ph" 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 48A9F84FA4; Thu, 1 Feb 2024 18:01:33 +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=1706810495; cv=none; b=ByVvF3mYrFRPwEmyGV/qGN5YUOCTwchYelrMTLu8x1zBpKw0Rly1gKLiWnLzDMOxAlCeKxXw1UBkSQxW7vQNR0mWpXyJ8ZHRJl1UW9H/1Ty+S19O4iw0C006Hmi3EtqgKhQS1mPtAwSM2XvaAJTo1TPEI2Hx/Kssjdxt6T490bQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706810495; c=relaxed/simple; bh=TcZggvWPAiMNrDjTaYr88pR3WYNyYJDkk6qpMPNTC3Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AF+NYesrpEPb8I5bK615YtX79syjqnRlEAoWCSwj/SRV7aY65f9KRY/RtcNcBe5sn7UC+ROKH2OoySV6u/Zv3JlygEYRiEBvr/DFPCSQc8o2qcWK4553avENiBlaiBq15UDmjNSKs9xJP78TMZlMfhxaj/2DciQEz8W0CFjkMS8= 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=LAT0O6ph; 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 fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 411I1Bdm127784; 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=5a2BDxvry/mDEJhidMjtTRkucrmFZYMP54rfoZVMxFg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LAT0O6phzzkUn0u9DiUYG23YLkVnG+TYgkm1qnbGo9sMFLwGt67eUqB8AlcsG1llS yVaoHeX+MzXx51esdmGSVer69TG9Dkc6nEIvp9WQDn8I9Ipua4LBephbsEfUNnpJKC f5WBxZGqByyxHtY6vjigb4NrNXXZt0YZwMX0cJG8= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 411I1Bll120465 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2024 12:01:11 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) 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:11 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE105.ent.ti.com (157.170.170.35) 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 411I12Gq117221; Thu, 1 Feb 2024 12:01:10 -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 12/18] power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART) Date: Thu, 1 Feb 2024 12:00:56 -0600 Message-ID: <20240201180102.70395-13-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: 1789720834035478964 X-GMAIL-MSGID: 1789720834035478964 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/msm-poweroff.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index bcf04491e7022..c5831c46f69e2 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -13,35 +13,24 @@ #include #include -static void __iomem *msm_ps_hold; -static int deassert_pshold(struct notifier_block *nb, unsigned long action, - void *data) +static int do_msm_poweroff(struct sys_off_data *data) { + void __iomem *msm_ps_hold = data->cb_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); - - return NOTIFY_DONE; -} - static int msm_restart_probe(struct platform_device *pdev) { - msm_ps_hold = devm_platform_ioremap_resource(pdev, 0); + void __iomem *msm_ps_hold = devm_platform_ioremap_resource(pdev, 0); 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, msm_ps_hold); devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_DEFAULT, do_msm_poweroff,