From patchwork Mon Feb 12 16:28:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29919dyb; Mon, 12 Feb 2024 08:33:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUnbEPWABckB+WS3wLJG03IIl7LIdWz3uUPdkgKANIVqVhiJGvBWW6Amb3FLCQn62cNU+oJDMNVUeqaZ/5xPfvq19McpA== X-Google-Smtp-Source: AGHT+IG6X+w1/NQRrb9BA1aaxf7/tGpiO/IFsWutfMp3NJ3tUgVz1U527VZ1HrzdjKbU7x3Fi4xH X-Received: by 2002:ac8:5788:0:b0:42c:85f0:4b23 with SMTP id v8-20020ac85788000000b0042c85f04b23mr1602048qta.27.1707755602077; Mon, 12 Feb 2024 08:33:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755602; cv=pass; d=google.com; s=arc-20160816; b=09nrFLWMvTdhxNfryISUxuWotqr6dHp0Rnyh3mMYiZFDBKjUS4q8Yk4GD1xiNNJb8K 3+LY91DHUPBaxIIULPk0YYLh8pqW/hljZtg4pK1EkuQYPGPlG4rGN56N55qzjtasx6Hg i9j/8mD7wlgmk4cP7IMgjx/tBwunHqGT0794x2Zo/s+2KInAhszMhU29l6Vqe6bDsy6V 0GTUeJwAqK0bBpPy6mDxD2gacDBDhbw1DUcqxu4g6Cr4e7h1uwUdsjbV1onAutVfnntA W29bKi2AtS/D0AVWHe4l2X9QG/xoev6IkrpYY6UAOBuw+PiB5GeFDB3lEenvGugnLJR1 t8Rg== 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=xaEkc9P0QHDNnu0iRVj8KaMT84h1o2uYT86tsdK5kok=; fh=oVNq1nLZ3VN9jDx9RxOMfR+vB41qC27JiAdLhR26K9w=; b=CVdSG4yKG0PF8zttcClb6Trw32deB4GuYhhs1uTpRB4NTV8XmgG6aj5YQxeh1qZWdr U1NePs26kxv164dYC/DUoZFO9D5HzRoeQQ9JDYQmfSpBou4ve/git8KL/GFplSVRb6Qs Bz+6uHpvQZ+mCPdODiXtde0VEa+aKWRdpjKtV0Mljmd2ljLbjHiruPwJssTnVPij02mg BaetKn8VVRtTrmQneS/7R3JBuUhnZUfLm6indrPFdXQS2HnYe9t5PazUtu4y2MSYcmne VR/0mApWkvH/ckDIXotz9S5ee0RCL0FB0NNPBiIVecBOZ2OASN2tUGMzNVzh0+RygClE ZQ/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lHv0ZreW; 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-61968-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61968-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCXFJoXGc3dTDqYsmhlF/6HVdIx78tLVVTSTzHauC+S5nGdSUM0k6LQmF7gmTlhGj7N9YOp2mp4OkNlqUxHVEPr0pe+84w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t16-20020a05620a451000b00785d3036723si3637684qkp.182.2024.02.12.08.33.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:33:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61968-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lHv0ZreW; 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-61968-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61968-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 D8E531C217F7 for ; Mon, 12 Feb 2024 16:33:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A572D4C634; Mon, 12 Feb 2024 16:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lHv0ZreW" 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 40B5F3F9F0; Mon, 12 Feb 2024 16:28:51 +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=1707755334; cv=none; b=AbspU/3uWc4Owd7qePvDuHatwT+EFVOO5kTqtzCDTSqpTmN39HkJW3VY+jjX3VHlMEtYGY76mh5ggfyAx2wn2SLEuL/Vs9lJ3WD1uk03uWa0aRJMCwfHpzWjMKkxVnBLM+1hBITdHh07AByKIBix4vhV1eOSvnCACS154ZbZhEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755334; c=relaxed/simple; bh=BDfN2nf0FtNoFJUROgfPRBi9IPv21+42h664up+VGOs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZfLSY09VK2u7Jzup37w0rdcAyNwNEu9lId20m3FhdsUkvTsseff5BlpnRnN6agogfngkoAJ9W3GLe+wHgZgh+x4iOg3rdysPVrpg4E4e0BebN3aXO0NCFIpP5vQJvodz44TEaR0LQM2+SKqpyMX3hTUd4gquKd20AgwfeVVfZAw= 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=lHv0ZreW; 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 lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSdBe068407; Mon, 12 Feb 2024 10:28:39 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755319; bh=xaEkc9P0QHDNnu0iRVj8KaMT84h1o2uYT86tsdK5kok=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lHv0ZreWE3UBn256s2mL98nqw/dZm1ThSWgI/EPkdWnPMwY1+s9y+XpIdM6sqUXAM QxxVBiA3uE9+uBKxtFD7yrxq9AfybhpI54XR7m+sjJavyHKyovbyz9GiAryUwXsvQZ AUMOasH7NyKUvefcOzCc+iwQzTkcMUAMpT4GS2X8= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSdGf024890 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:39 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) 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; Mon, 12 Feb 2024 10:28:39 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE112.ent.ti.com (157.170.170.23) 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:39 -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 41CGSWR6090688; Mon, 12 Feb 2024 10:28:38 -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 10/19] power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:22 -0600 Message-ID: <20240212162831.67838-11-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: 1790711538219552830 X-GMAIL-MSGID: 1790711538219552830 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/rmobile-reset.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/power/reset/rmobile-reset.c b/drivers/power/reset/rmobile-reset.c index 29c17ed2d4de9..80265608c18e0 100644 --- a/drivers/power/reset/rmobile-reset.c +++ b/drivers/power/reset/rmobile-reset.c @@ -21,22 +21,14 @@ static void __iomem *sysc_base2; -static int rmobile_reset_handler(struct notifier_block *this, - unsigned long mode, void *cmd) +static int rmobile_reset_handler(struct sys_off_data *data) { - pr_debug("%s %lu\n", __func__, mode); - /* Let's assume we have acquired the HPB semaphore */ writel(RESCNT2_PRES, sysc_base2 + RESCNT2); return NOTIFY_DONE; } -static struct notifier_block rmobile_reset_nb = { - .notifier_call = rmobile_reset_handler, - .priority = 192, -}; - static int rmobile_reset_probe(struct platform_device *pdev) { int error; @@ -45,7 +37,11 @@ static int rmobile_reset_probe(struct platform_device *pdev) if (IS_ERR(sysc_base2)) return PTR_ERR(sysc_base2); - error = register_restart_handler(&rmobile_reset_nb); + error = devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + rmobile_reset_handler, + NULL); if (error) { dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n", error); @@ -55,11 +51,6 @@ static int rmobile_reset_probe(struct platform_device *pdev) return 0; } -static void rmobile_reset_remove(struct platform_device *pdev) -{ - unregister_restart_handler(&rmobile_reset_nb); -} - static const struct of_device_id rmobile_reset_of_match[] = { { .compatible = "renesas,sysc-rmobile", }, { /* sentinel */ } @@ -68,7 +59,6 @@ MODULE_DEVICE_TABLE(of, rmobile_reset_of_match); static struct platform_driver rmobile_reset_driver = { .probe = rmobile_reset_probe, - .remove_new = rmobile_reset_remove, .driver = { .name = "rmobile_reset", .of_match_table = rmobile_reset_of_match,