linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: core: restore of_node information in sysfs
@ 2025-06-16 16:21 Aidan Stewart
  2025-06-17  4:44 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Aidan Stewart @ 2025-06-16 16:21 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: tony, linux-serial, linux-kernel, Aidan Stewart, stable

Since in v6.8-rc1, the of_node symlink under tty devices is
missing. This breaks any udev rules relying on this information.

Link the of_node information in the serial controller device with the
parent defined in the device tree. This will also apply to the serial
device which takes the serial controller as a parent device.

Fixes: b286f4e87e32 ("serial: core: Move tty and serdev to be children of serial core port device")
Cc: stable@vger.kernel.org
Signed-off-by: Aidan Stewart <astewart@tektelic.com>
---
 drivers/tty/serial/serial_base_bus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
index 5d1677f1b651..0e4bf7a3e775 100644
--- a/drivers/tty/serial/serial_base_bus.c
+++ b/drivers/tty/serial/serial_base_bus.c
@@ -73,6 +73,10 @@ static int serial_base_device_init(struct uart_port *port,
 	dev->bus = &serial_base_bus_type;
 	dev->release = release;
 
+	if (IS_ENABLED(CONFIG_OF)) {
+		device_set_of_node_from_dev(dev, parent_dev);
+	}
+
 	if (!serial_base_initialized) {
 		dev_dbg(port->dev, "uart_add_one_port() called before arch_initcall()?\n");
 		return -EPROBE_DEFER;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: restore of_node information in sysfs
  2025-06-16 16:21 [PATCH] serial: core: restore of_node information in sysfs Aidan Stewart
@ 2025-06-17  4:44 ` Greg KH
  2025-06-17 15:46   ` Aidan Stewart
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2025-06-17  4:44 UTC (permalink / raw)
  To: Aidan Stewart; +Cc: jirislaby, tony, linux-serial, linux-kernel, stable

On Mon, Jun 16, 2025 at 10:21:54AM -0600, Aidan Stewart wrote:
> Since in v6.8-rc1, the of_node symlink under tty devices is
> missing. This breaks any udev rules relying on this information.
> 
> Link the of_node information in the serial controller device with the
> parent defined in the device tree. This will also apply to the serial
> device which takes the serial controller as a parent device.
> 
> Fixes: b286f4e87e32 ("serial: core: Move tty and serdev to be children of serial core port device")
> Cc: stable@vger.kernel.org
> Signed-off-by: Aidan Stewart <astewart@tektelic.com>
> ---
>  drivers/tty/serial/serial_base_bus.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
> index 5d1677f1b651..0e4bf7a3e775 100644
> --- a/drivers/tty/serial/serial_base_bus.c
> +++ b/drivers/tty/serial/serial_base_bus.c
> @@ -73,6 +73,10 @@ static int serial_base_device_init(struct uart_port *port,
>  	dev->bus = &serial_base_bus_type;
>  	dev->release = release;
>  
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		device_set_of_node_from_dev(dev, parent_dev);
> +	}

Did this pass checkpatch.pl?

And why is the if statement needed?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: restore of_node information in sysfs
  2025-06-17  4:44 ` Greg KH
@ 2025-06-17 15:46   ` Aidan Stewart
  2025-06-17 15:56     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Aidan Stewart @ 2025-06-17 15:46 UTC (permalink / raw)
  To: Greg KH
  Cc: jirislaby@kernel.org, tony@atomide.com,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org

On Tue, 2025-06-17 at 06:44 +0200, Greg KH wrote:
> 
> On Mon, Jun 16, 2025 at 10:21:54AM -0600, Aidan Stewart wrote:
> > 
> > 
> > +     if (IS_ENABLED(CONFIG_OF)) {
> > +             device_set_of_node_from_dev(dev, parent_dev);
> > +     }
> 
> Did this pass checkpatch.pl?
I ran checkpatch.pl with the --strict option and I didn't get any warnings
or errors. Is there a style issue you would like me to fix?

> And why is the if statement needed?
I guess it's not really needed. I was trying to avoid the call for non-DT
systems, but it should still be safe to do. I will remove it in v2.

> thanks,
> 
> greg k-h

-- 
Thanks,

Aidan Stewart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial: core: restore of_node information in sysfs
  2025-06-17 15:46   ` Aidan Stewart
@ 2025-06-17 15:56     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2025-06-17 15:56 UTC (permalink / raw)
  To: Aidan Stewart
  Cc: jirislaby@kernel.org, tony@atomide.com,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org

On Tue, Jun 17, 2025 at 03:46:37PM +0000, Aidan Stewart wrote:
> On Tue, 2025-06-17 at 06:44 +0200, Greg KH wrote:
> > 
> > On Mon, Jun 16, 2025 at 10:21:54AM -0600, Aidan Stewart wrote:
> > > 
> > > 
> > > +     if (IS_ENABLED(CONFIG_OF)) {
> > > +             device_set_of_node_from_dev(dev, parent_dev);
> > > +     }
> > 
> > Did this pass checkpatch.pl?
> I ran checkpatch.pl with the --strict option and I didn't get any warnings
> or errors. Is there a style issue you would like me to fix?

You should not need {} for a one line if statement.

> > And why is the if statement needed?
> I guess it's not really needed. I was trying to avoid the call for non-DT
> systems, but it should still be safe to do. I will remove it in v2.

Please do!

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-17 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 16:21 [PATCH] serial: core: restore of_node information in sysfs Aidan Stewart
2025-06-17  4:44 ` Greg KH
2025-06-17 15:46   ` Aidan Stewart
2025-06-17 15:56     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).