From patchwork Thu Feb 8 17:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 198507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp317842dyd; Thu, 8 Feb 2024 09:12:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IF35NobFN8R0IA3Ap5yN1AOBpDfL8WPEYCUgErDI28nYB4cyfVw1NAI3U7zo2unURHWwy5Q X-Received: by 2002:a05:6a00:80de:b0:6e0:6dbb:38f6 with SMTP id ei30-20020a056a0080de00b006e06dbb38f6mr3959812pfb.13.1707412350282; Thu, 08 Feb 2024 09:12:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707412350; cv=pass; d=google.com; s=arc-20160816; b=APxUJQA1goPKwaPpOT2tzNf0wvwhcJEb97+AXTU9dky4TqZqobU3sTn3DwsBqXJOlY 5I4kDw+A1dlXUimonGHiCpRXAbhVPzRGct+8U94NTK7cREe0lpmUyQQuyGMIkApYJ8KI Mr9WPke+AQDLU6jFuQI7NoOVBrvPYGPhHZ1RxOOUQIScqbgBd7Cas/qqD3+DbfuqqTey duto0Ye44lZXz6ApPoOGum/ieI8MxAUa3tAr4/2SQ83MW4xnFqQwnVXU+4m2rTnKQWZB Lke/MFMERrCxLugJwI6NbzcFm8sDnJCA7FbyYLs2HCvcuybpwcWMSQLI0kQiklT4E2z7 CkBA== 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=JMHkVcIC6xeV1uhK6RaEr0neC8xBhJuMwkb51UDT3f8=; b=A6JqSzgPEx+1ZAdubFraOVwmxgp2AdLWIZqVXvXdBuzGdjtiFIgZ+W7Uzw/9aZVaNG 8KnsBI0TqaDZqF1cQDnpxAPKTcQGlr16hvfC4ZeZv5AyvO9G/yYHurpeu5LrARxTdBlm vL3XGE1X+Q2dwfwww27FJlkQQzJjoEfc1J5cbfy1nfGsB40XkmoVb7S6wpqql0I0hHWS n9cnt8h9jLD0DX1w2H0h4S8ymuODS8nXnfvSuSZdOp2rd85QKGpTWAOSjgcAK6nRHLgh dmMaGYTCKK9P+Rp0CIU4pVt0qImAHVsHJfkk/2Oe4ghmDd2jahbpfkLQjyvnszIahYH/ 714Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lUW4NAlk; 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-58408-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58408-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCXSd/TmciLslBFcZBUpMqgF39ltx5dliCRT7Ohi8nQcX+ax+BOMf7/wBDQjL+HwBdcIZdznbK+JbRyEmb+8mNhvkXXMDA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n9-20020aa78a49000000b006ddddbe2b03si4182690pfa.99.2024.02.08.09.12.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:12:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58408-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lUW4NAlk; 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-58408-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58408-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C0F4283F6B for ; Thu, 8 Feb 2024 17:08:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82ED412F364; Thu, 8 Feb 2024 17:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lUW4NAlk" 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 9BF198289D; Thu, 8 Feb 2024 17:04:36 +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=1707411878; cv=none; b=rWpy7MKXS/NRyZoEK1oc/L4fFwVilHKoJrWT/OjLqK1C9BLWiHn0dhItzzBAV5mhC7VyT+B6KHco90iVAagDhDE+ETwhrbyOaY4GP7ZN6rkA+wzOaWp1z8FP86Djxd7Ad/Si4eKFiG7b2DPLwwhWJAO/1NAcbWFYtmcioZZvQ10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411878; c=relaxed/simple; bh=QekKnIF+GkovKO7gb14ZkIhecaU+qacpUcgS7SjOB24=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H3p0K7FIsCvfSo5we9YHKa3Ez+9S+bYlsJwhloLRyhPLXtRW7o4Y7gKOFBPF8FTvn6nEPMsdwIMFZHCVf0ynX+/SUfdAzOkOvcXy2vUI7Sm7Y2QcqnvkLake8UzXnlznSb1c/wpYkXBI9X1xmNLyTbiDiMNyYKyh+2Gg8WOHhfk= 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=lUW4NAlk; 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 lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418H4Hj8095459; Thu, 8 Feb 2024 11:04:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411857; bh=2TI8f8x/5Y4Kr2Vxqhq6Wi5Pu8tSR0ICKXsQgkmtu64=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lUW4NAlkPsJuI6D1P8bsYr+Ts/dbS0Y7PTS+OtwWD6hHYJpmfBG6gsZu0wTHJAF5x nUU8aMKtSTpEQBZCDN8vVDTdZFH/IxH5KpKkxKxbOIy1LMgWB6xDLTW2+CeFlup7n6 XqVMPLUBwHSJOUplpIgNERCBALN4tL9UKlCU9y70= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418H4HY1023350 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 11:04:17 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 11:04:17 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE101.ent.ti.com (157.170.170.31) 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, 8 Feb 2024 11:04:17 -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 418H4B6A091006; Thu, 8 Feb 2024 11:04:16 -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 v3 08/19] power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART) Date: Thu, 8 Feb 2024 11:03:59 -0600 Message-ID: <20240208170410.67975-9-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208170410.67975-1-afd@ti.com> References: <20240208170410.67975-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: 1790351612463119365 X-GMAIL-MSGID: 1790351612463119365 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);