From patchwork Mon Feb 12 16:28:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29265dyb; Mon, 12 Feb 2024 08:32:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxw6lOWRXBoarOQx6bcpqN5J6oIx5G603uB5u8HdSM97/KBRUeAQnVO5SKmUPxpzc9BBzI X-Received: by 2002:ac8:5f14:0:b0:42c:110a:7619 with SMTP id x20-20020ac85f14000000b0042c110a7619mr8432166qta.47.1707755535801; Mon, 12 Feb 2024 08:32:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755535; cv=pass; d=google.com; s=arc-20160816; b=S0VCSnNTUThFF3uBb4WVPIy5b+2Eq/xcyvrr0AA8yGZfx5jNO412aIqCb5gibOdPJA TCKyi47JjfyCAMFLqv/IJVI3Y9rxQjthIH3cHXeB81z9z1FZKElsFCtP61dC4nojdaqy 1G2et2ycUsboxwb2UW9v+4+V9V01MDolXIUXlIBwxWokezrB5z3kB9AUZCT7mvz41eKu wXtD1Ae9RSmXs/Ke3Omii7sNxmDu6Xh2i+JwJ018tI2wydczh0PRZJ8LD5QHPhRLfUho cYH3X2WXA0gurYaeHaOzkrkkahQxMWkX05enTfFQuXdVRcGPkJ9qt4a+paJKzqR6w/G7 Sdxg== 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=eDTJGp1LNK+YD1bJfvgjkV/rIr2yWhv+8KTb7j41Dpg=; fh=m2vPULuK01zPVHozNrOgrbcJg9cnrsAk9354Of16cxc=; b=AO2MbZ9ku+cdenzOKky56YkrG6xe36Z+mdZNEGPEG9Zrxrgj8bTSl49e4U1FP/RMf/ Busrv4gI8zyv0EKsX+aSqW8szGDWb3KVLVW4r/D1XUhdiH1wnu8ztIYjFe22MSus25OL RpjVHcgo/kUEuq8DoGXGU7zXoOYqQQD84mGBaUH/KxAwlL8mMi0I+qHdujWxb8i8Fe4w Lx0E7xwjL7EpCsZk31/H+3U2PZXO2+Y9S1wQiAMLIdlTFDGyqASYtzJIpd1U1dB1+jLG 6ZXK49obT9RXMWEnYhP1thZK7qKWhtf734yuH7b7SpaPNU0tgj/Bb+wd3h6V8SyoTGIL nnpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NigIJQCP; 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-61964-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61964-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCX0zydiB7TpaXuSdWDdhlixqK4b0CFnl7UFN7x2rca5E6p4DI4C86LNxE1NntnQ02PPcE22woUvf9voPpRkTDMIXyFjdA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u13-20020ac858cd000000b0042c7da1ebb5si808697qta.675.2024.02.12.08.32.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61964-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=NigIJQCP; 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-61964-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61964-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 883711C217D2 for ; Mon, 12 Feb 2024 16:32:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94F6D46B9A; 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="NigIJQCP" 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 0F5913E474; 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=JzipcdtRnvINHCh6167uOlow1Y2EGrLsCbnf7AT2WRovbLT1CuYv7CTca84QB9resmlGwsLsRMlYwJU7JHnQcue1QHHwwoQaVdZGIVIzURRwinKas5iRzSFPxPD2YoYr7/q5cGhHQmYswcTWupQN9S/favp1kr9msMYuRMe/ZqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755331; c=relaxed/simple; bh=hjODPAvfHHQsYQrgcPIWkoWLz7Tm/5vLqy/n+aT9TWU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cK6y4q6yulMjuykqmxyuxlrBxeZFFJXrIsBZJEJm9MLAOhRVinETKvq4aOzAh7gA55q6P+7zf2gC90jAQdjYcxETDvnpaBRtZTpNLuDg3ToGqY9nOyUYcVF7DBnI8hq/kRdCMSN0lhkujcXx8O7xP2VDPN48LL+O/Pf3atTW+oE= 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=NigIJQCP; 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 41CGSY9n080174; Mon, 12 Feb 2024 10:28:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755314; bh=eDTJGp1LNK+YD1bJfvgjkV/rIr2yWhv+8KTb7j41Dpg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NigIJQCP0PJXxoPX/D0CJJBkyc6Ign+K2fxu+Pg/Ua3l6FrsplqKGW0fkvCdS6lpb SVxYwRWS20ulLDCENqizre0LaHd6uHZac5kBCCxQ4JraEiqt84K/sSkFmrnDUmZRJ5 sms8Nb0TTyQjvNjg4iGHJuEayQVM/x8BTYEXvONw= 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 41CGSYar008653 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:34 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) 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; Mon, 12 Feb 2024 10:28:33 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE100.ent.ti.com (157.170.170.30) 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:33 -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 41CGSWQv090688; Mon, 12 Feb 2024 10:28:33 -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 01/19] power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:13 -0600 Message-ID: <20240212162831.67838-2-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: 1790711468265355198 X-GMAIL-MSGID: 1790711468265355198 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis Reviewed-by: Cristian Ciocaltea --- drivers/power/reset/atc260x-poweroff.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/power/reset/atc260x-poweroff.c b/drivers/power/reset/atc260x-poweroff.c index b4aa50e9685e1..ce2748d3282c3 100644 --- a/drivers/power/reset/atc260x-poweroff.c +++ b/drivers/power/reset/atc260x-poweroff.c @@ -16,7 +16,6 @@ struct atc260x_pwrc { struct device *dev; struct regmap *regmap; - struct notifier_block restart_nb; int (*do_poweroff)(const struct atc260x_pwrc *pwrc, bool restart); }; @@ -172,11 +171,9 @@ static void atc260x_pwrc_pm_handler(void) WARN_ONCE(1, "Unable to power off system\n"); } -static int atc260x_pwrc_restart_handler(struct notifier_block *nb, - unsigned long mode, void *cmd) +static int atc260x_pwrc_restart_handler(struct sys_off_data *data) { - struct atc260x_pwrc *pwrc = container_of(nb, struct atc260x_pwrc, - restart_nb); + struct atc260x_pwrc *pwrc = data->cb_data; pwrc->do_poweroff(pwrc, true); return NOTIFY_DONE; @@ -194,8 +191,6 @@ static int atc260x_pwrc_probe(struct platform_device *pdev) priv->dev = &pdev->dev; priv->regmap = atc260x->regmap; - priv->restart_nb.notifier_call = atc260x_pwrc_restart_handler; - priv->restart_nb.priority = 192; switch (atc260x->ic_type) { case ATC2603C: @@ -225,7 +220,11 @@ static int atc260x_pwrc_probe(struct platform_device *pdev) dev_warn(priv->dev, "Poweroff callback already assigned\n"); } - ret = register_restart_handler(&priv->restart_nb); + ret = devm_register_sys_off_handler(priv->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + atc260x_pwrc_restart_handler, + priv); if (ret) dev_err(priv->dev, "failed to register restart handler: %d\n", ret); @@ -241,8 +240,6 @@ static void atc260x_pwrc_remove(struct platform_device *pdev) pm_power_off = NULL; atc260x_pwrc_data = NULL; } - - unregister_restart_handler(&priv->restart_nb); } static struct platform_driver atc260x_pwrc_driver = { From patchwork Mon Feb 12 16:28:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp28100dyb; Mon, 12 Feb 2024 08:30:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUbTcJtl/mzA8ATgy9omyd955llaEIFK39IuzesHZvYOUnwn4By3barMBWVirPYt6HdupM0R+cNablIIwI/QBWCGetOWQ== X-Google-Smtp-Source: AGHT+IGwnZQzw6ToIfzouYfCpc0LNPmj9mmp6wKBosWIcfSwLDxR1Jn3yDTuyYHag4rWegHeutez X-Received: by 2002:a9d:5615:0:b0:6e1:13a2:3948 with SMTP id e21-20020a9d5615000000b006e113a23948mr7148616oti.5.1707755436387; Mon, 12 Feb 2024 08:30:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755436; cv=pass; d=google.com; s=arc-20160816; b=MzkORGIksVhOZjLOVr70VeLiz6/uJbvwRQmUdJGyxAXTN0b0TVE+7hbwMp61J/Uyft n17o3h37zpL1mC8tsDSBAGJyjukjufb/FhyIzbP0Yoiei4U7pTsOQ7j/81SCdDKhfYq2 ECPOX3NfClYQZ63a6ScebAFg4mlJjIcRAXky70ToHXv4TFs3QJqPmu952ALkM4+UZ/Js Tz6FjkZ2C1+sRfmxgYt7f38kQ+V4sMdth+qBp6hYB9tTAkVJOEyPYBoBp1iTWTBooPyv vqn6qWqLV/c6W9Zlueuwk584hFrzNE2FX2bK4CIsqo/iRKCZDAXMTQcjpj0XYLQbgsRr ebBQ== 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=2cm9ruqVmpJKRpRfi1ywbymPKB5JK0jfSdZffEo1IXY=; fh=i7qWnsqZcMyjCPrKe+aclIBz5H0LOd1Ak6wM/UWv8kY=; b=0tnFBqQ+Vv5W7XAU7xX+OR43BmRTrknYGHFYup7TT21ivG0d2ey/33PROFlf7DLhvW IOWOhtnXSaPqn8KnYIIodiJStYvO0/ZhqqLhZY4rEtKM9eMhGYGkZfHc8Ps5pP5pDT98 Ng11VLWaSPdBji/ymk3aYKuroVLdbBh0l0AqAWin0ffjm7WkmnqSlqJWyqVBTmenY5ez lTVIEbTf6hfbVpcoW5XoiC4G6xotA6Si0Kz1KBUVWZcwKvFgDfrCpCU+fNcqQeaKzrNu erW4UvUdhkHQ2poMzyI1xzIIewKBeVnW61112+/0B28hisOBA+Fppfb8445jijCQV5BE JeZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=c6jSXBVH; 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-61958-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61958-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCW+YWnRKzRiHwyxjYpqbnE1nF89nWDQ4YQwDxgS5tARdduQ+XEzTcrDMo/EbrwN3NQ2vfnrxKCIgh74HnSbtEiYW4JVMw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h8-20020ac85848000000b0042c5fb192b6si834744qth.348.2024.02.12.08.30.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:30:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61958-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=c6jSXBVH; 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-61958-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61958-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 1FE771C21730 for ; Mon, 12 Feb 2024 16:30:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A23A53FB1E; Mon, 12 Feb 2024 16:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="c6jSXBVH" 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 825C53D38D; Mon, 12 Feb 2024 16:28:47 +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=1707755329; cv=none; b=DCAhJ6MdXPtBs3otgRYFBvYFUejuvAHdhkYN5b8x+oinEwGItRFNH611AgIHVTLHr6PheXqwGGR2ZPEMP7kumOoeXZ38K9WoAtrhqVhIfIXs+WdI5ced9ivib5m/pRZ20j0yKlSnuVUWPiuJ+S6KLj7Rc9ClhDbqUX0K23fI61A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755329; c=relaxed/simple; bh=piwvd9XDrLI4E6nIns4idZqQIBccnh+XSsbLYNv6vd0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u9GlWnGY+cJQvd9s+ZQKNNqfaC6YGpB3qMk+hMuKFt2RvqdWHCYb8wZ0immd404qEZhEXG41Smhr6ds/COvcmZpTEtCJwwaIW2qQ52Nw66xrTaK/JGDPOxrLO0YC7w140cnSqJacOFC5chV8+Rxv20QHhmrSWPEG8ExHrAucMDE= 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=c6jSXBVH; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSYv2004138; Mon, 12 Feb 2024 10:28:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755314; bh=2cm9ruqVmpJKRpRfi1ywbymPKB5JK0jfSdZffEo1IXY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=c6jSXBVHtvnTWWCo724wItjQ8Y/gpXn7j/EbWFtPX6MrjgYdu5WCu/Xdoeed1Op19 qpbgtQDbVdnGysO2Sx9iNyZK4A1BhgWsaAuFYzTqJd11SCYrEUjah/QDaUKZSCfoC2 dkFIBQ6MKAh+Tf0M72HhnFNr2C9cLjx+1Zo/DLyU= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSY2g024836 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:34 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE115.ent.ti.com (10.64.6.36) 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:34 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE109.ent.ti.com (10.64.6.30) 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:34 -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 41CGSWQw090688; Mon, 12 Feb 2024 10:28:33 -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 02/19] power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:14 -0600 Message-ID: <20240212162831.67838-3-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: 1790711364587912323 X-GMAIL-MSGID: 1790711364587912323 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis Reviewed-by: Cristian Ciocaltea --- drivers/power/reset/atc260x-poweroff.c | 38 ++++++++++---------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/power/reset/atc260x-poweroff.c b/drivers/power/reset/atc260x-poweroff.c index ce2748d3282c3..e3e4621ccb1dd 100644 --- a/drivers/power/reset/atc260x-poweroff.c +++ b/drivers/power/reset/atc260x-poweroff.c @@ -19,9 +19,6 @@ struct atc260x_pwrc { int (*do_poweroff)(const struct atc260x_pwrc *pwrc, bool restart); }; -/* Global variable needed only for pm_power_off */ -static struct atc260x_pwrc *atc260x_pwrc_data; - static int atc2603c_do_poweroff(const struct atc260x_pwrc *pwrc, bool restart) { int ret, deep_sleep = 0; @@ -164,11 +161,15 @@ static int atc2609a_init(const struct atc260x_pwrc *pwrc) return ret; } -static void atc260x_pwrc_pm_handler(void) +static int atc260x_pwrc_pm_handler(struct sys_off_data *data) { - atc260x_pwrc_data->do_poweroff(atc260x_pwrc_data, false); + struct atc260x_pwrc *pwrc = data->cb_data; + + pwrc->do_poweroff(pwrc, false); WARN_ONCE(1, "Unable to power off system\n"); + + return NOTIFY_DONE; } static int atc260x_pwrc_restart_handler(struct sys_off_data *data) @@ -211,14 +212,14 @@ static int atc260x_pwrc_probe(struct platform_device *pdev) if (ret) return ret; - platform_set_drvdata(pdev, priv); - - if (!pm_power_off) { - atc260x_pwrc_data = priv; - pm_power_off = atc260x_pwrc_pm_handler; - } else { - dev_warn(priv->dev, "Poweroff callback already assigned\n"); - } + ret = devm_register_sys_off_handler(priv->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + atc260x_pwrc_pm_handler, + priv); + if (ret) + dev_err(priv->dev, "failed to register power-off handler: %d\n", + ret); ret = devm_register_sys_off_handler(priv->dev, SYS_OFF_MODE_RESTART, @@ -232,19 +233,8 @@ static int atc260x_pwrc_probe(struct platform_device *pdev) return ret; } -static void atc260x_pwrc_remove(struct platform_device *pdev) -{ - struct atc260x_pwrc *priv = platform_get_drvdata(pdev); - - if (atc260x_pwrc_data == priv) { - pm_power_off = NULL; - atc260x_pwrc_data = NULL; - } -} - static struct platform_driver atc260x_pwrc_driver = { .probe = atc260x_pwrc_probe, - .remove_new = atc260x_pwrc_remove, .driver = { .name = "atc260x-pwrc", }, From patchwork Mon Feb 12 16:28:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp27624dyb; Mon, 12 Feb 2024 08:29:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXIMv+CcZyH1BngnF+k9Tt5OfrVqk6qjbrhrmsGvDLOjG1e8SDg3psVeZiZUt6XlzRONB+8hkBtbTIIefuDSJcU0/JaGw== X-Google-Smtp-Source: AGHT+IF8eWBFpRkMHiFe5nbmgPH5sSq7o5UaCfaBbNnySeVUXyxDkqa5fHdtpXUsrBiaq70fyc50 X-Received: by 2002:a05:620a:4711:b0:786:33c1:1419 with SMTP id bs17-20020a05620a471100b0078633c11419mr1582515qkb.59.1707755395713; Mon, 12 Feb 2024 08:29:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755395; cv=pass; d=google.com; s=arc-20160816; b=rFrlqByKjBUWWLEZLWbFhzhyTqHjETzA5qkfBlJ+L1OzizQp6bX+qSnRd/9y6SNioN 3sifsNXtHZW82XafgYWgWHetUZ2HChDn4WUq8MAvwZH8U0BBMQP/MTiE896lh72NSrH9 wvMCbR2Fa/TCNbs9OwnH/kW1E1d3IFwFqw9j3U32UWr+Ag/DiuXXIVYGgIGtczQb5OD4 8myjZ1YH7jjsB8Sv+j/Iaws0aFWpcleddJ784cqbTPsabLNOR2gqh50oQOfia10I/q0a v+a0WfS88aH45QByoNt8Bs4XTg2PEEckvnbjOpn2fPnrjRgf54PHRd9kqerOoPw6S22X bW+A== 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=DM5F+CDTYAkATD9JuxoEYM5J5TLXMlR0cMppKdmlkcg=; fh=zGBE51zGvShhMJeJjyjyeRAzaD8YnnrNjzae8dcC5iA=; b=K1h+3+bpypu9HJwEq8hAnIEKGPrMv/mc6naR9pNMcUttBKE8xYYB+X0U8YP3vSMPeF hSArlzavj3aA2Sm0MtkDv99MoloB6qnTrveePB/EaumzUYYYEsk6X/ZBjlKnpkZ5V/lV SvBsZQF+T2tCE7dXSn0jsqsfGdLa2aLm0Bodi/mJe/7gbvUz1jIU+kyzuxefAZ78NcAt GqPSeLqG6SioDVVPwb3YN0EcHN/sbpXp1Q242v/c+nk1JovNbJxBiW+WHqc0BqlS0KDI PsS+EEjH5Vao2i37rxC678ikhsbAFvj03YOAfueVKw/qo43/lcDFGmkzlFK1gVsO3k0W zzSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FsMWecg9; 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-61956-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61956-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCUx8I68YzP/9mEXSOPrvghpca1F6R5IokKtcTdBJkassoiFe/XY8xE4EroBvWHMfpMLq/riUeIHJq6DcyCb2C8W83NgNQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id br7-20020a05620a460700b00785d50b859csi3190546qkb.347.2024.02.12.08.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:29:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61956-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=FsMWecg9; 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-61956-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61956-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 7FC021C2103B for ; Mon, 12 Feb 2024 16:29:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13EA73EA97; Mon, 12 Feb 2024 16:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="FsMWecg9" 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 46B9C3C699; Mon, 12 Feb 2024 16:28:46 +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=1707755327; cv=none; b=QfBOL838F4pwjS2ibBb+MkMpMkGBKqFCCdKU56V/pJE4IAm6qXps3kNNF3dsdHf+zxPK9Da7/XHuZlxrbtMM2MXhRL2UONZqz5Kto4HXmUXPiMxvPOmWiGMwOmwjV/Vw2sXJhMXSVctCW/nt6rn9E8RxD7zxZ6FDNSXFb5voaVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755327; c=relaxed/simple; bh=ilhrdoWUjxQAw/qNLh+VKGDKCDBwtm1fe8dEPR5edio=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qVXOEjhBNWZ9lzPeMZ/MK85EVLQX2s1PaOZdDl731QLJYzvMojWspxpV9UjrNh84sps7YyTUwlklY1vqldcyQQg8LkER+QVOgvysVZ3/qU/ssNupQ93AkhcTWt0AbKBRHkuLF3aBbhWHED4/IuK0ABmT7a8QpEfWmuEnSpcOZjI= 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=FsMWecg9; 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 fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSZEp045189; Mon, 12 Feb 2024 10:28:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755315; bh=DM5F+CDTYAkATD9JuxoEYM5J5TLXMlR0cMppKdmlkcg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FsMWecg9kC5UB9179sxzrodGJ+BwYFphMHjuRqDJMGMmX+uJEQw1F4Y2KdJBbyU1y axJ8HnpdI5e6NTPZjsioFGoQcnJOSk5ILRMwVTDXEOZf4J5ppFFem60uCaEIiBKR/P /C02cGkFKcGlMn6abK1vZQyTFXRlng5eZPT8N9m4= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSZJj041897 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:35 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE114.ent.ti.com (157.170.170.25) 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:35 -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; Mon, 12 Feb 2024 10:28:35 -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 41CGSWQx090688; Mon, 12 Feb 2024 10:28:34 -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 03/19] power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helper Date: Mon, 12 Feb 2024 10:28:15 -0600 Message-ID: <20240212162831.67838-4-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: 1790711322024562227 X-GMAIL-MSGID: 1790711322024562227 Use device life-cycle managed ioremap function to simplify probe and exit paths. While here add __iomem to the returned pointer to fix a sparse warning. Signed-off-by: Andrew Davis --- drivers/power/reset/xgene-reboot.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index c2e5a99940d37..6b545a83d8889 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -22,7 +22,7 @@ struct xgene_reboot_context { struct device *dev; - void *csr; + void __iomem *csr; u32 mask; struct notifier_block restart_handler; }; @@ -54,7 +54,7 @@ static int xgene_reboot_probe(struct platform_device *pdev) if (!ctx) return -ENOMEM; - ctx->csr = of_iomap(dev->of_node, 0); + ctx->csr = devm_platform_ioremap_resource(pdev, 0); if (!ctx->csr) { dev_err(dev, "can not map resource\n"); return -ENODEV; @@ -67,10 +67,8 @@ static int xgene_reboot_probe(struct platform_device *pdev) ctx->restart_handler.notifier_call = xgene_restart_handler; ctx->restart_handler.priority = 128; err = register_restart_handler(&ctx->restart_handler); - if (err) { - iounmap(ctx->csr); + if (err) dev_err(dev, "cannot register restart handler (err=%d)\n", err); - } return err; } From patchwork Mon Feb 12 16:28:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp28072dyb; Mon, 12 Feb 2024 08:30:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHQyDeg7fhgLEXETVKXqKzA8bRSfypmZ/2WedQD4vNN5MCuLqZZsuGiP/f/7lf86YpHQK/ X-Received: by 2002:aa7:d908:0:b0:560:590:10b9 with SMTP id a8-20020aa7d908000000b00560059010b9mr5361169edr.2.1707755434668; Mon, 12 Feb 2024 08:30:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755434; cv=pass; d=google.com; s=arc-20160816; b=e3C/3VVJd3XIcO2O4fOQgajitn7O9V6xqrYTRcXpPUiXTrTZnJwWWQOUr5X9Ip+kOY HsiXUpVaEtuOnOSZGyFnomCKO+aTUGMlhjNUpRsCgvwwAluI4eUM2v4YPN1hqdIlFKxO GB/Lthd75XbMV/nEXOHUJeqR7ScZ7ruHKrhVoKRCP43NCgXnmV0S0zdOxlwfvULeGwvF W4dgdeVeZYCz9vyhd6DWEAZ4dm2sH3iRV6O38OZ7qfgtlZPxXqClgHdPYLu2KgCoFBO0 suAfFQAK/3Cyqa/LgMlcVJzaSScL7oU4KFBdu1JsgyC4ADWc5hMpPCIfHr/YNLp5UCM0 hOMw== 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=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; fh=d4/aEpQQ2pGVxyw2Lo4Ch85TkCb19622V/TBptNBgBM=; b=xGDzO65thzd0dSa33sfQUDM+cG4dTmWJ7Qd2kdhxbesw2D/vLMNymCCUfwBATubrKn /DcKB/fsyzztJO/zHKd4BZBWP2rKcmWitDr/ZxpsnZCJi0DvZ5xmuQjkJ+xbUqHOvtjQ /6SuggDk2vGnvtTpt3RZhuC+eT1VlUZqqAG+P3BOU1cdb68pQrXnVweWX9acf/N8GhHR w2crVHTpFfp8UiVJhl6CJNjLo4s3xtdZpIni0Kgqk1CutYiYvo3gPTZHqoxDHEBoRZj7 7+v6TfWk77jIdkgvlJwlmwpgbwlh0XF+AeOBOOz954jDWsSGoBntrlWlsR/thynIps2f GHMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="H/SZ7sbI"; 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-61959-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61959-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCW92JNSTfT4J74twbTwg8dIAMFxzjioTnFWEBKt6f8xUJ18rUtm6M7pWS5QHph9+MK3VMtoEXUMFq/aOtq5nCnJwDul+A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m2-20020a056402430200b005612fd31a0dsi2906882edc.427.2024.02.12.08.30.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61959-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="H/SZ7sbI"; 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-61959-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61959-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 3A7151F21E06 for ; Mon, 12 Feb 2024 16:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 968343FB16; Mon, 12 Feb 2024 16:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="H/SZ7sbI" 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 B86793D3A1; Mon, 12 Feb 2024 16:28:47 +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=1707755329; cv=none; b=aL5sR7O+SVGjIXBTIiNDYgOa/yU0IW7q86y8+2XuZqQw/cnnhK+DpfeFLXSYs9XBVML7TUb/6XhjbZEqHGt8PVuC2GkFxaawpc0XwJJ91dx+jC7rdfdBNsqPK+iMMvmIRZuS6WctvMDIt09oQTiP5zGpWUj/U/5caaM4QaSRHZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755329; c=relaxed/simple; bh=F6j/rd2uqE1cUyZDghMq6eHqquIs5sdJYRKTy0Bo8is=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IHOv1Uy9Nfk9oQrUCigLMhtGDvXzfCrqcDPJVipyaLuCz8yNKWUV0pabxQaayK037PKBTs0toBnMZfA/UK/xOX/dNuG0iqOJxHPA6FyijwDlOmBr9qTLFXnt18+tjaajsWpraTQg3QbkE08pGiV81pZhL4TxceR99TPp3QRBfGs= 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=H/SZ7sbI; 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 fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSadb045193; Mon, 12 Feb 2024 10:28:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755316; bh=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=H/SZ7sbIjF3f0d2pCXRXRcE1gqiSFH3sJ7VDWYej5cVWcGSZ0j9duBlwWbClBLx9E 4wdk7UquWUJ8x6R2UQE5QAZ9U9tapK/leEWi76TNb3wvuLWecH0oP+G3Idn4zBN9OS +ytSakjCSxSpGX++wxeFacgFM9WzOC2OTf2tjdpE= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSaa5041911 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:36 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) 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:35 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE106.ent.ti.com (157.170.170.36) 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:35 -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 41CGSWR0090688; Mon, 12 Feb 2024 10:28:35 -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 04/19] power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:16 -0600 Message-ID: <20240212162831.67838-5-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: 1790711362568649112 X-GMAIL-MSGID: 1790711362568649112 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/xgene-reboot.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index 6b545a83d8889..867162dfe7eae 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -24,15 +24,11 @@ struct xgene_reboot_context { struct device *dev; void __iomem *csr; u32 mask; - struct notifier_block restart_handler; }; -static int xgene_restart_handler(struct notifier_block *this, - unsigned long mode, void *cmd) +static int xgene_restart_handler(struct sys_off_data *data) { - struct xgene_reboot_context *ctx = - container_of(this, struct xgene_reboot_context, - restart_handler); + struct xgene_reboot_context *ctx = data->cb_data; /* Issue the reboot */ writel(ctx->mask, ctx->csr); @@ -64,9 +60,8 @@ static int xgene_reboot_probe(struct platform_device *pdev) ctx->mask = 0xFFFFFFFF; ctx->dev = dev; - ctx->restart_handler.notifier_call = xgene_restart_handler; - ctx->restart_handler.priority = 128; - err = register_restart_handler(&ctx->restart_handler); + err = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART, 128, + xgene_restart_handler, ctx); if (err) dev_err(dev, "cannot register restart handler (err=%d)\n", err); From patchwork Mon Feb 12 16:28:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp28261dyb; Mon, 12 Feb 2024 08:30:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFtO9E3XXxZFsxYPyXY0Yaye7TnQZMMcR1KlpDD91KcXD0ATl6CYJVmAos3AfDM0PUEXG/ X-Received: by 2002:a17:902:ee0d:b0:1d9:a6e8:1c8c with SMTP id z13-20020a170902ee0d00b001d9a6e81c8cmr7853932plb.15.1707755446409; Mon, 12 Feb 2024 08:30:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755446; cv=pass; d=google.com; s=arc-20160816; b=Ma0kHTVwnrzZcqSTMn4VpOeOvQ1vyX2r4aMaERP1xOlSDdk+xMt8QF952WC7cUAfd8 WPllc4BC79jMXzS5SLOxVFcfkq7xkwFqs4SuAQ5it7icXlGpfdAwpghjsQogQlNKGmJY bEL+rL8vXVfAPhfa7JOlCd93i8+Rnn1+HPSA7w9456XIo04RHDYNBEdQv28Bm9/3pwT5 9sDngaxjZgILg2K/zeeYSKecwtVXn0MzElrqXytA0I/w6vxD2D9BAD+i7I9rr7KhNosH rl5EtfIskDRsK+gaRvREmSWNxAG9wJtVfQfCEnCx48rBb37XqLJiCW9D06DnqTC6p83T jezg== 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=WrDlA3MVIblMNMt/x1ENZcDUaj6UX9hq3LACckiD2VI=; fh=Zq+0D5eDtPMY+964Czx2peIpmV9mjPVNBLE0hsmVvV4=; b=Qx2gy3Pct6ojcZwM5smeeTGCv7Gx80XQfAVJVKbJWU5R1un1tbJZT5I2c8XaoQ/frN aouQJQWe67AISNOeHLn5rG1Sacq8MgLVtpGUB4ZDk9uLr0VlcD2JD+JsTQLx1gUrfdGQ 8uJi0tciOUE1v9l5ZLo0v+7mn8aH+Voz2Cab0ZhPg1wxeAbPZ3ee4+ab6Ww9iBJu6wbQ oHsdBZeKfvmMLBybzXYw2pfDNFyZ2ww9xJB/F3HBz0cdazgTEp4DiYspx3VDnanrRmVh bdL3Hdqi6Z4gOd+T/3rAKaZfhTzJvHJ2rxv0dUmJ9dilF/JbUhyBYbUEND+uoX4+dSko YKyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=i4FPyRbs; 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-61960-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61960-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVd0dTsRKvT527LCaF/eKgf/SLHz3vq7J35vBxXGD47fFo+E5RlLSkxDBJJLMJsWXIoAZo7303ykNApWTVCfCXt7urDXg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o6-20020a170902d4c600b001d9f88225e9si478801plg.151.2024.02.12.08.30.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:30:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61960-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=i4FPyRbs; 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-61960-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61960-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 2D9712810AA for ; Mon, 12 Feb 2024 16:30:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 156D93FB3E; Mon, 12 Feb 2024 16:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="i4FPyRbs" 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 AE8103D39F; Mon, 12 Feb 2024 16:28:47 +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=1707755329; cv=none; b=o0sH0AIri3kjlbb6Q3K+LRvOPCD4A88xgui1PABC902dOubOUxWNrDUShLAexZVn0yB1bEG9ijrAbHsDs0AXmllh9a15oOqDmI3W9ZF1JSYlDrIked/k5UtviUq+K4zGbKiBzFspEH/OojPXHCz8AnQM0L7QR4ow5SB56gKQVzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755329; c=relaxed/simple; bh=Lm8ufyWOJHp/dqvPwPh3Hgph+gKZYEOGeH+5IYuik28=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mGvJNFybfeuM3I6tYg0mnz+O7ASMIvQ9lQd4vcm3jHhf/4N75wHQimAVLf3wCh4XbNdh6qcjcRNwBdwfW9HN3pouUn4nj9IcARJF8beX0eih10QSrWQdKvmVG6+0difEQzamTY+al0oxLBEjwFJAEGqGNCw6SWmuajNdtfcdxJQ= 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=i4FPyRbs; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSahR004148; Mon, 12 Feb 2024 10:28:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755316; bh=WrDlA3MVIblMNMt/x1ENZcDUaj6UX9hq3LACckiD2VI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=i4FPyRbsyjmPOO8wC3nNU+9otcmKAlUJpjCdCZtEo9ZkAi7c6ZdvNnuDpyFcY3ttW RbU/qIIRFgQB+rnnXLnPbIw4x2hsp8q4JrfYLQgEGWfjYBeCXSE6vfzE/N99UQTY3I 3YnRcEPwpr7W75QIWiPZl23BiMP0tWuDfReiaJTQ= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSaYa024858 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:36 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE113.ent.ti.com (10.64.6.34) 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:36 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE105.ent.ti.com (10.64.6.26) 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:36 -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 41CGSWR1090688; Mon, 12 Feb 2024 10:28:35 -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 05/19] power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:17 -0600 Message-ID: <20240212162831.67838-6-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: 1790711375048923803 X-GMAIL-MSGID: 1790711375048923803 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/tps65086-restart.c | 35 ++++++-------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c index ee8e9f4b837ea..82d7a761a0385 100644 --- a/drivers/power/reset/tps65086-restart.c +++ b/drivers/power/reset/tps65086-restart.c @@ -10,15 +10,12 @@ #include struct tps65086_restart { - struct notifier_block handler; struct device *dev; }; -static int tps65086_restart_notify(struct notifier_block *this, - unsigned long mode, void *cmd) +static int tps65086_restart_notify(struct sys_off_data *data) { - struct tps65086_restart *tps65086_restart = - container_of(this, struct tps65086_restart, handler); + struct tps65086_restart *tps65086_restart = data->cb_data; struct tps65086 *tps65086 = dev_get_drvdata(tps65086_restart->dev->parent); int ret; @@ -46,13 +43,13 @@ static int tps65086_restart_probe(struct platform_device *pdev) if (!tps65086_restart) return -ENOMEM; - platform_set_drvdata(pdev, tps65086_restart); - - tps65086_restart->handler.notifier_call = tps65086_restart_notify; - tps65086_restart->handler.priority = 192; tps65086_restart->dev = &pdev->dev; - ret = register_restart_handler(&tps65086_restart->handler); + ret = devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + tps65086_restart_notify, + tps65086_restart); if (ret) { dev_err(&pdev->dev, "%s: cannot register restart handler: %d\n", __func__, ret); @@ -62,23 +59,6 @@ static int tps65086_restart_probe(struct platform_device *pdev) return 0; } -static void tps65086_restart_remove(struct platform_device *pdev) -{ - struct tps65086_restart *tps65086_restart = platform_get_drvdata(pdev); - int ret; - - ret = unregister_restart_handler(&tps65086_restart->handler); - if (ret) { - /* - * tps65086_restart_probe() registered the restart handler. So - * unregistering should work fine. Checking the error code - * shouldn't be needed, still doing it for completeness. - */ - dev_err(&pdev->dev, "%s: cannot unregister restart handler: %d\n", - __func__, ret); - } -} - static const struct platform_device_id tps65086_restart_id_table[] = { { "tps65086-reset", }, { /* sentinel */ } @@ -90,7 +70,6 @@ static struct platform_driver tps65086_restart_driver = { .name = "tps65086-restart", }, .probe = tps65086_restart_probe, - .remove_new = tps65086_restart_remove, .id_table = tps65086_restart_id_table, }; module_platform_driver(tps65086_restart_driver); From patchwork Mon Feb 12 16:28:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29069dyb; Mon, 12 Feb 2024 08:31:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXd9fQM3HGdHK2l+SUcvidwm/83XYjAUpVL50Q4kVXGuKdbCHIGzxhrzvGmu66/U4bQvZTwWzOqUPmy66DFsEGD6Fx7lA== X-Google-Smtp-Source: AGHT+IFuQfxgcMDFkyavK7m0XvOU/3ke9ihR+u6BqPM42hvbyE3dKNctbWwVfpwhZAOWHshnEToP X-Received: by 2002:a17:906:f1cb:b0:a3c:b059:9176 with SMTP id gx11-20020a170906f1cb00b00a3cb0599176mr1676159ejb.70.1707755518689; Mon, 12 Feb 2024 08:31:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755518; cv=pass; d=google.com; s=arc-20160816; b=woMZ1GwY6+6/NHMEmc+9c3r5J5GW0MdRZP7kbPQkVXIcGIl8Jsf9jeHxQutqvjGkhT 6vneSemPALjbQroEAeyRidNESsAY9tSJKCZJxDAEc+bBhG386wi1hVoWCuxx81EZge+Q 6vzSmjbTQpZsRwMnZXivpUZdq1Aq3HEoZGOnjQo1PHJs4kSEkxzuWBKpx2nDkteR71Wr AJXd4NSew/WkK1/S89Kg8OpzsnoShN+DE4ooIkCygnbYkiOxQZLLD/Az9Dc74JiAxlQQ sVSIeUjsf8lv8Q6fhhfflomiltwkMZLeoC/WMp70NTWkcRiIOXwPyCsPx2cAXrgdACkF LhTw== 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=awh4L/FvuKTUk4LCovxuQcQcm/YmAlMhgCuKLpIU3pA=; fh=4i9OymHp0oIMCfVJhkSKrU243+oEzJEk9U/gQPH25pU=; b=aoPNjjb0vwTmeZwYrQgxqVI0kx/tIkeVI8TbKmJC0SlSfsVAwdII+0ff0+CnYAEpz5 Y7i+Gxapj/Df/fm/p4Z4T6BuPtuts1ibTSRVnRC08SGaLqPIV6YNZ7DSAgTBVKAzaxvQ DR2nPMD6Z5bWeqGi6GLLGKBojiyx0UK2jJhyCw+NJ3GbEgiGwThanpEcsUQE9IDBWbdZ vAhXgKg/Tmk4lsUABYfX8y95lvcNWPZEIwfKvaDmQljE+p48Dz2XBCYQdqEScf3jKzXo 32MY+duIg7lHAbdDBGPX4Uyfw89ma8h9PcnlWn8vwCl90s6t63mmWrQG0qv+3rXYDbS0 jQyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KhuSzMZZ; 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-61961-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61961-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWvIT74u5UaNEA0CM0046fbHazjWhOvt9+dWgDqDZooAr6ie9xWcvowzp6iOrKVqtZEGNh6/EPCFWA5rHbP0/UzWWVtkw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h5-20020a1709062dc500b00a379d8d3356si319334eji.818.2024.02.12.08.31.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:31:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61961-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=KhuSzMZZ; 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-61961-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61961-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 4F94F1F224C0 for ; Mon, 12 Feb 2024 16:31:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 186CC46425; 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="KhuSzMZZ" 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 2B3F73D547; Mon, 12 Feb 2024 16:28:47 +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=1707755329; cv=none; b=X/ko19/bWOUtp6IfG2uZTiRatoCD0BJNdyVEdSnr/bYg0RwWUTwbWap+Bpp0Gv/71qHcaZYn+t/tBDSSli1ttfz2WZELr0Mg1vvXijMbNAI6fd1uFetlSNAUNJnq0jcGqIzSdxQbTPh6jLUETMhmCdHqBtdl764dMlBFcdwLbks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755329; c=relaxed/simple; bh=cM1cFjnSzQs76i3u0egboaHOZ+8JvQ6u6lgJc80Opuw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AavhmC3rqduI5O6MeyNLiubp7JbAccjqJBiTcpXkZnSGVBcCX21hTMg8TGbLTwMko5NboCrHl5oonXiQbJfuJquT3PT5uxRVHgQkzyqmO2vs5xi0BCAkaA4BJX1bSIAImrku6PkAau9bB1B8x8Y30CmJBRNbPsr18eEEvXSiNb0= 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=KhuSzMZZ; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSbjh004152; Mon, 12 Feb 2024 10:28:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755317; bh=awh4L/FvuKTUk4LCovxuQcQcm/YmAlMhgCuKLpIU3pA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KhuSzMZZYFT9Ke/54Lqtd9TYN3hzuoQkiUVlJ2lrixh98IkZwXcgQvD8PZ+sqkVwv XcyRVSoiFslc7QvGR/xbaGtbD+AzPY4tk3fqkoFnijfXcZ1Wrf+MUI4Ut3P3lpee2N lBq15gp2HugbTofud/HgeBujqU7ml9dr56lCv91o= 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 41CGSb6v024867 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:37 -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:36 -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:36 -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 41CGSWR2090688; Mon, 12 Feb 2024 10:28:36 -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 06/19] power: reset: tps65086-restart: Remove unneeded device data struct Date: Mon, 12 Feb 2024 10:28:18 -0600 Message-ID: <20240212162831.67838-7-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: 1790711450624001875 X-GMAIL-MSGID: 1790711450624001875 We only need one member of the struct tps65086_restart, pass that tps65086_restart_notify() directly. Remove that struct and its allocation. Signed-off-by: Andrew Davis --- drivers/power/reset/tps65086-restart.c | 35 ++++++-------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c index 82d7a761a0385..6976dbcac74fa 100644 --- a/drivers/power/reset/tps65086-restart.c +++ b/drivers/power/reset/tps65086-restart.c @@ -9,19 +9,14 @@ #include #include -struct tps65086_restart { - struct device *dev; -}; - static int tps65086_restart_notify(struct sys_off_data *data) { - struct tps65086_restart *tps65086_restart = data->cb_data; - struct tps65086 *tps65086 = dev_get_drvdata(tps65086_restart->dev->parent); + struct tps65086 *tps65086 = data->cb_data; int ret; ret = regmap_write(tps65086->regmap, TPS65086_FORCESHUTDN, 1); if (ret) { - dev_err(tps65086_restart->dev, "%s: error writing to tps65086 pmic: %d\n", + dev_err(tps65086->dev, "%s: error writing to tps65086 pmic: %d\n", __func__, ret); return NOTIFY_DONE; } @@ -36,27 +31,13 @@ static int tps65086_restart_notify(struct sys_off_data *data) static int tps65086_restart_probe(struct platform_device *pdev) { - struct tps65086_restart *tps65086_restart; - int ret; - - tps65086_restart = devm_kzalloc(&pdev->dev, sizeof(*tps65086_restart), GFP_KERNEL); - if (!tps65086_restart) - return -ENOMEM; - - tps65086_restart->dev = &pdev->dev; - - ret = devm_register_sys_off_handler(&pdev->dev, - SYS_OFF_MODE_RESTART, - SYS_OFF_PRIO_HIGH, - tps65086_restart_notify, - tps65086_restart); - if (ret) { - dev_err(&pdev->dev, "%s: cannot register restart handler: %d\n", - __func__, ret); - return -ENODEV; - } + struct tps65086 *tps65086 = dev_get_drvdata(pdev->dev.parent); - return 0; + return devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + tps65086_restart_notify, + tps65086); } static const struct platform_device_id tps65086_restart_id_table[] = { From patchwork Mon Feb 12 16:28:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29577dyb; Mon, 12 Feb 2024 08:32:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUR9mbXOTxeuiqce8Tp2JoGPihVGutJLsIQqZ/ZchlYOuxbEFb+ySjPREW0JuvsczRjXjjWqmkVBJTktpe7t+rRpPzUMQ== X-Google-Smtp-Source: AGHT+IEw5de84sFZrut043l1k2FIOY40EUaBiiNAtV99VmX+EFu+S3+qw3l2EPBRhVGo6nD8Jpav X-Received: by 2002:a05:6a20:c88d:b0:19e:443c:1202 with SMTP id hb13-20020a056a20c88d00b0019e443c1202mr6018726pzb.26.1707755569112; Mon, 12 Feb 2024 08:32:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755569; cv=pass; d=google.com; s=arc-20160816; b=ktit9leItiPKqfgfhYQjnvolZ4dM/o1wciM52nQ84L++qv7hPAiQwfvv+ltdiAh3rx jPTtDQKq8n1AxBuN5T/ARzKGO88Z181vHLmSFyIMfPV87deNde9s41UwVDDUxmgSHEwq q9kaEV2fl5bN0b026+Jg7OTgkVrfGm5JyVZT9XfLogRvCwo7WbLjuPoMjY2Qaxe8AQTi 5oyCUcGp//mXWeD8yOncgc9EiGbUTd5ZDxlkwKvb6zev7QHshpgy7E22+rkIZv0FS9Dk 8gVVCYseSX8a51Q66yLgX9/Y0leKeevhvG1jFMalaxzGem0Nr2GNs5SgvSednyyEjW9G n+Cw== 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=LGLUxvVXiFpOwGVZHJ/g7QXxTLnfINRjy9wvFXeu9qc=; fh=0l5laeve2TgtvWT1jP/c5+IKr8IBewAgeCTI/uRWj94=; b=fpqQQFWdM7gkRUXhU18V8fr+94G2pDyHR+LgZSazQSjtp5OXnz8LZqhIHlifJd/PhF XAlpCfvgmVcLL14UsJYKMM2I2oWnzGTKD3TWmpq23TH9+pkXhA84bNAVicEA/ydhHub/ TkHgJ22W1Vi1BzLqW3ok4l5qA+gD4eRQV7a/XLYmWe/pxnL9Zk2d6c5dQHbowSHumZNM LBrnr03GLbsXIgk9kG9trKGJk1ToQwFapeNzjb3AuVNfsT61Hgze6COnB8lSZIN3ImiO JRn3lTNJ6tErAArGmUBhYOkM8ws7KeYaGUfSc2t3PNxGWghJk8/cfkbYRSF8aWznQahD U2Qg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RSwCipk5; 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-61966-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61966-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCXvGbL0nnPMhBpIWMqL9OQW4Oqco4US4mdt+3WcA7hONpEbnJxYPylJBjROQDBIHpJLL2egEGRDImfXUfki2p80W/NigA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y21-20020a637d15000000b005d8b59fe766si445649pgc.457.2024.02.12.08.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61966-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RSwCipk5; 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-61966-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61966-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 DFDC02821F3 for ; Mon, 12 Feb 2024 16:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CFF7481D5; Mon, 12 Feb 2024 16:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="RSwCipk5" 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 9DEEF3F8F5; 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=1707755333; cv=none; b=bKSFUcGd4JC8U8Z0WFmzBB9yUExvVOGzZxMJLdM0Q9CDi/GlULa6DoKsxKpWapVKPaGPz61LSFCGcM76QIBAYOaaIoUtt86lgVLimE37O+18oNk+qUAZuO4c78bWkzYqD1W9SSWhJ5ajrNmkUdLFZ2C/7I1WJANPIqc77LZpVR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755333; c=relaxed/simple; bh=df03AKZk+heiDudJQkfc7tqfbv46PxpdpOE2Z5rnv1M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aqJFadLI6Tbdm26nBY/+QZIFMmKDOfRjAUqyh6mTWCziAdBbmDiNWbhm7QAfWy8bsDx3qeuKJijVG+j5nQKQkufSdR2NepRaIiNiitHpJNmTo93k4gyYZ3bG77mEUAifafm8Km35BUy5weyjty+jUYuYhpSiNvKZG0QJtc8UjdM= 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=RSwCipk5; 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 fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSb75068402; Mon, 12 Feb 2024 10:28:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755317; bh=LGLUxvVXiFpOwGVZHJ/g7QXxTLnfINRjy9wvFXeu9qc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RSwCipk5R38DDzp/u55eEnWAxlwX/BD2Q5vkm6IDwXHJ98sKM55hH4dKihPG6wM5H XFAjWPy6fmVyDGWxFNadylLkif2metIsbfwf0GVS23zr0kf0I17t6W5QWQWNlxpwq/ XuPnQQN0e2CLcH43flzezGWpsYOKsIP3aTXfqpmw= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSb7U046923 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:37 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) 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; Mon, 12 Feb 2024 10:28:37 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Mon, 12 Feb 2024 10:28:37 -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 41CGSWR3090688; Mon, 12 Feb 2024 10:28:36 -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 07/19] power: reset: brcm-kona-reset: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:19 -0600 Message-ID: <20240212162831.67838-8-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: 1790711503613242926 X-GMAIL-MSGID: 1790711503613242926 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis Reviewed-by: Florian Fainelli --- drivers/power/reset/brcm-kona-reset.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/power/reset/brcm-kona-reset.c b/drivers/power/reset/brcm-kona-reset.c index d05728b1db097..ee3f1bb976530 100644 --- a/drivers/power/reset/brcm-kona-reset.c +++ b/drivers/power/reset/brcm-kona-reset.c @@ -15,8 +15,7 @@ static void __iomem *kona_reset_base; -static int kona_reset_handler(struct notifier_block *this, - unsigned long mode, void *cmd) +static int kona_reset_handler(struct sys_off_data *data) { /* * A soft reset is triggered by writing a 0 to bit 0 of the soft reset @@ -31,18 +30,14 @@ static int kona_reset_handler(struct notifier_block *this, return NOTIFY_DONE; } -static struct notifier_block kona_reset_nb = { - .notifier_call = kona_reset_handler, - .priority = 128, -}; - static int kona_reset_probe(struct platform_device *pdev) { kona_reset_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(kona_reset_base)) return PTR_ERR(kona_reset_base); - return register_restart_handler(&kona_reset_nb); + return devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, + 128, kona_reset_handler, NULL); } static const struct of_device_id of_match[] = { 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); From patchwork Mon Feb 12 16:28:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp28947dyb; Mon, 12 Feb 2024 08:31:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGz7YJ0mj2zEETHqi2FwhvYfVF1aOU+d1q0aWf6mEKJAk26R3upTPRgaC6u2Ww0ohDw6Lqm X-Received: by 2002:a05:6214:4a8d:b0:68c:5cbb:3907 with SMTP id pi13-20020a0562144a8d00b0068c5cbb3907mr10772701qvb.40.1707755507119; Mon, 12 Feb 2024 08:31:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755507; cv=pass; d=google.com; s=arc-20160816; b=IXVaXHQg1q0AhQVmMCSY99r0/hcm/AsJ/rXWIALS/Zu0We3ft+ay1159PghLbeIO9u 1K+DpKvwt2SOOrq4u5MYIK7Ga9rBX4snmoIqSzPCmUNZGE9qnUt7V6/2i6rdnBkYPvsS W7pRGwGockBbW0odoItzXhXSYl8fQ8utAPu6UObPSSDa1j5SVmhUK3clKHZO7zkcDn7J x9iJO7x7j7QMe8pD8kH4YjwEBKUmr5iC5r2f1pxzMin25UQPIQJ98qQQ2Uf7Vw6V95Wd kWAhjrYPBrD1hFzw0nbSvedvHexd149argD5yc7pcbaJZ5W/Stxi0AzyH+4EdtdlT633 uYwA== 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=cEd9h6ts7ZA9SmxTtqXrV1X3OAdroJfb+pEHlYKYQq0=; fh=sCFiDAy8XXB9NGU/DPtwpfLCjmo0IJMpUfa362QCzqc=; b=mUQb8tnVwoH5qcwqCFmMGffh2xedGRj2zcwNGDbVJrkycDUmMp6MG44NBBFZq37l/o vEv/fZkGXX38kVePJhI+imAzl1WLhU8I4Z2P18h4RPKka4U+4slxwGSrDxXgnfdVJfJx Ms3cU/2TqpZbKy/x3pPeKzAlPB7Potzw7qG/NVul+7s4xD0U0hCZ8FqqQxjuXc1nY6PB zaz3j36Sqb41ZeC5yyJCWZC9qXAG/LvbrrciR+YR/jv3yfFzs9a3e+OcJNJRM6TO+OKY Xlucy8hMA1jSvnwAxVTNe5vrEyCIcdYDa1aA7TOmQhRRe0DI+urUYaDu4pRAEHYxB72U Vi8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PapxqZOB; 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-61962-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61962-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVg1ExwHoBhS3Amv6IKk25hlr6qe1W9CstwKNVCwKhuJsaQ7QfLiMfxVYOI/vMnXEKsUUHvEVAT6UT+eKUluJnz1VoV1Q== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gg4-20020a056214252400b006819bda2532si757080qvb.234.2024.02.12.08.31.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:31:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61962-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=PapxqZOB; 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-61962-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61962-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 E2AEE1C2189A for ; Mon, 12 Feb 2024 16:31:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB54C45C06; Mon, 12 Feb 2024 16:28:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="PapxqZOB" 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 8246E3D566; Mon, 12 Feb 2024 16:28:48 +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=1707755330; cv=none; b=l2yp692TK05YdgAgEBPpytn03ynfgDEp8Gr28leDG/V6pph3+hENhhn4bhnC9rLIAVJLxmg30Wqjs8ptMGXmZNqUi0SPsRZJ0kTemMqOBc7IetXZLENhIxGazeFUmtE8vdg9zVhtJa6SjXtLP96zceg0M3trXw6nfZwrZLy7cEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755330; c=relaxed/simple; bh=/wWLg9daNT6pfazjCLsyzkG8hTMGV8b457Vt9N+MIYA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UVMXWG5q7UnDWDkBB/kjKEbgn8rfejZC4XXgb4+APREGYQCjsEqxehtzz9fIlWg6uCRD+JWohzhfnSFCxb7FAKaPSpzQjG/TxLCmmF2fvwJINCqV30r0WEDZ3Y5h2l7CgFeXFclNufHggFYNPH3WLQY9vI2qEBEDXx633g0JF9A= 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=PapxqZOB; 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 fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGScF9045203; 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=cEd9h6ts7ZA9SmxTtqXrV1X3OAdroJfb+pEHlYKYQq0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PapxqZOB6kvuEwvbQTINsi/PPh8EPbOUy0zq8RtM/r/IfVt7ECAH0YZ5visw0xtnN enqKz6wPiYR6JR5RpqoRDDC4mY4lRHTVryfphMygRXdk8Ohgvm1rBE3wO9eT1uTdYF L1sYoPC4a/KddmxWCuGGx21VNjm1hWjKnwQdr81o= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGScbp046939 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:38 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE113.ent.ti.com (10.64.6.34) 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 DFLE104.ent.ti.com (10.64.6.25) 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 41CGSWR5090688; 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 09/19] power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper Date: Mon, 12 Feb 2024 10:28:21 -0600 Message-ID: <20240212162831.67838-10-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: 1790711438653364369 X-GMAIL-MSGID: 1790711438653364369 Use device life-cycle managed ioremap function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/rmobile-reset.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/rmobile-reset.c b/drivers/power/reset/rmobile-reset.c index 5df9b41c68c79..29c17ed2d4de9 100644 --- a/drivers/power/reset/rmobile-reset.c +++ b/drivers/power/reset/rmobile-reset.c @@ -41,28 +41,23 @@ static int rmobile_reset_probe(struct platform_device *pdev) { int error; - sysc_base2 = of_iomap(pdev->dev.of_node, 1); - if (!sysc_base2) - return -ENODEV; + sysc_base2 = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(sysc_base2)) + return PTR_ERR(sysc_base2); error = register_restart_handler(&rmobile_reset_nb); if (error) { dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n", error); - goto fail_unmap; + return error; } return 0; - -fail_unmap: - iounmap(sysc_base2); - return error; } static void rmobile_reset_remove(struct platform_device *pdev) { unregister_restart_handler(&rmobile_reset_nb); - iounmap(sysc_base2); } static const struct of_device_id rmobile_reset_of_match[] = { 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, From patchwork Mon Feb 12 16:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30710dyb; Mon, 12 Feb 2024 08:34:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkPdp1dhM4U4ino8L6m5Fpe8HeqapNZjrN8rP86dp2H/G8EDBVpcNjL4qrxYvQp+bC7fTkkrMwNUzwUohlup8co86NkQ== X-Google-Smtp-Source: AGHT+IGroDaQEWpmLoBxHgYzc5ErryTTBt/knhdqzghUEymnzkPtqudynAYzVWhyX9e/lcBgfzei X-Received: by 2002:a2e:920f:0:b0:2d0:f934:999d with SMTP id k15-20020a2e920f000000b002d0f934999dmr2057358ljg.5.1707755689150; Mon, 12 Feb 2024 08:34:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755689; cv=pass; d=google.com; s=arc-20160816; b=Tzw/vKDHIuR4aHqVEK1Xa/aEVIWWnOp85r5Mzuvz7ZYpVZ1P6i+/+orBWw4j4ZQQIR 06bIc8S8SPtXcGu5rPu8xI9vbv6adkNKU70DrBsULiqIwawNrZZaZZcFgbkBqn3r+YOb 8dqAMnkrI8R+Oh8GMimBy+FgCLtMwIA7lwXZURW/ck/7rPcMQ5dKh3V6gjyu0wPWZdSX zt9fTbw46/yNaXbDR4AZUxpgLQXylkgmv3ks3BKQcDQyrujTWw8hOuhsg8hAdlxNQXxe AwaptE8XDLSKd8gMrQ8NRHAteX2YAjY7so1f282YKwk3PDhdGUIdDbhhMJaJ/wuOxhBG FIKA== 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=tQD/ZFj+g03UN+0Ct3lIkEa6cwgymbRiKX/WFX6uZkY=; fh=sVWRuJtQPPStdDGx+sN1Ls5OCkyBaZgHvzogyTI06FM=; b=KA8FhHorh51JjzDALNlfkvjzqWQMbOe9IiuzeFZnqnPXtLHGYC78ZMkfKFuEIljvqH zdOaLvURciIlrLhDCTkHXBWWf2slaOPhaQ4jWT8StP2Bb2vHGEEbGtHJhPMjsxHvDKoo spm7ay6N410L1GihOwculylG4FaCVXfTkRpRvxiRZQZ54XNEI6+xGneLOnQ8ka11oWmS KbqEabOFwoLmjXsUW6fMCdIlviedTKdn2fDL1CsjIdznQ1ohHExZrpXzU3Qx5/UeHzhr v3YZjD30i89tPjI76nV5dKq5NtJB9Jj2ws1kpFIgbFEIZElXe3yXsfsdiPZ7R9jHQ5sh LCjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oHPBkh5n; 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-61975-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61975-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVD0A9PeGRENOSADa2m83imG3CxKUWrY3HfWPBrSQFdmYsxAn0mWdx2RtDbnfxrPYzkNaTFKXxiRnDJl5j/SL1Ybk3OAQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i7-20020a0564020f0700b0056176fdd1a2si2515664eda.324.2024.02.12.08.34.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:34:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61975-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=oHPBkh5n; 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-61975-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61975-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 6DF721F2292A for ; Mon, 12 Feb 2024 16:34:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7981A4E1C5; Mon, 12 Feb 2024 16:29:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="oHPBkh5n" 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 E72D2487B3; Mon, 12 Feb 2024 16:28:56 +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=1707755338; cv=none; b=oZIA3dd3Zk7hPM82MvRQYJ6Fv8GR2WgBPpMZxKnrMCwdbSIrbsvmW8huJXHntpqVIl1GkbmWy5jwPlaqe+DcZKGJWhzEXOHQRsFxc3Mbpn7YntMSdZmlSKWAdLTARKzahWxyLBEXm2s5ULXadhDE8cxxGY8tEA69j2YeVLI2/L4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755338; c=relaxed/simple; bh=SgJH3Y/k6PSY61jd629jA/U3cLCCWfZBB34w3kIbRpQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=avXx4iwtqBIcKoT2yYbusGfTt2NETeroazSfmHC2zr/r7dk8LF0BREGJYX4rWAabdzwiMUPBIUUwHaAzmh70trFkH/dk9ViYI1ZvlD8I++w2mCYH+hZPT735xszg/1dp5irAvZcn7Os804+WRo7poYfS+oJSuIvV9zuc7qzHi1g= 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=oHPBkh5n; 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 41CGSe7R045208; Mon, 12 Feb 2024 10:28:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755320; bh=tQD/ZFj+g03UN+0Ct3lIkEa6cwgymbRiKX/WFX6uZkY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oHPBkh5nKsWmJzcR+3qt8mWT8R5f2QSw9OfqV0xq68vZx91t+F2FXjofLHUcmHsmH Z+iXD7h0cIftBWtRTuF0CMX02BQfN5EzrNQN56rFrsOtB0UaHNhF7q/LLSaqZk1rEv 3zpgfqsfmRQvy1hjQGFUtrSXTKSKU/JuH7BbBeUA= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSe4D008748 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:40 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) 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:40 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE115.ent.ti.com (157.170.170.26) 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 41CGSWR7090688; Mon, 12 Feb 2024 10:28:39 -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 11/19] power: reset: mt6323-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:23 -0600 Message-ID: <20240212162831.67838-12-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: 1790711629800585269 X-GMAIL-MSGID: 1790711629800585269 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis Reviewed-by: AngeloGioacchino Del Regno --- drivers/power/reset/mt6323-poweroff.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c index 57a63c0ab7fb7..c663347547f97 100644 --- a/drivers/power/reset/mt6323-poweroff.c +++ b/drivers/power/reset/mt6323-poweroff.c @@ -14,6 +14,7 @@ #include #include #include +#include struct mt6323_pwrc { struct device *dev; @@ -21,11 +22,9 @@ struct mt6323_pwrc { u32 base; }; -static struct mt6323_pwrc *mt_pwrc; - -static void mt6323_do_pwroff(void) +static int mt6323_do_pwroff(struct sys_off_data *data) { - struct mt6323_pwrc *pwrc = mt_pwrc; + struct mt6323_pwrc *pwrc = data->cb_data; unsigned int val; int ret; @@ -44,6 +43,8 @@ static void mt6323_do_pwroff(void) mdelay(1000); WARN_ONCE(1, "Unable to power off system\n"); + + return NOTIFY_DONE; } static int mt6323_pwrc_probe(struct platform_device *pdev) @@ -51,6 +52,7 @@ static int mt6323_pwrc_probe(struct platform_device *pdev) struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent); struct mt6323_pwrc *pwrc; struct resource *res; + int ret; pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); if (!pwrc) @@ -63,19 +65,18 @@ static int mt6323_pwrc_probe(struct platform_device *pdev) pwrc->base = res->start; pwrc->regmap = mt6397_chip->regmap; pwrc->dev = &pdev->dev; - mt_pwrc = pwrc; - pm_power_off = &mt6323_do_pwroff; + ret = devm_register_sys_off_handler(pwrc->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + mt6323_do_pwroff, + pwrc); + if (ret) + return dev_err_probe(pwrc->dev, ret, "failed to register power-off handler\n"); return 0; } -static void mt6323_pwrc_remove(struct platform_device *pdev) -{ - if (pm_power_off == &mt6323_do_pwroff) - pm_power_off = NULL; -} - static const struct of_device_id mt6323_pwrc_dt_match[] = { { .compatible = "mediatek,mt6323-pwrc" }, {}, @@ -84,7 +85,6 @@ MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match); static struct platform_driver mt6323_pwrc_driver = { .probe = mt6323_pwrc_probe, - .remove_new = mt6323_pwrc_remove, .driver = { .name = "mt6323-pwrc", .of_match_table = mt6323_pwrc_dt_match, From patchwork Mon Feb 12 16:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29588dyb; Mon, 12 Feb 2024 08:32:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRsirwCbEncvqduF7kxD5FmNuolb0o7jXNQk2jdEGaO6UoCCxDDRDnrf29ew0EVNTy+m3a X-Received: by 2002:a05:622a:64d:b0:42c:5d16:d3e with SMTP id a13-20020a05622a064d00b0042c5d160d3emr9172339qtb.27.1707755569902; Mon, 12 Feb 2024 08:32:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755569; cv=pass; d=google.com; s=arc-20160816; b=vEr2JpiqKEl5ZdsUNTvatWXJrxitiO4aCzTMbCkCffIxU1F6RHBX0UTmm/LuWAKKRj k8uiQJ0Dc9HAK8cV66iPlsaPuS6/PD7ViJh1Mo544S8PbhclCS0/ggv0fElcJFW6DGk4 gseAoFbMpUJjxvOq+zOgzJki0dqU5qCMQPPtvp7ryrIGfSqT/KrjUFCYyKhiMCQqrGz4 pJvN407kNOUGTPjFQgjcG5/EVD6HIG7O7YCl1gOpy57hHmOgs/BohbdOevgz5P6FeXt5 kpYqAz7UdUVs2n7GFgRhS/RRoclSiwMtAnexrBBDWEohPEK1oAPX5mIYG/63KV1tWAaW RkSA== 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=5B+YzmWAg3uN++2w+PnvUYLCw+7m22OvzK6DPkBQknw=; fh=wTVTENAoUCx1Q3YE4IvmvOTWepwof4tgRMbjmuGBp68=; b=rl31MbWefv5K0mWOBw0aMuln+9fbt576oV9iwA2Wnae4b6hfmClQEtnD4SyhHFLtHE hGN+Ux2e/MLLAyztoOo736pf0aPgGEh1iwt9mTeMQzviGuBoVLOTm6qWjB5sA+Nk4pXN S5EBYsc+oADDjLOyVsQQr4DdGKXgKEWoQ5j2c5X8YAHZHadDeDvkoU5qsLLMAppnRqC8 qnv1milSXfJva5L6zP1K+I4GCDPgZAOeiQ3CTDj7B0CkLjJh8rA+8uO14u/yc1Y2KaQS 2qlEIcR7fSAqTLpR7ZwyEZXn0+ZWAdc5f1/dGboBtsR7pF3LXgHtFcDUyvkElK8CPldl DlPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tGtk41ot; 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-61965-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVmAgcxEMgqzkC3P+5TLvebK/+TIWldt8M7fQeC9AnK6eiKgFKKv4J/IABIpMDN1DlHaoYM/+nW9n5KoOG2rXQfCo5zDw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a13-20020ac8720d000000b0042bf6462ae9si670251qtp.734.2024.02.12.08.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:32:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61965-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=tGtk41ot; 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-61965-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61965-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 A0DDD1C218B5 for ; Mon, 12 Feb 2024 16:32:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D02A481D7; Mon, 12 Feb 2024 16:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="tGtk41ot" 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 4F9E33F8D1; Mon, 12 Feb 2024 16:28:50 +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=1707755332; cv=none; b=IR9JRf+c7OfOa/vQm4pK5IMfilwi6jhF5DUw/K5fiRi+SW/WTPqxG2VlTNGchPQKBpDKkxm+O1zlc7HiOPFTyd1VPgsI3rvEKC+AsvZenaXFghbYXC/p8gd2pyOIkU2ZJj9l2h2ABefqa7ebbUvxFFCCwJ1S7mffba21Wujim0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755332; c=relaxed/simple; bh=T6MgKnVT95iOniI/Zp8Rc8iYh1eAY+UF/3b/ySVcWnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ejzkWhEWG1UokNRdFw9Gs5c4KHDVLgJZl1YyjsJeh1qR3lCW2A3ZdHs8q8Ip+OKhSpmygecGrYTWUf1/eyBEd8X7DkpAAPs53nwlU59bbQORTMFUpluHIKdFHFG0VRtx7M1SRebyvbgE2vXkT9v0PnMKV/lIBtcX/0iaL3t/Blw= 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=tGtk41ot; 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 41CGSeu3004167; Mon, 12 Feb 2024 10:28:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755320; bh=5B+YzmWAg3uN++2w+PnvUYLCw+7m22OvzK6DPkBQknw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tGtk41otv6AuRaNDeKFLq2dB7xXoOiidX2/fb8aYvoZDFiiB0X+huFEfmVvdHtONy cFOkZ5nCYfwEzZLKPFg0k2XkyValJFgBWUGlmY4N1EYrgjrm1R8AiNPeNx+1IYEJhq w99Z00SFi1VjsmXRj7SEtnUeHCZwNDfzVcNF06aM= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSeHE008767 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:40 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) 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:40 -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; Mon, 12 Feb 2024 10:28:40 -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 41CGSWR8090688; Mon, 12 Feb 2024 10:28:39 -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 12/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:24 -0600 Message-ID: <20240212162831.67838-13-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: 1790711504616453185 X-GMAIL-MSGID: 1790711504616453185 Use this helper to register sys_off handler. Drivers should move away from setting pm_power_off directly as it only allows for one handler. The new way allows for trying multiple if the first one doesn't work. Signed-off-by: Andrew Davis --- drivers/power/reset/msm-poweroff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index d96d248a6e25b..3bf0ea06c4853 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -28,9 +28,11 @@ static struct notifier_block restart_nb = { .priority = 128, }; -static void do_msm_poweroff(void) +static int do_msm_poweroff(struct sys_off_data *data) { deassert_pshold(&restart_nb, 0, NULL); + + return NOTIFY_DONE; } static int msm_restart_probe(struct platform_device *pdev) @@ -41,7 +43,9 @@ static int msm_restart_probe(struct platform_device *pdev) register_restart_handler(&restart_nb); - pm_power_off = do_msm_poweroff; + devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, do_msm_poweroff, + NULL); return 0; } From patchwork Mon Feb 12 16:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30193dyb; Mon, 12 Feb 2024 08:33:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPElzajjcgcyWfx4QsTmHYKzdgN284ca/RML+M/qVTf22x/VuUwfT6C95SNYhTLekn9lHGCVbjSeCXWHfIkTMQtLAlMQ== X-Google-Smtp-Source: AGHT+IG6NdsGp+AYXK18/xFj3d97GnvkPT03yxTXb3VYS38ENG9QL5J58IFU+V2C/pWqpWhgJ7sU X-Received: by 2002:a17:906:685a:b0:a38:2ba9:7f8c with SMTP id a26-20020a170906685a00b00a382ba97f8cmr12138ejs.21.1707755631643; Mon, 12 Feb 2024 08:33:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755631; cv=pass; d=google.com; s=arc-20160816; b=RFz9ZarD6DAvDma8LfJdxjFWs8aneoxQFfVXrXQhv/DfeLwHkhQAtzM9KCgT1Xbn+y nQjsrSdkohjBEYNmLwLgdntLVCI+1S33qeodooI1YaCxzN3DWvNSIGdwH0cTfx77US7Q wRtICpI4Bh8heazmztp4EBRFD6Yp45+7/G4lseMGCIvAXyDgEMxF1MGJ/o4aXahd7iWk V6McXHLqJgVp9KaYhxABlKyxILrKLQIiBpyhNqAEsKBptsLo2w+tBFMHPZOw8lEoyky5 7+md31pNFPl6Y8usQ3SfSSWV4aWPRE171tUt4BWtNBfOZRsijHpU40RA8yLN67r9FNRC 2OfQ== 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=5yT8z6101FegqnCWOdNRzgX95I/RK7WLUUhdSWlfyIs=; fh=LVE+MP85Erulp2aJEnQFpYb9RKNKV60PFiyzVudhhCc=; b=i/ketaUCv50wwxk8PVTRZYBY3KUFIazrRLO58JRp7ZchVsuMD/emcQz1bEEBiuHMGD On894GKkeM0iKxBmRStcB1mPsRTa1Ed0iwrEaJDSrMC72ulfb9IbQxi/F6DOkW31LV20 gihlhy8D4DFSDbNODCEjXdeqN+BJCUkhMMS1C9lmL6H4O1RLVYM1NUR70qNf5RxyqgMB 53qSPQzfbLSv6dmOpq4mS32htXQaeRY0Cycvi7iXNTSyz6ovNowL4/gNcR0gUhwnCOv0 ueSVZcjWMfAyDGtJZcTnlVqlR0LKaGRp0+T1sGYvyaUChoe7I8CRRE6Im0da3X1CCtf5 Y+Aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Am0deps7; 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-61970-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61970-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWe4SUwJT49tKrHwrNrcFUSq9XnT1ERd7xmnqXeFcFs7S+wDt8THW36S8wJTTNNpz4+t9iO7AoRVl6QtsqeVPTz4VwR0A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z22-20020a170906669600b00a3bf369b885si323067ejo.918.2024.02.12.08.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:33:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61970-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=Am0deps7; 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-61970-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61970-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 461831F22877 for ; Mon, 12 Feb 2024 16:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BF074CE1B; Mon, 12 Feb 2024 16:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Am0deps7" 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 9B219405FB; Mon, 12 Feb 2024 16:28:53 +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=1707755335; cv=none; b=CvXp4EHmHhNI9dJLvpE+NNHh48jkcRyoz8bVUO7zoZPTzLP7gLF2gMrwZgeKl8iJgI3Vl18XVhnXjJcMfnY0z/59aEpi56r4TRgpjF0E3qKCjU+FhsO061rRtkgFxhdVJ09iwNWRh2A0YR8ucdmA3r4upSk3dApdzQwrB9pt/ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755335; c=relaxed/simple; bh=BuseNTmNQHKa6n9amDOBClsdZ0D9LZdzj/CNbNLRzZo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q0U/0Ruudu1i5MPixJs6T7g0YP+/pYJbQGfls7BQ9wN8QtSG8kzptXOfdXy66g+7OXGfOqda8EIveK2HfT1Ji+OuKjpZZPACcUpkaUr8pCVxu64l7xpd3hNJfIQQc7DZznIyi0aVtyMaK6o7QdjhtCFC1RfDwT3DQnXsA1lkxBg= 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=Am0deps7; 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 41CGSfIH080188; Mon, 12 Feb 2024 10:28:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755321; bh=5yT8z6101FegqnCWOdNRzgX95I/RK7WLUUhdSWlfyIs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Am0deps7rurZ3m5+7WIRYEImqzpVhDUoJtS4qJdjbom+FBqGon9vKaG5loMrRQPUD /ONxtxIPmcCIkon+2rjSHfDetSxan/bXJvaI9IMYM46oaGmnlTNLqGt3rg8M9+j/UX 5g4xHMLYzqC+xPoZqCdBaU+tpjBEnXjyMLNKaelQ= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSfGc024907 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:41 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE108.ent.ti.com (157.170.170.38) 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:41 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE102.ent.ti.com (157.170.170.32) 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:41 -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 41CGSWR9090688; Mon, 12 Feb 2024 10:28:40 -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 13/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:25 -0600 Message-ID: <20240212162831.67838-14-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: 1790711569452353266 X-GMAIL-MSGID: 1790711569452353266 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/msm-poweroff.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 3bf0ea06c4853..c7eb6dc8e90ae 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -14,23 +14,11 @@ #include static void __iomem *msm_ps_hold; -static int deassert_pshold(struct notifier_block *nb, unsigned long action, - void *data) -{ - writel(0, msm_ps_hold); - mdelay(10000); - - return NOTIFY_DONE; -} - -static struct notifier_block restart_nb = { - .notifier_call = deassert_pshold, - .priority = 128, -}; static int do_msm_poweroff(struct sys_off_data *data) { - deassert_pshold(&restart_nb, 0, NULL); + writel(0, msm_ps_hold); + mdelay(10000); return NOTIFY_DONE; } @@ -41,7 +29,8 @@ static int msm_restart_probe(struct platform_device *pdev) if (IS_ERR(msm_ps_hold)) return PTR_ERR(msm_ps_hold); - register_restart_handler(&restart_nb); + devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, + 128, do_msm_poweroff, NULL); devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_DEFAULT, do_msm_poweroff, From patchwork Mon Feb 12 16:28:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp29890dyb; Mon, 12 Feb 2024 08:33:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXZjEPx1hgil6VyH9A+X/KFAJWR1LKpoccnfWyYyykyc44Oo1JOY8KSkUwxu0SHlwTqbxp8o0g0u9MC0LvfUzVGEIJ/Nw== X-Google-Smtp-Source: AGHT+IELgLx08sleR15Lna+qFJ9vLs5SCF6FKJ0yOhe2hKeSJT/AK/gvzR783l/PmlKBZA5NByQn X-Received: by 2002:aa7:d1d4:0:b0:560:d9d5:7b0f with SMTP id g20-20020aa7d1d4000000b00560d9d57b0fmr5004206edp.22.1707755598414; Mon, 12 Feb 2024 08:33:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755598; cv=pass; d=google.com; s=arc-20160816; b=c9RAjwMFt7gUqtQtAdwyumXQYDmdGeVqy60YfthJtftUThdrF1px0eTOdpt0E1YWKE yjAEVL/08JlSqgyhK04kHOtu6vWk3FkBIoPnj2MB8QpwSwLwfhriBXyVst3NkZ47HJbC fx433QpoCmU+NdJ+cej8cOiLASJRKbb5cN/V9ez9/bAI8UF9FYXcttlgazEwq+FSyrwy wD+LKIdmzp2mX1rM6vDIl/TOvHRTne+kwmvRGoHn/b8kNsML2xf+sPMqw5Q2MTKDUCmO mnw+D75vXkwR+WZgS7RHrEFD/HZRGNUKXleQkGDBZDJ8dfdVIGKeIBnxk3UGZ1lXoIJU Dg9g== 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=+yoH0oyAcvSMYuuy/HNbc6iZw+avNZNinJT/iIL/4IE=; fh=K33/rwd8WBL3i1rSZjaBJw8eXJjwaXRtXDC3DbQOeX4=; b=fFvnNbiodh2BAexkXt519fW4dBxbKahFJFmMT25oJT1yquCCPhn7SHsMpLOAqF6+56 wuxTaizNKRBrCpNFMPhkt7J7fpnqA5RDuLiMaQfh8aiW+qfhGoItf0Cx54DfjPwCdd71 MByh8lr6BXOSVxEUQ0i3TV+1e51dpd3mFyrtkH/ST9sYqbdTXYubu6c1HsL2s3zgz2IA Y0g3umkVjt4IOTF19WsN6EJDArp7JglA08CM9QNIYSgIJLDKh5Xv59rjUSaK71jUTZKr B4c4/lfrh3LArudL446XgKLO6TfC6VmpGw9czi7s7AJJGQN9FAHJG7WK/VONWvP3f7xC 1RbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TLK16n9+; 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-61967-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61967-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCXRERzrW/JFj9qG+YGaOdI7rHq/Jz3CFdnd3vVgsG+csAQ0/NP/21uVyDUMgUgDP/PmKJesT/8M8Hgnzo00ND6Hhr5h6w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s23-20020a50ab17000000b00561781085a5si2378727edc.254.2024.02.12.08.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:33:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61967-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=TLK16n9+; 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-61967-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61967-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 0A12A1F22387 for ; Mon, 12 Feb 2024 16:33:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 818A14C627; 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="TLK16n9+" 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 0578C3F9DD; Mon, 12 Feb 2024 16:28:51 +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=1707755333; cv=none; b=gNGYccmxXTQOFUOeJTjFqEwWyv7R/xG5BF2E/1UYXBR7QYyOlEIIPcI3P0LAEDghNJFNDYQlDsQxF45KDSXx/t/o5YiGmFB2+1MpUtrO9t+I352+qgpQfHu7XHhFtT/1SxEjwGDp3NQ5dohtCwST8n/34avKjWPwpv8MP9LJiR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755333; c=relaxed/simple; bh=b1HCM6PNhU5iOFP0yy2ZAE2FiVY5BYt6sfsBzt/lauQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JZmLGvmEJUHS7PJb8bsfa1jkxQjA3QO73mUQC5JBf6Ar9XWhLpyLhQvgiSlszrWUkBQsVMMQnO930i2Em+jsukpVRU3Uwqyu0535ygIPsR0IfrJOpWUrZxcJvXiPHEDUwNZ3fH0cu0ngI9cU333Z9tweBrcEmBlZFX2Wd7SHxlU= 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=TLK16n9+; 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 fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSgvQ045218; Mon, 12 Feb 2024 10:28:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755322; bh=+yoH0oyAcvSMYuuy/HNbc6iZw+avNZNinJT/iIL/4IE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TLK16n9+GoYhFp3X8+Bkq58+TF+rHyEGH68TaeP6+J15nmF4tWNuo96NjrW8ke5j1 c2kc/JV4Dl59yTQDPmCCJg2OruvzrIRDVtURi3K9cKICpPrsKOsJVjj24kGTXu1DL3 IcHlxuXakdZWIFr0Drl9wXmjKFUdkEwnsfsy5ORw= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSgXb046974 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:42 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE109.ent.ti.com (10.64.6.30) 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:41 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE115.ent.ti.com (10.64.6.36) 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:41 -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 41CGSWRA090688; Mon, 12 Feb 2024 10:28:41 -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 14/19] power: reset: regulator-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:26 -0600 Message-ID: <20240212162831.67838-15-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: 1790711534689899537 X-GMAIL-MSGID: 1790711534689899537 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/regulator-poweroff.c | 36 +++++++++--------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/power/reset/regulator-poweroff.c b/drivers/power/reset/regulator-poweroff.c index 15160809c423a..fed4978e38580 100644 --- a/drivers/power/reset/regulator-poweroff.c +++ b/drivers/power/reset/regulator-poweroff.c @@ -13,18 +13,15 @@ #include #include #include +#include #include #define TIMEOUT_MS 3000 -/* - * Hold configuration here, cannot be more than one instance of the driver - * since pm_power_off itself is global. - */ -static struct regulator *cpu_regulator; - -static void regulator_poweroff_do_poweroff(void) +static int regulator_poweroff_do_poweroff(struct sys_off_data *data) { + struct regulator *cpu_regulator = data->cb_data; + if (cpu_regulator && regulator_is_enabled(cpu_regulator)) regulator_force_disable(cpu_regulator); @@ -32,30 +29,24 @@ static void regulator_poweroff_do_poweroff(void) mdelay(TIMEOUT_MS); WARN_ON(1); + + return NOTIFY_DONE; } static int regulator_poweroff_probe(struct platform_device *pdev) { - /* If a pm_power_off function has already been added, leave it alone */ - if (pm_power_off != NULL) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered\n", - __func__); - return -EBUSY; - } + struct regulator *cpu_regulator; cpu_regulator = devm_regulator_get(&pdev->dev, "cpu"); if (IS_ERR(cpu_regulator)) return PTR_ERR(cpu_regulator); - pm_power_off = ®ulator_poweroff_do_poweroff; - return 0; -} - -static void regulator_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == ®ulator_poweroff_do_poweroff) - pm_power_off = NULL; + /* Set this handler to low priority to not override an existing handler */ + return devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_LOW, + regulator_poweroff_do_poweroff, + cpu_regulator); } static const struct of_device_id of_regulator_poweroff_match[] = { @@ -66,7 +57,6 @@ MODULE_DEVICE_TABLE(of, of_regulator_poweroff_match); static struct platform_driver regulator_poweroff_driver = { .probe = regulator_poweroff_probe, - .remove_new = regulator_poweroff_remove, .driver = { .name = "poweroff-regulator", .of_match_table = of_regulator_poweroff_match, From patchwork Mon Feb 12 16:28:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30371dyb; Mon, 12 Feb 2024 08:34:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX20uHXiG/4byBv/JHSyh4soqt2CDu9ODioWhTKLfVRyzeGKUn5Emi1yCXftVDAc/iiKGUG7zSufZL4lkCqdFoEB/EqNw== X-Google-Smtp-Source: AGHT+IG4x8K2E02JLZbl4JqnyeblgrlbfSMqFUNTPwOWdyvCwWOv2IAAGGPBWlujBh+kJWYRMQE/ X-Received: by 2002:a17:906:dfd1:b0:a3b:fd6e:c725 with SMTP id jt17-20020a170906dfd100b00a3bfd6ec725mr4285763ejc.52.1707755652799; Mon, 12 Feb 2024 08:34:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755652; cv=pass; d=google.com; s=arc-20160816; b=0S+bXUuUxJSgPUXeeQAGEEsY7fUtaOjNWhq/Bfw6MQK+zzm02FNjerPO1oxxN8J0jI e4j7m2IcHgGr1NHViFffsDGpONFJwn3xAVj6GJiVlbFqCrNEjPeHCMkCms02A3nsy8VT Gy9qnaKS4hY/8OE32dHRxjzh8dk1IU9fRj31SH0G3t0emG9QnMnt8AntlvQvp/PGJoZN AU4ZSHQBK8Wdeq+fO3CpVJfcwPOi2A+J3NCJWXSFQoOZ1MjVYGHezssWhLXhT1hCHJvk s5+KnYR87jWW8ZzJhbzvRnW5YyAGl8z3lLZuSalISxwIM29qaC+rMyL5GkM157OpOA5H GRsg== 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=psW+zR+255VuGRBEiZa3qV2ZSoJCA9HDeWGIZlh4BNU=; fh=gfivSID3vqOpx1sziIZWULfRmsljT4OMplCG26mClDM=; b=waHeeHhp86hpDmuB/50HVzARZ/GF8m7cHA8mf7goGqgOfs+O7rw6bAjWvAI3MCX3fN k5YkvrLV3QQUSFOhmhpSJFACBWWY7Z9QDgi7OoGdsZROr4BxcoqYRzAPuO52Ijr9CQek nkYl5pNOvVUK1/otFDyP1h64AQkQa8NPqT/8Y7LGCAnL0hbHkJplKGpZoi6r3rcHyi+b dYgLgueuLatYK8fRCpQmtmGAAsoUpmixxi+9EFqKbjzBbQ3JnvIypeg38Qw4QdL9WGGj 6Q8MMwG1Ki6OH4T9lUXHkYQycrB1ZJii6bq8XSOyc5k8/iWnCWgt5ShRpBiaMX2TmFN8 KkCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ufBQhUhO; 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-61971-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61971-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWSS3wgr6H0Uylj8TXXg4vzDnyRx5xdCi6XzUHRh+6Tb8R53M0sR7YIo3I82oHMRZInc6+u6Xy8y1J0tY42bruR1XrZCg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kb9-20020a1709070f8900b00a3cc7df3f96si324663ejc.827.2024.02.12.08.34.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:34:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61971-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=ufBQhUhO; 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-61971-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61971-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 6C4641F2227A for ; Mon, 12 Feb 2024 16:34:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33E574D5BF; Mon, 12 Feb 2024 16:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ufBQhUhO" 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 40BE74177B; Mon, 12 Feb 2024 16:28:53 +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=1707755336; cv=none; b=dcEmOH26+4UUZFLBo8LZQILZ9I7GIp7GpU1UiB0QIEB9bKBiF99X5qEu9xQvbZPYHngSks5PqBOCfwWGqjanyA3P0v8Ui5TobaJ6PsPOgpYWApEhyOSOa1DbS0whNh49SmnQ3L2RGLYnw0S8wKh3tEHyP8M+/Awf9N/w6MInaaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755336; c=relaxed/simple; bh=piMJuCp6Oyf7VRRgvElf9jQlTaTY6OoJDvy6PpEE/uE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O6DJYMT/pVbuQWomiM5TUL5Amfjeuj4YpQ434oqvgHubbrrpAD2AU+oBth8G0KVRa0M7I3zbTTiteBiYPahbx9mI1MhCeVHiyo6InZL5MhycwtbLcrufK6o+4yZWkSBjVq4hYOtjjxR6gDcPU8QsQ53UV56SkwBBX7mkICTN0uc= 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=ufBQhUhO; 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 fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSgGE080193; Mon, 12 Feb 2024 10:28:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755322; bh=psW+zR+255VuGRBEiZa3qV2ZSoJCA9HDeWGIZlh4BNU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ufBQhUhOyaz2OXgHddw1pyKot9JJBbujcj2DIYnCdqvz+9fZzLXva/cjBiwxQRQdu H1LT4uHDVyujlDr2v2W5Ol4d/Lge+5afSF3YrJKFkJU+c0T8/b7vAG8EmvHUDvciJI kxgqr71fi2ZXqzcpwSyasJ+0wHpAYojBYYjjhKO0= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSg2x041990 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:42 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE112.ent.ti.com (10.64.6.33) 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:42 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE114.ent.ti.com (10.64.6.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:42 -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 41CGSWRB090688; Mon, 12 Feb 2024 10:28:41 -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 15/19] power: reset: as3722-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:27 -0600 Message-ID: <20240212162831.67838-16-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: 1790711591682929070 X-GMAIL-MSGID: 1790711591682929070 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/as3722-poweroff.c | 30 ++++++++++----------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/power/reset/as3722-poweroff.c b/drivers/power/reset/as3722-poweroff.c index ab3350ce2d621..bb26fa6fa67ca 100644 --- a/drivers/power/reset/as3722-poweroff.c +++ b/drivers/power/reset/as3722-poweroff.c @@ -11,6 +11,7 @@ #include #include #include +#include #include struct as3722_poweroff { @@ -18,22 +19,18 @@ struct as3722_poweroff { struct as3722 *as3722; }; -static struct as3722_poweroff *as3722_pm_poweroff; - -static void as3722_pm_power_off(void) +static int as3722_pm_power_off(struct sys_off_data *data) { + struct as3722_poweroff *as3722_pm_poweroff = data->cb_data; int ret; - if (!as3722_pm_poweroff) { - pr_err("AS3722 poweroff is not initialised\n"); - return; - } - ret = as3722_update_bits(as3722_pm_poweroff->as3722, AS3722_RESET_CONTROL_REG, AS3722_POWER_OFF, AS3722_POWER_OFF); if (ret < 0) dev_err(as3722_pm_poweroff->dev, "RESET_CONTROL_REG update failed, %d\n", ret); + + return NOTIFY_DONE; } static int as3722_poweroff_probe(struct platform_device *pdev) @@ -54,18 +51,14 @@ static int as3722_poweroff_probe(struct platform_device *pdev) as3722_poweroff->as3722 = dev_get_drvdata(pdev->dev.parent); as3722_poweroff->dev = &pdev->dev; - as3722_pm_poweroff = as3722_poweroff; - if (!pm_power_off) - pm_power_off = as3722_pm_power_off; - return 0; -} + return devm_register_sys_off_handler(as3722_poweroff->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + as3722_pm_power_off, + as3722_poweroff); -static void as3722_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == as3722_pm_power_off) - pm_power_off = NULL; - as3722_pm_poweroff = NULL; + return 0; } static struct platform_driver as3722_poweroff_driver = { @@ -73,7 +66,6 @@ static struct platform_driver as3722_poweroff_driver = { .name = "as3722-power-off", }, .probe = as3722_poweroff_probe, - .remove_new = as3722_poweroff_remove, }; module_platform_driver(as3722_poweroff_driver); From patchwork Mon Feb 12 16:28: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: 199905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30619dyb; Mon, 12 Feb 2024 08:34:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/0oDEo4You366mZiHRxa2pwQqTYlSuEy52XTls3kHb9kmduQSZ94iv8TWGZxe5jhaW9IY X-Received: by 2002:a92:d3d1:0:b0:363:b33e:c8f2 with SMTP id c17-20020a92d3d1000000b00363b33ec8f2mr8297288ilh.11.1707755678782; Mon, 12 Feb 2024 08:34:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755678; cv=pass; d=google.com; s=arc-20160816; b=U7a9TjlQzrd8LcVxEqeaIW+uiFUK+HYqIpz8XxqXY0qQTDPD1vHf5l7zbgmaz2M9Rn /k4C1TgmkOiEnoLs60maH5/hqB0Lu85ByEYxhlaP9PNOpmgHYakldBE1McMSP0/UArQ4 6rmlmZVXhNPhyra+BbuUW0r018ERe+9d7LeJnISYXi4+Uhqw4iWYxFOZEuBQGSXglybi l4mHVfzSdDeBw6laXg+/2B3A8WbaFN+hyCbDkvD9h9Zy2oUnPKoDRW7UaBqKZapPpnv4 49i4ktMh3+LdWubMPxeJg1Vc7TN2DOg8FssqLJIE9GXaeBQBOooQZhvZOQru6ans+/qt AZfQ== 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=WzOWw71XNiTDn9UhRVmQ1YL+kbl79QddxFr5AngwFzk=; fh=E3/0P6UUxapPE+JncM8V5lT7mxBxI/hkf80iw+5tf60=; b=C1t7Oa0tNSwdvhhWXAv07u++s9uMDx4iKR7wsmI+y7fFCzTddlLfWT0ETVkNMMcQVp 1PfHBNxllC6ds89R85FM4Q9RM68+NU9HezPkRGzzSBgJMQ3Q5Cptsk9gAw+h7fS4TK+4 nvwXte2JGut/AstJgQesOd/BT4GavIkMQSs3uCXkybm9B15pBQiOcHhKDnt+8cCQzuCR +U9eTHjJ96dRPKTr24Xdj1jfhaEVvfm5/CqECb2AeG83+at2BmqUhN7Yr4EEf0uJfmmO jVDX7jBSXIyImvwNhRPDOAshVLbxXpTo30tAUHgNacYSmh1Y/fuabbrlJVsg2EK7CxfM 3Rvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JOB2TDY7; 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-61969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61969-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCVQ07aR/ojxEuomFhCek0P4vHKgX0KcC62eJc43jNbBrHYBZg8+ozj/oEBnZGBMIT411KXWAG3oWQ5CEFC0ZJSDcmK0Dw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k190-20020a633dc7000000b005d9135f4515si470871pga.335.2024.02.12.08.34.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:34:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61969-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=JOB2TDY7; 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-61969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61969-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 4A982B21AB2 for ; Mon, 12 Feb 2024 16:33:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28B654CB55; Mon, 12 Feb 2024 16:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="JOB2TDY7" 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 2E8E43FE2B; Mon, 12 Feb 2024 16:28:52 +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=1707755334; cv=none; b=AATA74HOvilg7aHLn5pacndFiULtZK0IgEI/RNKefD2YktErxEvBJngmfDpniKFZBNfTS74rhr2CNdPyGfMVuvccYGCKJUQ0ScLYuSmcU7IRfAKTEBGViwYwDE/aJSlr6zOUuqOnyoyu4VK8/JLzx7bwBKiMDi0q+Re0g/yzfZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755334; c=relaxed/simple; bh=HDoP9l78EFZDdW16hNeR9IATxUCA5uyr6j+jeh40ipg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n6U++4cfp/Qm4RE+ohIXbPGAWop9wkppLNUh1A0TqJbA0B/po+Besb6HL2wzTS+EwS7nUrQebSsYx0PdH57/3zSaQP2rqU6RwgT/6/qNxEZE6AVD27f4kBLmDJpA9yy8rzkQP1htl2o0H9lWSmyfi5fxZTOkJtmO7DrSMCHM7dY= 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=JOB2TDY7; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGShw5045223; Mon, 12 Feb 2024 10:28:43 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755323; bh=WzOWw71XNiTDn9UhRVmQ1YL+kbl79QddxFr5AngwFzk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JOB2TDY7HOl6IEiw80vVvRT4OnSvgy0nPrwBER278hgGG/0obT74ZUI+REh9JUhHS GUVb30qnQAdIUyCx+I9HAOt5n5m+d9RV4YUgG7F0lJImX+syZo+oF45ERwnhwcFkMB b6gZpi3KuB3ahdIM0eShKATh0neKDuJsU82cFGHE= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGShNB024937 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:43 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) 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; Mon, 12 Feb 2024 10:28:42 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Mon, 12 Feb 2024 10:28:42 -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 41CGSWRC090688; Mon, 12 Feb 2024 10:28:42 -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 16/19] power: reset: gemini-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:28 -0600 Message-ID: <20240212162831.67838-17-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: 1790711618742286353 X-GMAIL-MSGID: 1790711618742286353 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/gemini-poweroff.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c index d309b610142ce..06d6992dec892 100644 --- a/drivers/power/reset/gemini-poweroff.c +++ b/drivers/power/reset/gemini-poweroff.c @@ -70,12 +70,9 @@ static irqreturn_t gemini_powerbutton_interrupt(int irq, void *data) return IRQ_HANDLED; } -/* This callback needs this static local as it has void as argument */ -static struct gemini_powercon *gpw_poweroff; - -static void gemini_poweroff(void) +static int gemini_poweroff(struct sys_off_data *data) { - struct gemini_powercon *gpw = gpw_poweroff; + struct gemini_powercon *gpw = data->cb_data; u32 val; dev_crit(gpw->dev, "Gemini power off\n"); @@ -86,6 +83,8 @@ static void gemini_poweroff(void) val &= ~GEMINI_CTRL_ENABLE; val |= GEMINI_CTRL_SHUTDOWN; writel(val, gpw->base + GEMINI_PWC_CTRLREG); + + return NOTIFY_DONE; } static int gemini_poweroff_probe(struct platform_device *pdev) @@ -148,8 +147,11 @@ static int gemini_poweroff_probe(struct platform_device *pdev) if (ret) return ret; - pm_power_off = gemini_poweroff; - gpw_poweroff = gpw; + ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + gemini_poweroff, gpw); + if (ret) + return ret; dev_info(dev, "Gemini poweroff driver registered\n"); From patchwork Mon Feb 12 16:28:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30418dyb; Mon, 12 Feb 2024 08:34:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVEO1O56N8M+JMuHezCwaLiZJQCLKUzOx/aiPk6PwK37DxRPTKgK67ZtG87C/tQNflnAHnW2PuPQd7FSTdsEDtDgITroA== X-Google-Smtp-Source: AGHT+IHewDCS68rBaYKxwGv6Xhrb9wOljt+Dky+1AqAv1uom2b18Ey5ldhpVoqZenBLn9w0T/hxw X-Received: by 2002:a17:907:76cc:b0:a3b:ae82:a721 with SMTP id kf12-20020a17090776cc00b00a3bae82a721mr4559179ejc.77.1707755657289; Mon, 12 Feb 2024 08:34:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755657; cv=pass; d=google.com; s=arc-20160816; b=a5mS+ckXVQoog0YMlRzvLyX32tTWw+Jb1+WEF+Fb9FplqQjZ1WP+rz9l7cP2xnK6Xx v49rinc/JPyxgyTDU96ZV/ecG85btZ5rw7EdoJLB4pXjilKtVo9xGw5FzdKx3Y1axJkT 0YbpRh4YytizwzRHWDNnKPexf8VJ+ItYkgIGhYU7z/ir1JI63svN/+eLEzjU+onU1DSZ bu/LAjDVyi3n9jhH+gscfJI8agbhhvVaKpzjHBrsIFQNCZJcANeRvmeDaQXzIKvg5Tgw VPVpWlQaURlprCLhJd+paJcEXfPVMwUwq1J2gE6/FHT34+he7RZ9CJbqTT3nwlXbIpPY aUbQ== 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=2C083AYY3Dbpmc6BgF2r63gVH+xSPvAPWXFMl2z3vuQ=; fh=YBjzo9gJtOpJSbCsQ7o/XWGSUmnayPmrnaQ4cwqNkNA=; b=O6yubhL+jBDwp31Jkp5Zj2jjjg/PAdCBGtRWxS7bXu5RDbJsdV1MQlBDBqmzyKnvPa sTCYU3BwGcZf3XSPnuSymM89I327ehxLTeDvYX19v+uhvrHsR/6sRhhzqVpTNiqj9cxu i+e7GmbdVVJb8OOBs/TwA/pDR3xtz++MTFfAhoznfZv09y8TH88i7zu1fG2/fhifqDsl OcTyN+/HxePNHILWmxegdlwqsfiFJqT39ffNYSB1hem2muGXw0kVQHULe+ZanJuCIpkj NCVXPun+BREKUbC50RnQwFD+CdDYNe8Uh0kFuHuKdy56uiwI+se8+y8zXlPOXNPnh+BZ 3n8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FhZJa8zX; 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-61972-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61972-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWOF9yp6dkqPF1IyFwWuaXLtMcOzzOtBOYH3+fbem+lsMsyDLGdjV/DNQmR1NwcdSs91wwGZxlYOGufPUyJrddODTbVzQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a24-20020a170906275800b00a3be99f21f3si314637ejd.767.2024.02.12.08.34.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:34:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61972-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=FhZJa8zX; 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-61972-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61972-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 E15841F22987 for ; Mon, 12 Feb 2024 16:34:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A1E54D9EC; Mon, 12 Feb 2024 16:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="FhZJa8zX" 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 7A11845979; Mon, 12 Feb 2024 16:28:54 +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=1707755336; cv=none; b=mercUKsx73G95rIYFT3OU4eMjFIEs4x49cKA+azXjEmM64zqX6iR/nCxpRm8RJ+KlSxCKjs0K3x+LaA5mVKilnRp0XvVjUmPhdVge1WWouLMD3xaCfKfapUdHxSO2E/y7outFRtdsNmlDdvLDG5NMA/+PkS/JM4JUkKBYa95EXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755336; c=relaxed/simple; bh=uYeg52mDdc1d+Ytv8BgQ3wN198N/i0H+W5WTdHa6VeA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K4vaekfB2vWZ7JOL54KNNmJTqT5GkGmzm/d5vTA3ZNA44Hm6tEZWzOFsddOBl3bAOft5T5PKbxD7N13hXNgbawR3B1gd3HIrlJe9yqtQTSytsMmcpGiC0z9XlQT4xl/m9HeLtOyVzKZHQMxpTdG3MXdHQU8TPt5AGW1Drv0ygFE= 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=FhZJa8zX; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSiaq045228; Mon, 12 Feb 2024 10:28:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755324; bh=2C083AYY3Dbpmc6BgF2r63gVH+xSPvAPWXFMl2z3vuQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FhZJa8zXqUlGfri6+7NSdSKghrmp/oFQo4NCFcevA2xq9hK7sk56QPLMhJ+UVuRTf 55iI0W69dhALrbMVBskOar7brWAML7N4FHQRw+rhehtt6nfM0DBXF4SKuVXWfnP4Xc j5SJRp75LxIcJvvYxEPu76DV7TPUnRWaJqCh3nZs= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSihZ024951 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:44 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) 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:43 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE106.ent.ti.com (157.170.170.36) 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:43 -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 41CGSWRD090688; Mon, 12 Feb 2024 10:28:43 -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 17/19] power: reset: restart-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:29 -0600 Message-ID: <20240212162831.67838-18-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: 1790711596026597397 X-GMAIL-MSGID: 1790711596026597397 Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/power/reset/restart-poweroff.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c index f4d6004793d3a..fcd588f9ae9d3 100644 --- a/drivers/power/reset/restart-poweroff.c +++ b/drivers/power/reset/restart-poweroff.c @@ -14,29 +14,21 @@ #include #include -static void restart_poweroff_do_poweroff(void) +static int restart_poweroff_do_poweroff(struct sys_off_data *data) { reboot_mode = REBOOT_HARD; machine_restart(NULL); + return NOTIFY_DONE; } static int restart_poweroff_probe(struct platform_device *pdev) { - /* If a pm_power_off function has already been added, leave it alone */ - if (pm_power_off != NULL) { - dev_err(&pdev->dev, - "pm_power_off function already registered"); - return -EBUSY; - } - - pm_power_off = &restart_poweroff_do_poweroff; - return 0; -} - -static void restart_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == &restart_poweroff_do_poweroff) - pm_power_off = NULL; + /* Set this handler to low priority to not override an existing handler */ + return devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_LOW, + restart_poweroff_do_poweroff, + NULL); } static const struct of_device_id of_restart_poweroff_match[] = { @@ -47,7 +39,6 @@ MODULE_DEVICE_TABLE(of, of_restart_poweroff_match); static struct platform_driver restart_poweroff_driver = { .probe = restart_poweroff_probe, - .remove_new = restart_poweroff_remove, .driver = { .name = "poweroff-restart", .of_match_table = of_restart_poweroff_match, From patchwork Mon Feb 12 16:28:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp32008dyb; Mon, 12 Feb 2024 08:37:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXS5SAKzkNpJkxdR+u0G71g1jfQ1tjgV1N9JrDUXJLa9+pJw56lBH8dKUQfCTCycmpFiKc1U4c/pOZfHwg4Bl52VzziFw== X-Google-Smtp-Source: AGHT+IGMXAP1yD57TggnL6Z5eZxE8ypQVJSVaRepiM905/8R9gryoxziz7GGwMlLdU9UdvwRWsIx X-Received: by 2002:a17:902:ec8e:b0:1d9:efc7:1c4e with SMTP id x14-20020a170902ec8e00b001d9efc71c4emr32022plg.6.1707755831904; Mon, 12 Feb 2024 08:37:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755831; cv=pass; d=google.com; s=arc-20160816; b=eg/sGnI5bB6ew4faWb4Rjd/uboFVtfqRCxMdTEiKLAi3M+Sb0w6Gjje7jn0XOyfbzE +er0/+TIy0vlQ2RgkDsCLs3q9P6s981f6EmWNLhm6ublWVPBDH66uT73nEmHeZq0ZBPd 1jtEg0/795HEzSeu1OTzTrmYGLoqCgbL978fPhYwksmpNRtPPvjJD8rzwzgP+Ngs1VZc +hrV3oLBVDkmJaXiB0f7doL27VNCXOQKFa01qYC0mHgd9uUJLxE4R3l3+sWFLU4i581Z WY0egIgstEgnNpt/H4JhaCMaY4c2RgBN2DoyC76SLcCPf4w4OSoh6YH0wcZxnjZD7Wh5 1KAQ== 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=Kv9JczQeQR+ifDe2YtY2D7JV7A0GaYQwadF3KmYeaVc=; fh=gqQaRvzBX/lCwVJbw1EzLi1VseCiyeiujtoavtj1oo0=; b=K92aOknGUKYSdB6+xb5pNr+WzliGE7HrQfXQ8jbzT+OplZgZ7usLmMEqV5wahIoBTK WYt5l4itilMwse/mLXiskMeCU3mmEQARnPVPZJnkYCCIXFCnXjYCOw/l30usHidr7gq6 eCMMLjBsyPoZwnQ27stFeqqUJ+XrKUeAnLRPY/VPfyIFztyocOoK2+jAX8YF/iKFngws FI1JI8/AQHdmFDl6c1refun41mBovz4eyBHxRowkA2alkzrVzMSNTjkorWMNcwcNJ6Vx Cice9oB1l5dOpSAUVgL1gJxwz6IBycCaiSTIDjl4QmuvXGDdxdCCURuk+4NqOFF3vvj0 rNYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kuV50zaN; 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-61973-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61973-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWLgjvkEQVAx4aRkGjFff7j1pS3ULIMMFAV4P+HSm96rqFuGG6+vpvyMz9O3u15V/BaoeaHrBfJNia/Khpq5aI8vE/8oA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q6-20020a170902eb8600b001d973ab7bd3si475046plg.48.2024.02.12.08.37.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:37:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61973-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kuV50zaN; 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-61973-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61973-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 5832EB229CD for ; Mon, 12 Feb 2024 16:34:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 969CB4DA16; Mon, 12 Feb 2024 16:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="kuV50zaN" 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 D0D7847A5D; Mon, 12 Feb 2024 16:28:55 +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=1707755337; cv=none; b=CcWaNKD8gtvt6g9GMviuTFZ15qoinIlzPWPom49IUcuwqRQqX2U7xzpgMXWRG93RFbL4lFOAudfIaEANj4dtnOX4v8pTXKSC+Zx1JtTiZVMWXBbhIGvoYBBdpd32D8eAmC2Mt5fEtfxT+UILc1zYKbSYrYvTICKSrv92w6zUnf0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755337; c=relaxed/simple; bh=RxXJw64OwJAtdWJLJWPIzMTgt8BfdaiVjURfYs0Yq3k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Beo4GE+98R61XlwXyuGDxX94MtMnV0lN4r6dbyhuYH3REEDO3LtA17X0OWR/uixjJmMiSrApzu5RXg6c+zFuaFNeSop3eJvqwhbiMkz8A83bGRBTh5E/fIJ3pKPDEMzdz7dbdFANmefGaxWu0NLL6Sw+nM5mygcF8nYu9BDBP40= 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=kuV50zaN; 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 fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSiiF004180; Mon, 12 Feb 2024 10:28:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755324; bh=Kv9JczQeQR+ifDe2YtY2D7JV7A0GaYQwadF3KmYeaVc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kuV50zaNhFmvV87ZrvdHIO4lkV6nZ0/ikkX3WKcyT3ePHjBQBVJ6OjF3vaqmEvfFI xB25hPpyNLfeVYwmNdv5t5PPpkKsZLcU20PsWFrzDyohAtfsYvgZ/AR9mJaavVVX2M LLrPpxH4MquVAIuynWxccSb2B/NNe1d66+i7//cA= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSicq047017 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:44 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE111.ent.ti.com (10.64.6.32) 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:44 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE108.ent.ti.com (10.64.6.29) 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:44 -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 41CGSWRE090688; Mon, 12 Feb 2024 10:28:43 -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 18/19] power: reset: syscon-poweroff: Move device data into a struct Date: Mon, 12 Feb 2024 10:28:30 -0600 Message-ID: <20240212162831.67838-19-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: 1790711779206276601 X-GMAIL-MSGID: 1790711779206276601 Currently all these device data elements are top level global variables. Move these into a struct. This will be used in the next patch when the global variable usage is removed. Doing this in two steps makes the patches easier to read. Signed-off-by: Andrew Davis Reviewed-by: AngeloGioacchino Del Regno --- drivers/power/reset/syscon-poweroff.c | 40 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index 1b2ce7734260c..19c8da997b4c8 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -15,15 +15,19 @@ #include #include -static struct regmap *map; -static u32 offset; -static u32 value; -static u32 mask; +struct syscon_poweroff_data { + struct regmap *map; + u32 offset; + u32 value; + u32 mask; +}; + +static struct syscon_poweroff_data *data; static void syscon_poweroff(void) { /* Issue the poweroff */ - regmap_update_bits(map, offset, mask, value); + regmap_update_bits(data->map, data->offset, data->mask, data->value); mdelay(1000); @@ -35,22 +39,26 @@ static int syscon_poweroff_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int mask_err, value_err; - map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap"); - if (IS_ERR(map)) { - map = syscon_node_to_regmap(dev->parent->of_node); - if (IS_ERR(map)) { + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap"); + if (IS_ERR(data->map)) { + data->map = syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(data->map)) { dev_err(dev, "unable to get syscon"); - return PTR_ERR(map); + return PTR_ERR(data->map); } } - if (of_property_read_u32(dev->of_node, "offset", &offset)) { + if (of_property_read_u32(dev->of_node, "offset", &data->offset)) { dev_err(dev, "unable to read 'offset'"); return -EINVAL; } - value_err = of_property_read_u32(dev->of_node, "value", &value); - mask_err = of_property_read_u32(dev->of_node, "mask", &mask); + value_err = of_property_read_u32(dev->of_node, "value", &data->value); + mask_err = of_property_read_u32(dev->of_node, "mask", &data->mask); if (value_err && mask_err) { dev_err(dev, "unable to read 'value' and 'mask'"); return -EINVAL; @@ -58,11 +66,11 @@ static int syscon_poweroff_probe(struct platform_device *pdev) if (value_err) { /* support old binding */ - value = mask; - mask = 0xFFFFFFFF; + data->value = data->mask; + data->mask = 0xFFFFFFFF; } else if (mask_err) { /* support value without mask*/ - mask = 0xFFFFFFFF; + data->mask = 0xFFFFFFFF; } if (pm_power_off) { From patchwork Mon Feb 12 16:28:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp30702dyb; Mon, 12 Feb 2024 08:34:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeDjvIf94cXmGzKtcUZb10NXmotfFQrlJrqa1Bz1Ukq1Hy0skNN0nb+crKoNr/0ViGXL8N X-Received: by 2002:a17:903:44c:b0:1da:34f5:57a3 with SMTP id iw12-20020a170903044c00b001da34f557a3mr1533301plb.42.1707755688294; Mon, 12 Feb 2024 08:34:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755688; cv=pass; d=google.com; s=arc-20160816; b=xPhFGPo4N1w70hXt7uGrq5Pt+xdHf/rWiqfdl/nT8v5YyFUMgTvpeHK5h0CdLlNZKm 3K40I7lKfRo869D8I5pDghb/X9TxK/X73w7zJQ1Evls6gZ9e4rRINLX8DoegGQqv6Cql xv5qE0YeEtFstbBTOtMwF/lvIvZaheaRe8apgxu6hTxUqZBhRp/PLBTZz5WnrwlDaOtl h3fNSsM12tupdku52RYZL7tB9Eij9TVVvlqZ7PW2bNzdLO11nmOkLXI/1gBN0pY/6Pzr sAKwmYXsiSiDNSiE9Ud//+OwENcbik3msTZHPl44Okyn42Pxpc+sP0J0/xSywh8t8BfF 9Pcg== 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=PD7pULEBclq1+qdU6GR6A9JMygAqQNWEIr/SChGU3tQ=; fh=62F7agJxuqm9l1ztY5x+iZPjX681rPjNZk5WyKbXPFo=; b=rZrlL+PNGVfm/L8NsAW3WtPI/V9M+fqZoA4Fz084xDfLqrhELwuLA8PBDRHYb9+HcP LaQp6xLwuIQzVWdFa8ZYkC06OOwDlgu/iEabfyUXILE9Acyd37JlS7yEQYKZWDXF98Vt ceDW1wTkzP6uQtCGYxqyH2MKKGmg+ADziy+9oTf8HQPOJUQf4jO9dpLUq+tX2FEZ/pSR fJt8lLB74XLxuZbrWfHyzNG64IYaGtrPwLRbbCvSounKFUAmmPw20W5Uoo1+q+8MMyj/ OVkue81bf2V9NsROtm+8lqqRnYFJtHLqQ2QvrfxfDLwznhMMfOB/kk88nRP1TpQlgXIz F9Lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TviMBq6w; 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-61974-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61974-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCX5rL8Lu4UWLjMV+68GFgmjiWtZm02vtnXKdO1N0AB1LmNes0cRhct57Y8T/EM29Ij1zp0ZkmrRzEiPp4nObiLeT0bc1Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u3-20020a170902bf4300b001da2c0201besi483887pls.139.2024.02.12.08.34.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:34:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61974-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=TviMBq6w; 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-61974-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61974-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 535102818E2 for ; Mon, 12 Feb 2024 16:34:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AFFF4E1C1; Mon, 12 Feb 2024 16:29:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="TviMBq6w" 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 AFCEC482D4; Mon, 12 Feb 2024 16:28:56 +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=1707755338; cv=none; b=WytZ14pykWY5ZSE5343BMZKF6VopuUb/Xmr4brQhxbjcvpzYPFBGS8jHGE5eTJ+Ko1iHszijEJV6h5M3pc07IuLVZCAgJSrzzaY1IKTLpkjXc10gntxin+NSUiCw5gRNUZvMwCsFaiUud/KqesxF6IUpJytrVyzFXQ8T9EWCI2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755338; c=relaxed/simple; bh=IuAlQRQxIKplKocYo89p9ZMqFmjlfm9M52X+Y3/F7BM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z6hEbTi3ZvngevECihA62K2fxFdxN5TI0S1ySHDYRT0dif3Jdg96c9yP3vRNFkJtjrHEGTuvRTtVbdOd/W6Q/3QEyDFYjm6OjO7X12ANUaKqtH1wy/O05/7U4QMYDvK1q1ZwgsqzCj90pDe61YKMVreDgPtJrqby/SlMj2PUSvw= 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=TviMBq6w; 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 lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSjVK004185; Mon, 12 Feb 2024 10:28:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755325; bh=PD7pULEBclq1+qdU6GR6A9JMygAqQNWEIr/SChGU3tQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TviMBq6wzruyjKrS8U9onTXbRWeFf+NpX35hobiHda4CVQ/ilYOxEhBCfjAxrFxBb 6+pYImHIomSti4oBmX5Eoxs31S6tI1+KIx7dNNZwlW0JGFcQ+uNvKDENQVbTD7EVZH RJ+sg1wreUuxCG9M3GP4mty93csDJQKzoUykiLpA= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSjMv024963 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:45 -0600 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE114.ent.ti.com (157.170.170.25) 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:44 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Mon, 12 Feb 2024 10:28:44 -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 41CGSWRF090688; Mon, 12 Feb 2024 10:28: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 v4 19/19] power: reset: syscon-poweroff: Use devm_register_sys_off_handler(POWER_OFF) Date: Mon, 12 Feb 2024 10:28:31 -0600 Message-ID: <20240212162831.67838-20-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: 1790711628331093110 X-GMAIL-MSGID: 1790711628331093110 Use device life-cycle managed register function to simplify probe and exit paths. This also makes our data struct per-device and not global, which allows for more than one instance of this device. Signed-off-by: Andrew Davis Reviewed-by: AngeloGioacchino Del Regno --- drivers/power/reset/syscon-poweroff.c | 30 ++++++++++----------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index 19c8da997b4c8..203936f4c544f 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -13,6 +13,7 @@ #include #include #include +#include #include struct syscon_poweroff_data { @@ -22,21 +23,24 @@ struct syscon_poweroff_data { u32 mask; }; -static struct syscon_poweroff_data *data; - -static void syscon_poweroff(void) +static int syscon_poweroff(struct sys_off_data *off_data) { + struct syscon_poweroff_data *data = off_data->cb_data; + /* Issue the poweroff */ regmap_update_bits(data->map, data->offset, data->mask, data->value); mdelay(1000); pr_emerg("Unable to poweroff system\n"); + + return NOTIFY_DONE; } static int syscon_poweroff_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct syscon_poweroff_data *data; int mask_err, value_err; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); @@ -73,21 +77,10 @@ static int syscon_poweroff_probe(struct platform_device *pdev) data->mask = 0xFFFFFFFF; } - if (pm_power_off) { - dev_err(dev, "pm_power_off already claimed for %ps", - pm_power_off); - return -EBUSY; - } - - pm_power_off = syscon_poweroff; - - return 0; -} - -static void syscon_poweroff_remove(struct platform_device *pdev) -{ - if (pm_power_off == syscon_poweroff) - pm_power_off = NULL; + return devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_DEFAULT, + syscon_poweroff, data); } static const struct of_device_id syscon_poweroff_of_match[] = { @@ -97,7 +90,6 @@ static const struct of_device_id syscon_poweroff_of_match[] = { static struct platform_driver syscon_poweroff_driver = { .probe = syscon_poweroff_probe, - .remove_new = syscon_poweroff_remove, .driver = { .name = "syscon-poweroff", .of_match_table = syscon_poweroff_of_match,