Thread (71 messages) 71 messages, 14 authors, 2021-11-29

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

From: Dmitry Osipenko <digetx@gmail.com>
Date: 2021-11-10 13:38:15
Also in: linux-acpi, linux-m68k, linux-mips, linux-omap, linux-pm, linux-riscv, linux-sh, linux-tegra, lkml, xen-devel

10.11.2021 13:43, Jonathan Neuschäfer пишет:
quoted hunk ↗ jump to hunk
On Mon, Nov 08, 2021 at 02:36:42PM +0300, Dmitry Osipenko wrote:
quoted
08.11.2021 14:22, Jonathan Neuschäfer пишет:
quoted
On Sun, Nov 07, 2021 at 08:42:33PM +0300, Dmitry Osipenko wrote:
[...]
quoted
EC drivers tend to use higher priority in general. Jonathan, could you
please confirm that NTXEC driver is a more preferable restart method
than the watchdog?
Yes. The original firmware uses the NTXEC to restart, and it works well,
so I do think it's preferable.
Thank you, then I'll update the NTXEC patch like this:

https://github.com/grate-driver/linux/commit/22da3d91f1734d9a0ed036220ad4ea28465af988
I tested again, but sys_off_handler_reboot called a bogus pointer
(probably reboot_prepare_cb). I think it was left uninitialized in
ntxec_probe, which uses devm_kmalloc. I guess we could switch it to
devm_kzalloc:
diff --git a/drivers/mfd/ntxec.c b/drivers/mfd/ntxec.c
index 1f55dfce14308..30364beb4b1d0 100644
--- a/drivers/mfd/ntxec.c
+++ b/drivers/mfd/ntxec.c
@@ -144,7 +144,7 @@ static int ntxec_probe(struct i2c_client *client)
 	const struct mfd_cell *subdevs;
 	size_t n_subdevs;
 
-	ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL);
+	ec = devm_kzalloc(&client->dev, sizeof(*ec), GFP_KERNEL);
 	if (!ec)
 		return -ENOMEM;
 

With that done, it works flawlessly.
Good catch, thank you! I'll correct this patch and add yours t-b.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help