From patchwork Mon Feb 12 16:28:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29706dyb; Mon, 12 Feb 2024 08:33:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMgoabLNkOabGKL2rlfBzDuPO7INJ20i7h6pCWk8/LAr/VGBkBABFMtbx8ZNJku9ThbaXg X-Received: by 2002:a05:6a00:1e01:b0:6db:d59c:a5b7 with SMTP id gx1-20020a056a001e0100b006dbd59ca5b7mr7275712pfb.20.1707755579975; Mon, 12 Feb 2024 08:32:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755579; cv=pass; d=google.com; s=arc-20160816; b=IjftOIzVAd3Dp1grXR06jJpsbfwxY8bnrFeo3xiI30D441izQDLVh6vv13PVqlYasT 0ylztR7mgGpqPrWUBy7b1kSi2bH71mhvdcidBdGLqKtXxxRPl1kMKR+mpTf/lAK2IuKV AG4otcyqww20KeHVhlX0nWtvdSNKDpYFW43rvcAPfMPJjwlZ5xGH0FUq1QnHSR3+I9fk 0xqJS2nNssI0lOUPw25JZDJzmyAlD/+AbMHZZ7cJQWKb3NhAfXgnBww+LHF+PGiVEN1n juA6gWl/Tq2cUUw9CuQ/pbIH30PeDXR4Dc1iYxyp75UODVtf+f6mJ98v3nIPVvKuQbu/ BtNg== 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=2TI8f8x/5Y4Kr2Vxqhq6Wi5Pu8tSR0ICKXsQgkmtu64=; fh=uzE6Pk/fPtOJRPXJ6wloesvuIEwMmgRAoV15SqKo57Q=; b=Xfh+q/QGlLgLlSlzyzALvCqQ8ZuyF8oZGHKJaiV26Ke9Cb5uHJCeznOAb2ndxS+PzS NCjM87GDx4hbHnRhDoiyojeXqzx0NZQ+8Cvi5uhCWbtUidfB1jJSXDHjX6neysw4Need GUpC6ljL+9PT7BOZDAy2njfw+2jyzlog74OgTBpt/5UELp65N9WvdGBfF91XVXAX8Vw5 Vt6knqZjgeB/gvTBu5iAoriwBtbZA9sKMnoP/hyS/aVVKJtjpatpEaIZPRdC1E77kcWR KdRGBpwyag6vW8l/lpcs01VQwYMCFBXK6yCdge3QNc3qc/AO5jdMHC7kt/RJWplfQ37X NAig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DrBTLoeP; 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-61963-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61963-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCXYAwRUwxi+sThJLFQ/0y7CqhraL8Cs4tyvkzObYKZOEk9Ip4Fbx0dNHi6CC4gw49oa8R3H9VdxFT+Kp7KT5UN3WJqPZA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u21-20020a656715000000b005cf268638f4si466450pgf.156.2024.02.12.08.32.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61963-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DrBTLoeP; 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-61963-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61963-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CAA21B2262F for ; Mon, 12 Feb 2024 16:32:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67BAE46546; Mon, 12 Feb 2024 16:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="DrBTLoeP" 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 0F5BF3E476; Mon, 12 Feb 2024 16:28:49 +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=1707755331; cv=none; b=n2eftKhH3TqczU9UbSjionRHaIlIimeQRvtRBvSUBa7M/zO+Cm0eXwm23GkWQGpEppnNLZeB7Nqy8uSNI/oNKj9zjf/Kx7IALcq+HuPhxctsyhl7wnMNWcQho6ZjQCPLxpb6lBtS6NFDqwQ+DFlSR8ofWQBVr3zObPw9I56l2jA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755331; c=relaxed/simple; bh=QekKnIF+GkovKO7gb14ZkIhecaU+qacpUcgS7SjOB24=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K65fdsGzqm0R0A2I1hJI4SDK4yQ1wYl9EyXa4JKh1sAHLr0tdO1FrFmL9jXOO9f0tLYFTDKdsg9pDwj8byQNtsws7pZaWQ9C+VF1FLgOVkUsdVQ+JlujFT50TM0jafyv6Sz1UpZ36gBtAzjzlwF3IDvzCs2T1YxSNRnoOmV0nvY= 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=DrBTLoeP; 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 lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGScsB080181; Mon, 12 Feb 2024 10:28:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755318; bh=2TI8f8x/5Y4Kr2Vxqhq6Wi5Pu8tSR0ICKXsQgkmtu64=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DrBTLoePLehswdRPNH+vUAWqNvS2RdzEsDCDcwlSakra+jODIW6BGbJ+jHKU3N/Uu f50kNvK/DKr7sOwR19Zil95AEpMh2AYNptIWtLM2p4iNjarMe4esDtyIRpRwbrxisb kOews5OxauxAOg9SkBR6a4MbN6N6Sv022qN2QXtQ= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGScnF008721 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:38 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE109.ent.ti.com (157.170.170.41) 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:38 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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; Mon, 12 Feb 2024 10:28:38 -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 41CGSWR4090688; Mon, 12 Feb 2024 10:28:37 -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 08/19] power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:20 -0600 Message-ID: <20240212162831.67838-9-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: 1790711515289481808 X-GMAIL-MSGID: 1790711515289481808 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/axxia-reset.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/power/reset/axxia-reset.c b/drivers/power/reset/axxia-reset.c index 24946766760c3..797bf6773860e 100644 --- a/drivers/power/reset/axxia-reset.c +++ b/drivers/power/reset/axxia-reset.c @@ -26,11 +26,10 @@ #define SC_EFUSE_INT_STATUS 0x180c #define EFUSE_READ_DONE (1<<31) -static struct regmap *syscon; - -static int axxia_restart_handler(struct notifier_block *this, - unsigned long mode, void *cmd) +static int axxia_restart_handler(struct sys_off_data *data) { + struct regmap *syscon = data->cb_data; + /* Access Key (0xab) */ regmap_write(syscon, SC_CRIT_WRITE_KEY, 0xab); /* Select internal boot from 0xffff0000 */ @@ -44,14 +43,10 @@ static int axxia_restart_handler(struct notifier_block *this, return NOTIFY_DONE; } -static struct notifier_block axxia_restart_nb = { - .notifier_call = axxia_restart_handler, - .priority = 128, -}; - static int axxia_reset_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct regmap *syscon; int err; syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); @@ -60,7 +55,8 @@ static int axxia_reset_probe(struct platform_device *pdev) return PTR_ERR(syscon); } - err = register_restart_handler(&axxia_restart_nb); + err = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, + 128, axxia_restart_handler, syscon); if (err) dev_err(dev, "cannot register restart handler (err=%d)\n", err);