Skip to content

Commit 24ec03c

Browse files
andy-shevgregkh
authored andcommitted
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. Fixes: d36f0e9 ("serial: core: restore of_node information in sysfs") Cc: stable <stable@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20251127163650.2942075-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8f0b4cc commit 24ec03c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/tty/serial/serial_base_bus.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <linux/device.h>
1414
#include <linux/idr.h>
1515
#include <linux/module.h>
16-
#include <linux/of.h>
16+
#include <linux/property.h>
1717
#include <linux/serial_core.h>
1818
#include <linux/slab.h>
1919
#include <linux/spinlock.h>
@@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)
6060
driver_unregister(driver);
6161
}
6262

63+
/* On failure the caller must put device @dev with put_device() */
6364
static int serial_base_device_init(struct uart_port *port,
6465
struct device *dev,
6566
struct device *parent_dev,
@@ -73,7 +74,8 @@ static int serial_base_device_init(struct uart_port *port,
7374
dev->parent = parent_dev;
7475
dev->bus = &serial_base_bus_type;
7576
dev->release = release;
76-
device_set_of_node_from_dev(dev, parent_dev);
77+
78+
device_set_node(dev, fwnode_handle_get(dev_fwnode(parent_dev)));
7779

7880
if (!serial_base_initialized) {
7981
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)
9496
{
9597
struct serial_ctrl_device *ctrl_dev = to_serial_base_ctrl_device(dev);
9698

97-
of_node_put(dev->of_node);
99+
fwnode_handle_put(dev_fwnode(dev));
98100
kfree(ctrl_dev);
99101
}
100102

@@ -142,7 +144,7 @@ static void serial_base_port_release(struct device *dev)
142144
{
143145
struct serial_port_device *port_dev = to_serial_base_port_device(dev);
144146

145-
of_node_put(dev->of_node);
147+
fwnode_handle_put(dev_fwnode(dev));
146148
kfree(port_dev);
147149
}
148150

0 commit comments

Comments
 (0)