All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cosmin Tanislav <demonsingur@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Subject: Re: [PATCH v1 1/1] serial: core: Restore sysfs fwnode information
Date: Thu, 18 Dec 2025 15:50:49 +0200	[thread overview]
Message-ID: <4b601513-5257-4511-95db-390791e17ba8@gmail.com> (raw)
In-Reply-To: <20251127163650.2942075-1-andriy.shevchenko@linux.intel.com>



On 11/27/25 6:36 PM, Andy Shevchenko wrote:
> 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 <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/tty/serial/serial_base_bus.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
> index 22749ab0428a..8e891984cdc0 100644
> --- a/drivers/tty/serial/serial_base_bus.c
> +++ b/drivers/tty/serial/serial_base_bus.c
> @@ -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)));

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.

> [    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?

>   
>   	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);
>   }
>   


  parent reply	other threads:[~2025-12-18 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251218152957eucas1p196470bc80be0d8a4037edfe6e53f3d13@eucas1p1.samsung.com>
2025-11-27 16:36 ` [PATCH v1 1/1] serial: core: Restore sysfs fwnode information Andy Shevchenko
2025-11-27 19:07   ` Greg Kroah-Hartman
2025-12-18 13:50   ` Cosmin Tanislav [this message]
2025-12-18 15:29   ` Marek Szyprowski
2025-12-18 16:54     ` Mark Brown
2025-12-22 10:55       ` Marek Szyprowski
2025-12-29  3:18         ` Dmitry Baryshkov
2025-12-29 12:38           ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b601513-5257-4511-95db-390791e17ba8@gmail.com \
    --to=demonsingur@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.