From patchwork Tue Jan 23 16:44:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 191089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp475026dyi; Tue, 23 Jan 2024 09:06:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIKkQvovd9+Pk2inbWXfjm9b/PSJIgFIPcUluz+vcFiG4vtgWpIleP52MQ++j+5+PVGP8z X-Received: by 2002:a17:906:3914:b0:a28:825d:99ab with SMTP id f20-20020a170906391400b00a28825d99abmr134167eje.19.1706029608869; Tue, 23 Jan 2024 09:06:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706029608; cv=pass; d=google.com; s=arc-20160816; b=ijCDacTp0QAN0Bm4mqSGR2u/FKQScfGrnWeadwngJm0IjgooTGpXEXQBDA1Q078C0s pwZ/mbaYNRj5oROjc4Oq7qk+gSf2HPZhv/gOfr2p6hzE+w/yT8/H7OVt23hAegVXNWVk MaQeODKZkobvqrDGBpmuapeo1DFv3ybawtLy/xEZXopYPfY2sIU9uZBz/Wl5uvF/rogz LEKCpmi8izd/d+hs9DuQ2wi3d9RSdeW9tRPWcyZof/hOtwY+rpkcdzERPkQPMNOMg1J7 L/psplCPREnArGaema1NNFPEkXq31EhMoHwLa9aof+hRWJk89Gxv/l0nODXeZCzDPij1 olIA== 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=Cq6GMsgXSjuAInYO12ihGfj7M9z8z7eyXvTjfe/OzM0=; fh=ZNXiR1CgqXSElSE++n277vbYyA5ziWtgsjdBgmIqkL4=; b=Rj4Jp6Mnh72z9PWY1HAlE4tpCKPxgNE8f3QepPAZsgAhHs2H2AAMwf1erSmwINEl82 ey46RwmSq1XmIHaoonWn3bDsYf+owtsC+B8EsSrguJc7xvK0+bZuVl1SyycYo2rjhdS7 T7pHK7MC/wgDutZjZRIKBh+8NqkHUJGeKQhlMzLnl9Dx/lDg2Shi3tPPmcrJlCXn/cuD 2EP2AMwCUyncuWr7g4hiqgmBntrRKxYpbgL2zIAff/h5QWO9EVCKzc9SLc00T0uoWjdX j7UxUSe5cyBJYet8TCLKwab+QYBgJDU5qgV7VkCRlWgIgaeuWG43AJt8PL7UHvFGAUCy eQsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="NmnmDc/D"; 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-35695-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35695-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c19-20020a170906d19300b00a30e8b392c4si321004ejz.104.2024.01.23.09.06.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35695-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="NmnmDc/D"; 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-35695-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35695-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 B7A091F2F151 for ; Tue, 23 Jan 2024 16:49:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AC1380038; Tue, 23 Jan 2024 16:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="NmnmDc/D" 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 42E147F7DC; Tue, 23 Jan 2024 16:45:11 +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=1706028317; cv=none; b=c3Cr298QWxiHVHoIUEB3fuYd4xppwO8I8HpTVvVKt0ywEyfqRN2u87frysXJt1FtLRqt02C6gXODKPMnKtWhcGOibe5Wf3BghEQaVX9bHpfeepmh70wWLU0KsOC2kgGdXWOxCGIpXo+sAOkNF5EwNvK6Mq9yrteE56Yi90QLZvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706028317; c=relaxed/simple; bh=pKm6K3qlmS/hE0NSSbEJSQGcka7r+08244krdMyxaY8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OBgd1BSAhwcmSUUExKV0fsHmaUUc8QPQ98vxQ3PdJVOD+e8CkF74gYflPhlAkg184ADUF0Csx85tTrEo4xIRWChp/8KZXp5I9ZsgVpTgFODWbux3U3DvAkYlrxALpbXgvq67b5dnhc53rZhMNveT2B9fzKlFrShS4UCBoMo5hYo= 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=NmnmDc/D; 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 40NGilHP095275; Tue, 23 Jan 2024 10:44:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706028287; bh=Cq6GMsgXSjuAInYO12ihGfj7M9z8z7eyXvTjfe/OzM0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NmnmDc/DpHx4WzsmFPvkU2GJqmp0uvfBwhSGcsB8nurUq9nGOGbmaKA90daEp/UPL BkaHWG55C1/uB//MFQIbdGR7TuOIrhQLu6KL9wlXn9ZYNffrkb1zmu0q/C6HWN7/iH sr2fqbNI3ty86u7BGscQYEqSFnPaCiG9c9PzLAzw= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NGilKm127516 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:44:47 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 23 Jan 2024 10:44:46 -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; Tue, 23 Jan 2024 10:44:46 -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 40NGiiKH022038; Tue, 23 Jan 2024 10:44:46 -0600 From: Andrew Davis To: Mark Rutland , Lorenzo Pieralisi , Sebastian Reichel , Karol Gugala , Mateusz Holenko , Gabriel Somlo , Joel Stanley , Mark Brown , Orson Zhai , Baolin Wang , Chunyan Zhang , Lee Jones , Dmitry Osipenko CC: , , , , Andrew Davis Subject: [PATCH 2/4] drivers/soc/litex: Use devm_register_restart_handler() Date: Tue, 23 Jan 2024 10:44:41 -0600 Message-ID: <20240123164443.394642-3-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123164443.394642-1-afd@ti.com> References: <20240123164443.394642-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: 1788901702827344376 X-GMAIL-MSGID: 1788901702827344376 Use device life-cycle managed register function to simplify probe error path and eliminate need for explicit remove function. Signed-off-by: Andrew Davis Reviewed-by: Gabriel Somlo --- drivers/soc/litex/litex_soc_ctrl.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/soc/litex/litex_soc_ctrl.c b/drivers/soc/litex/litex_soc_ctrl.c index 10813299aa106..7a0096d93c73d 100644 --- a/drivers/soc/litex/litex_soc_ctrl.c +++ b/drivers/soc/litex/litex_soc_ctrl.c @@ -69,14 +69,11 @@ static int litex_check_csr_access(void __iomem *reg_addr) struct litex_soc_ctrl_device { void __iomem *base; - struct notifier_block reset_nb; }; -static int litex_reset_handler(struct notifier_block *this, unsigned long mode, - void *cmd) +static int litex_reset_handler(struct sys_off_data *data) { - struct litex_soc_ctrl_device *soc_ctrl_dev = - container_of(this, struct litex_soc_ctrl_device, reset_nb); + struct litex_soc_ctrl_device *soc_ctrl_dev = data->cb_data; litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE); return NOTIFY_DONE; @@ -107,11 +104,9 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev) if (error) return error; - platform_set_drvdata(pdev, soc_ctrl_dev); - - soc_ctrl_dev->reset_nb.notifier_call = litex_reset_handler; - soc_ctrl_dev->reset_nb.priority = 128; - error = register_restart_handler(&soc_ctrl_dev->reset_nb); + error = devm_register_restart_handler(&pdev->dev, + litex_reset_handler, + soc_ctrl_dev); if (error) { dev_warn(&pdev->dev, "cannot register restart handler: %d\n", error); @@ -120,20 +115,12 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev) return 0; } -static void litex_soc_ctrl_remove(struct platform_device *pdev) -{ - struct litex_soc_ctrl_device *soc_ctrl_dev = platform_get_drvdata(pdev); - - unregister_restart_handler(&soc_ctrl_dev->reset_nb); -} - static struct platform_driver litex_soc_ctrl_driver = { .driver = { .name = "litex-soc-controller", .of_match_table = of_match_ptr(litex_soc_ctrl_of_match) }, .probe = litex_soc_ctrl_probe, - .remove_new = litex_soc_ctrl_remove, }; module_platform_driver(litex_soc_ctrl_driver);