From patchwork Mon Feb 5 19:44:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 197007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1153727dyb; Mon, 5 Feb 2024 13:25:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJgWcyFL3JzkFA0Etg7S80uYpZsQ43q6vyTPSmc6sJUk32s/Wox1GAq83MUKZSw6CwpArz X-Received: by 2002:a17:906:2b4d:b0:a35:7a4d:8c44 with SMTP id b13-20020a1709062b4d00b00a357a4d8c44mr427297ejg.66.1707168321094; Mon, 05 Feb 2024 13:25:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707168321; cv=pass; d=google.com; s=arc-20160816; b=xFK3Hn4MY531XvNhMYfxHQhiPO/dexeXfc8bEeOEAirtClHRYSiaCN8Al/3qYF7Snv B+K6lU1iFdEE18td0U8Dy3Mibt1CXl6N5jvEOblFDcutSBLNp0pe92rDRzJGS1YY+05C 7NgYzEL5J9aBFzD3REpMlrwrmtRqPtL4lYwMU0kEpzEZ7B9ZQgHtq6GhV7abfzmHRTCk Nxfq984Yc6a4uQM4VmR4IYb5wCT/03HdNvvnOTeF612EUPvQxRvGniNQkO1ElWZ+6NVi S17dIfHc4oWqbd0v36gtK1Bk5/SeubpeC4e3uvqMC3Ol3ZnDC70hvZpMb1rasFf+EsuO VLfw== 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=+PQ1SKdcNogua3exE8LaiE9m7Abl3iw5u4NkR3fmips=; b=juXlSMhv9ISA1nP7RIM81HmVbueO8YJjUCXAU3aSHaUgQYA2O4Zg8SwS2gS6s/kYPV l00l47YkCaTfuZ4ItcBChBPsxY4aY5Fx8ztePp/EsdPUSbbpCMf4kC3pcTwWVHGjuK5v SXMWLIEJOMJ/9TD+sqTTXprqvRq4uGzrG0rz7blCUL5MzJw7O/imDIL5rsxS4NOaJcZV iH5082Sy1trc/N3G0rujYssZEzU68PCn34UBjHGlAsnV01kSGSmSTGdK6/lg9Nd7Y6Oh bFbRHj9rAPfyP2zV32HjwLpupVTrni4632qKZ8Di+XjNRHmkWO1GPgbJUAq0kzCipY8a /EmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R3yRjmdB; 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-53839-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53839-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCVdIVKRwu/Esiq0aDl1e0xL2ult9VAUQbTJLm6sCq6LUa1pX33WGgP8BfL1UJIruEYSCx6PkQf3nJIbh//G+GTASBjvHg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u11-20020a170906068b00b00a36cb0ec095si236187ejb.499.2024.02.05.13.25.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:25:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53839-ouuuleilei=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=R3yRjmdB; 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-53839-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53839-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 824191F292DC for ; Mon, 5 Feb 2024 21:25:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CE206A320; Mon, 5 Feb 2024 19:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="R3yRjmdB" 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 70DF2634FD; Mon, 5 Feb 2024 19:44:57 +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=1707162299; cv=none; b=sd4P5aROgEqyb9xTTZt4dpa47/5mPG0XUYw/2r+IChj9c/i+d8xew4PqOyN7A0bpFebZRH1UEDFhPIML9TEz0o626vJdNvFLJy0Nf9DbB46ByYpQB7OsHxIbYv+Kb9IJxCJXoE2PI0+e9NMq+y/sMTM+DJd76IlXWuaHJTlAnoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162299; c=relaxed/simple; bh=BDfN2nf0FtNoFJUROgfPRBi9IPv21+42h664up+VGOs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NX4HdwcYAigwXLeidm9fDClMKVjNP83J9NuA8xFKxlaC9l6R4bASDJHIzk3JPFk8VlSQyjyCm8INpx1Pl9pwRN+rR67QpxFK52+2eTnlUH1j1XkXOGnDfP2MBz4Kg+bLIY5aaJFJiV/4uQfZdX5DixDauaDnTyX2UNdnJNER0xk= 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=R3yRjmdB; 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 lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 415JijoD016354; Mon, 5 Feb 2024 13:44:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707162285; bh=xaEkc9P0QHDNnu0iRVj8KaMT84h1o2uYT86tsdK5kok=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=R3yRjmdBHuYHapf0HnrgDpEAzbHbM55+XT9JFPsuhyTrYvK1160tynFOJH5lOM/+1 PVlGQbGm7CUNXDrxeGoZiUz+06zibPLpSdYze0/HzKzQ2xEvZipwJAzyyqHkDGuTUM 6gs7bdZ+xTBZGch868y37IEILV1D2trKYjeYa6uM= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 415JijhR003481 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Feb 2024 13:44:45 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 5 Feb 2024 13:44:45 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE101.ent.ti.com (10.64.6.22) 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, 5 Feb 2024 13:44:45 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 415JicQX028467; Mon, 5 Feb 2024 13:44:44 -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 v2 10/19] power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART) Date: Mon, 5 Feb 2024 13:44:28 -0600 Message-ID: <20240205194437.180802-11-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205194437.180802-1-afd@ti.com> References: <20240205194437.180802-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: 1790095729626791030 X-GMAIL-MSGID: 1790095729626791030 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,