lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240123164443.394642-5-afd@ti.com>
Date: Tue, 23 Jan 2024 10:44:43 -0600
From: Andrew Davis <afd@...com>
To: Mark Rutland <mark.rutland@....com>,
        Lorenzo Pieralisi
	<lpieralisi@...nel.org>,
        Sebastian Reichel <sre@...nel.org>,
        Karol Gugala
	<kgugala@...micro.com>,
        Mateusz Holenko <mholenko@...micro.com>,
        Gabriel
 Somlo <gsomlo@...il.com>, Joel Stanley <joel@....id.au>,
        Mark Brown
	<broonie@...nel.org>, Orson Zhai <orsonzhai@...il.com>,
        Baolin Wang
	<baolin.wang@...ux.alibaba.com>,
        Chunyan Zhang <zhang.lyra@...il.com>, Lee
 Jones <lee@...nel.org>,
        Dmitry Osipenko <dmitry.osipenko@...labora.com>
CC: <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
        <linux-pm@...r.kernel.org>, <linux-spi@...r.kernel.org>,
        Andrew Davis
	<afd@...com>
Subject: [PATCH 4/4] firmware: ti_sci: Use devm_register_restart_handler()

Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@...com>
---
 drivers/firmware/ti_sci.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 8b9a2556de16d..16501aa0b84cf 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -103,7 +103,6 @@ struct ti_sci_desc {
  */
 struct ti_sci_info {
 	struct device *dev;
-	struct notifier_block nb;
 	const struct ti_sci_desc *desc;
 	struct dentry *d;
 	void __iomem *debug_region;
@@ -122,7 +121,6 @@ struct ti_sci_info {
 
 #define cl_to_ti_sci_info(c)	container_of(c, struct ti_sci_info, cl)
 #define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
-#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
 
 #ifdef CONFIG_DEBUG_FS
 
@@ -3254,10 +3252,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
 }
 EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
 
-static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
-				void *cmd)
+static int tisci_reboot_handler(struct sys_off_data *data)
 {
-	struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
+	struct ti_sci_info *info = data->cb_data;
 	const struct ti_sci_handle *handle = &info->handle;
 
 	ti_sci_cmd_core_reboot(handle);
@@ -3400,10 +3397,9 @@ static int ti_sci_probe(struct platform_device *pdev)
 	ti_sci_setup_ops(info);
 
 	if (reboot) {
-		info->nb.notifier_call = tisci_reboot_handler;
-		info->nb.priority = 128;
-
-		ret = register_restart_handler(&info->nb);
+		ret = devm_register_restart_handler(dev,
+						    tisci_reboot_handler,
+						    info);
 		if (ret) {
 			dev_err(dev, "reboot registration fail(%d)\n", ret);
 			goto out;
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ