From nobody Thu Nov 14 16:22:51 2024 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 3026184FB8; Thu, 1 Feb 2024 18:01:24 +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=1706810486; cv=none; b=ly0fCIW8gywUc1nT91sFFPjzAgtgiKqAT6AuvXZIuvybMQ73eIWpsy4p7BLgdG2Yv/+lA/gjyKns6zyQxf7b9vwBOvbZaD7S4l6wB0U838IQE4hFmX9irDicQN+xwhJ9ww29B62bvZ68ZiUHs2dZFFXHW1nWyFPHqd9VCZ9XQhQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706810486; 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=PfKMF6PH76PFVbvSqWbPkkKj+X8g6uVOZNAhYU6K9F4aMlkX1Zma7vd5W08dsXwRfUnrx0ug1ecUNq8w6Vbbe67I5edxqMOwvOmZKq/iR0NisZniPweLynAgvh8ZCslkKzdH/js+9u+Y+Ps2UigwxL3GoJKNp6Y95yCoiqvgNOU= 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=NM+7Fo4c; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="NM+7Fo4c" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 411I14nX049525; Thu, 1 Feb 2024 12:01:04 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706810464; bh=eDTJGp1LNK+YD1bJfvgjkV/rIr2yWhv+8KTb7j41Dpg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NM+7Fo4c7ceajZ+cEpoLOlC2yRfbGmX4fXpqrOKldutGs2RZfVYxgID1cm6MTbd3s evZHXEYzZL+7rWVOu0CjH+S9Kmu8TUWTDXGZYfz/eM2H/Z7pl3zgycJYUFY+DN9pyA N7FLw3cwJ7ENiIECBLNflp9C0t18B2XAaokdFhpo= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 411I14Ev004464 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2024 12:01:04 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) 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; Thu, 1 Feb 2024 12:01:04 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) 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; Thu, 1 Feb 2024 12:01:04 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 411I12Gf117221; Thu, 1 Feb 2024 12:01:03 -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 01/18] power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(RESTART) Date: Thu, 1 Feb 2024 12:00:45 -0600 Message-ID: <20240201180102.70395-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201180102.70395-1-afd@ti.com> References: <20240201180102.70395-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Content-Type: text/plain; charset="utf-8" Use device life-cycle managed register function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- 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/a= tc260x-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); }; =20 @@ -172,11 +171,9 @@ static void atc260x_pwrc_pm_handler(void) WARN_ONCE(1, "Unable to power off system\n"); } =20 -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 =3D container_of(nb, struct atc260x_pwrc, - restart_nb); + struct atc260x_pwrc *pwrc =3D data->cb_data; pwrc->do_poweroff(pwrc, true); =20 return NOTIFY_DONE; @@ -194,8 +191,6 @@ static int atc260x_pwrc_probe(struct platform_device *p= dev) =20 priv->dev =3D &pdev->dev; priv->regmap =3D atc260x->regmap; - priv->restart_nb.notifier_call =3D atc260x_pwrc_restart_handler; - priv->restart_nb.priority =3D 192; =20 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"); } =20 - ret =3D register_restart_handler(&priv->restart_nb); + ret =3D 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 =3D NULL; atc260x_pwrc_data =3D NULL; } - - unregister_restart_handler(&priv->restart_nb); } =20 static struct platform_driver atc260x_pwrc_driver =3D { --=20 2.39.2