serial: core: Restore sysfs fwnode information
PATCH 1/1 serial: core: Restore sysfs fwnode information
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
--- drivers/tty/serial/serial_base_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/serial/serial_base_bus.c +6 -4
@@ -13,7 +13,7 @@#include <linux/device.h> #include <linux/idr.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/serial_core.h> #include <linux/slab.h> #include <linux/spinlock.h>
@@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)driver_unregister (driver); } +/* On failure the caller must put device @dev with put_device() */ static int serial_base_device_init(struct uart_port *port, struct device *dev, struct device *parent_dev,
@@ -73,7 +74,8 @@ static int serial_base_device_init(struct uart_port *port, dev->parent = parent_dev; dev->bus = &serial_base_bus_type; dev->release = release; -device_set_of_node_from_dev (dev, parent_dev); + +device_set_node (dev,fwnode_handle_get (dev_fwnode (parent_dev)));if (!serial_base_initialized) {dev_dbg (port->dev,"uart_add_one_port() called before arch_initcall()?\n" );
@@ -94,7 +96,7 @@ static void serial_base_ctrl_release(struct device *dev) {struct serial_ctrl_device *ctrl_dev =to_serial_base_ctrl_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (ctrl_dev); }
@@ -142,7 +144,7 @@ static void serial_base_port_release(struct device *dev) {struct serial_port_device *port_dev =to_serial_base_port_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (port_dev); }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerQuoted 62 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
Fixes d36f0e9a0002 ("serial: core: restore of_node information in sysfs")Signed-off-by Andy Shevchenko <[email protected]>--- drivers/tty/serial/serial_base_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/tty/serial/serial_base_bus.c +6
-4@@ -13,7 +13,7 @@#include <linux/device.h> #include <linux/idr.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/serial_core.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)driver_unregister (driver); } +/* On failure the caller must put device @dev with put_device() */ static int serial_base_device_init(struct uart_port *port, struct device *dev, struct device *parent_dev,@@ -73,7 +74,8 @@ static int serial_base_device_init(struct uart_port *port, dev->parent = parent_dev; dev->bus = &serial_base_bus_type; dev->release = release; -device_set_of_node_from_dev (dev, parent_dev); + +device_set_node (dev,fwnode_handle_get (dev_fwnode (parent_dev)));if (!serial_base_initialized) {dev_dbg (port->dev,"uart_add_one_port() called before arch_initcall()?\n" );@@ -94,7 +96,7 @@ static void serial_base_ctrl_release(struct device *dev) {struct serial_ctrl_device *ctrl_dev =to_serial_base_ctrl_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (ctrl_dev); }@@ -142,7 +144,7 @@ static void serial_base_port_release(struct device *dev) {struct serial_port_device *port_dev =to_serial_base_port_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (port_dev); }Signature · 1 line
2.50.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Quoted 31 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
Fixes d36f0e9a0002 ("serial: core: restore of_node information in sysfs")Signed-off-by Andy Shevchenko <[email protected]>--- drivers/tty/serial/serial_base_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/tty/serial/serial_base_bus.c +2
-1@@ -13,7 +13,7 @@#include <linux/device.h> #include <linux/idr.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/serial_core.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)driver_unregister (driver); } +/* On failure the caller must put device @dev with put_device() */ static int serial_base_device_init(struct uart_port *port, struct device *dev, struct device *parent_dev,
drivers/tty/serial/serial_base_bus.c static int serial_base_device_init(struct uart_port *port, · line 78
Quoted 6 lines
drivers/tty/serial/serial_base_bus.c +2
-1@@ -73,7 +74,8 @@ static int serial_base_device_init(struct uart_port *port, dev->parent = parent_dev; dev->bus = &serial_base_bus_type; dev->release = release; -device_set_of_node_from_dev (dev, parent_dev); + +device_set_node (dev,fwnode_handle_get (dev_fwnode (parent_dev)));
device_set_of_node_from_dev() used to set dev->of_node_reused = true; which made the pinctrl subsystem skip the logic inside pinctrl_bind_pins().
Since you changed to device_set_node(), dev->of_node_reused is no longer set to true and the following errors are issued because pinctrl will try to request the same pins for all sub-devices.
Quoted 8 lines
[ 0.472463] pinctrl-rzt2h 802c0000.pinctrl: pin P27_4 already requested by 80005000.serial; cannot claim for 80005000.serial:0 [ 0.472485] pinctrl-rzt2h 802c0000.pinctrl: error -EINVAL: pin-220 (80005000.serial:0) [ 0.472501] pinctrl-rzt2h 802c0000.pinctrl: error -EINVAL: could not request pin 220 (P27_4) from group sci0-pins on device pinctrl-rzt2h [ 0.472515] ctrl 80005000.serial:0: Error applying setting, reverse things back [ 0.472711] pinctrl-rzt2h 802c0000.pinctrl: pin P27_4 already requested by 80005000.serial; cannot claim for 80005000.serial:0.0 [ 0.472725] pinctrl-rzt2h 802c0000.pinctrl: error -EINVAL: pin-220 (80005000.serial:0.0) [ 0.472738] pinctrl-rzt2h 802c0000.pinctrl: error -EINVAL: could not request pin 220 (P27_4) from group sci0-pins on device pinctrl-rzt2h [ 0.472752] port 80005000.serial:0.0: Error applying setting, reverse things back
Maybe we should set
dev->of_node_reused = true;
manually right above the call to device_set_node(), grouped with the rest of dev initialization?
Quoted 21 lines
if (!serial_base_initialized) { dev_dbg(port->dev, "uart_add_one_port() called before arch_initcall()?\n");drivers/tty/serial/serial_base_bus.c +2
-2@@ -94,7 +96,7 @@ static void serial_base_ctrl_release(struct device *dev) {struct serial_ctrl_device *ctrl_dev =to_serial_base_ctrl_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (ctrl_dev); }@@ -142,7 +144,7 @@ static void serial_base_port_release(struct device *dev) {struct serial_port_device *port_dev =to_serial_base_port_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (port_dev); }
Quoted 6 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
Fixes d36f0e9a0002 ("serial: core: restore of_node information in sysfs")Signed-off-by Andy Shevchenko <[email protected]>---
This patch landed in today's linux-next as commit 24ec03cc5512 ("serial:
core: Restore sysfs fwnode information"). In my tests I found that it breaks booting of most of my test boards (ARM 32 and 64 bit). Unfortunately I cannot provide anything useful besides the information that booting stops and system doesn't reach shell. There is nothing suspicious in the kernel logs. I suspect a memory trashing. Reverting $subject on top of linux-next fixes booting.
Quoted 44 lines
drivers/tty/serial/serial_base_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/tty/serial/serial_base_bus.c +5
-3@@ -13,7 +13,7 @@#include <linux/device.h> #include <linux/idr.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/serial_core.h> #include <linux/slab.h> #include <linux/spinlock.h> @@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)driver_unregister (driver); } +/* On failure the caller must put device @dev with put_device() */ static int serial_base_device_init(struct uart_port *port, struct device *dev, struct device *parent_dev,@@ -73,7 +74,8 @@ static int serial_base_device_init(struct uart_port *port, dev->parent = parent_dev; dev->bus = &serial_base_bus_type; dev->release = release; -device_set_of_node_from_dev (dev, parent_dev); + +device_set_node (dev,fwnode_handle_get (dev_fwnode (parent_dev)));if (!serial_base_initialized) {dev_dbg (port->dev,"uart_add_one_port() called before arch_initcall()?\n" );@@ -94,7 +96,7 @@ static void serial_base_ctrl_release(struct device *dev) {struct serial_ctrl_device *ctrl_dev =to_serial_base_ctrl_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (ctrl_dev); }
drivers/tty/serial/serial_base_bus.c static void serial_base_port_release(struct device *dev) · line 150
Quoted 8 lines
drivers/tty/serial/serial_base_bus.c +1
-1@@ -142,7 +144,7 @@ static void serial_base_port_release(struct device *dev) {struct serial_port_device *port_dev =to_serial_base_port_device (dev); -of_node_put (dev->of_node); +fwnode_handle_put (dev_fwnode (dev));kfree (port_dev); }
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 11 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
This patch landed in today's linux-next as commit
24ec03cc5512("serial:
core: Restore sysfs fwnode information"). In my tests I found that it breaks booting of most of my test boards (ARM 32 and 64 bit). Unfortunately I cannot provide anything useful besides the information that booting stops and system doesn't reach shell. There is nothing suspicious in the kernel logs. I suspect a memory trashing. Reverting $subject on top of linux-next fixes booting.
I'm also seeing this in my lab and Arm's lab, there are a few systems that survive but it's a small minority.
Quoted 11 lines · Mark Brown
Quoted 10 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
This patch landed in today's linux-next as commit
24ec03cc5512("serial:
core: Restore sysfs fwnode information"). In my tests I found that it breaks booting of most of my test boards (ARM 32 and 64 bit). Unfortunately I cannot provide anything useful besides the information that booting stops and system doesn't reach shell. There is nothing suspicious in the kernel logs. I suspect a memory trashing. Reverting $subject on top of linux-next fixes booting.
Quoted 2 lines
I'm also seeing this in my lab and Arm's lab, there are a few systems that survive but it's a small minority.
I have a few spare minutes and spent them analyzing this issue.
This is somehow related to dev->of_node_reused device property and its check in pinctrl_bind_pins() in drivers/base/pinctrl.c.
The following hack/workaround fixes the observed boot issues:
(quoted diff) +0 -0
b/drivers/tty/serial/serial_base_bus.c
index 8e891984cdc0..f3332a5e134c 100644
drivers/tty/serial/serial_base_bus.c +1 -0
@@ -76,6 +76,7 @@ static int serial_base_device_init(struct uart_port *port, dev->release = release; device_set_node(dev, fwnode_handle_get(dev_fwnode(parent_dev))); + dev->of_node_reused = true; if (!serial_base_initialized) { dev_dbg(port->dev, "uart_add_one_port() called before
arch_initcall()?\n");
If I then remove the dev->of_node_reused check in pinctrl_bind_pins(), the affected boards don't boot again the same way. I hope this helps fixing this issue.
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 38 lines · Marek Szyprowski
Quoted 11 lines · Mark Brown
Quoted 10 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
The change that restores sysfs fwnode information does it only for OF cases. Update the fix to cover all possible types of fwnodes.
This patch landed in today's linux-next as commit
24ec03cc5512("serial:
core: Restore sysfs fwnode information"). In my tests I found that it breaks booting of most of my test boards (ARM 32 and 64 bit). Unfortunately I cannot provide anything useful besides the information that booting stops and system doesn't reach shell. There is nothing suspicious in the kernel logs. I suspect a memory trashing. Reverting $subject on top of linux-next fixes booting.Quoted 2 lines
I'm also seeing this in my lab and Arm's lab, there are a few systems that survive but it's a small minority.
I have a few spare minutes and spent them analyzing this issue.
This is somehow related to
dev->of_node_reuseddevice property and its check inpinctrl_bind_pins()indrivers/base/pinctrl.c.The following hack/workaround fixes the observed boot issues:
drivers/tty/serial/serial_base_bus.c +1
-0@@ -76,6 +76,7 @@ static int serial_base_device_init(struct uart_port *port, dev->release = release; device_set_node(dev, fwnode_handle_get(dev_fwnode(parent_dev))); + dev->of_node_reused = true; if (!serial_base_initialized) { dev_dbg(port->dev, "uart_add_one_port() called beforearch_initcall()?\n");
Quoted 3 lines
If I then remove the
dev->of_node_reusedcheck inpinctrl_bind_pins(), the affected boards don't boot again the same way. I hope this helps fixing this issue.
I can confirm that this patch fixes the breakage on Qualcomm devices. Please send it as a proper patch (though I'd say, the flag should only be set only if dev->of_node != NULL).
An alternative is to introduce dev_set_node_from_dev() which mimics both dev_set_node() and device_set_of_node_from_dev().
Greg, what would be your preference?
Quoted 6 lines
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Signature · 2 lines
With best wishes Dmitry
Quoted 1 line · Dmitry Baryshkov
On Mon, Dec 22, 2025 at 11:55:26AM +0100, Marek Szyprowski wrote:
...
Quoted 6 lines
I can confirm that this patch fixes the breakage on Qualcomm devices. Please send it as a proper patch (though I'd say, the flag should only be set only if
dev->of_node!= NULL).An alternative is to introduce
dev_set_node_from_dev()which mimics bothdev_set_node()anddevice_set_of_node_from_dev().
While I am on vacation, I have a brief look at the report and fix and the discussion. There are several ongoing tasks that may collide with this:
- the desire to split device.h, so we have something like device/fwnode.h with all related APIs listed there
- taking these, it might be good to have device_set_used_node() as a combination of the above and also device_is_node_used() to be used in its solely user of pin control core
- the proper understanding of this flag to begin with and how it may be related to ACPI-based platforms (or non-DT in general)
- with that done, it might be a room to see if the flag actually should be somewhere in fwnode structure or elsewhere
- or we can revisit the whole design and see if we can get rid of the flag
+Cc: Linus for searching for his comments, thoughts, etc.
Signature · 2 lines
With Best Regards, Andy Shevchenko