linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Tony Lindgren <tony@atomide.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Dhruva Gole" <d-gole@ti.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	"Maximilian Luz" <luzmaximilian@gmail.com>
Subject: Re: [RFC PATCH 1/2] serial: core: Move tty and serdev to be children of serial core port device
Date: Tue, 24 Oct 2023 14:48:53 +0200	[thread overview]
Message-ID: <ZTe9NdS160EU1RJJ@hovoldconsulting.com> (raw)
In-Reply-To: <20231024113624.54364-1-tony@atomide.com>

On Tue, Oct 24, 2023 at 02:36:18PM +0300, Tony Lindgren wrote:
> Let's move tty and serdev controller to be children of the serial core port
> device. This way the runtime PM usage count of a child device propagates
> to the serial hardware device.

> The tty device moves happily with just a change of the parent device.

> @@ -3153,7 +3153,8 @@ static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *u
>  	 * setserial to be used to alter this port's parameters.
>  	 */
>  	tty_dev = tty_port_register_device_attr_serdev(port, drv->tty_driver,
> -			uport->line, uport->dev, port, uport->tty_groups);
> +			uport->line, uport->dev, &uport->port_dev->dev, port,
> +			uport->tty_groups);
>  	if (!IS_ERR(tty_dev)) {
>  		device_set_wakeup_capable(tty_dev, 1);
>  	} else {

>  struct device *tty_port_register_device_attr_serdev(struct tty_port *port,
>                 struct tty_driver *driver, unsigned index,
> -               struct device *device, void *drvdata,
> +               struct device *host, struct device *parent, void *drvdata,
>                 const struct attribute_group **attr_grp)
>  {
>         struct device *dev;
> 
>         tty_port_link_device(port, driver, index);
> 
> -       dev = serdev_tty_port_register(port, device, driver, index);
> +       dev = serdev_tty_port_register(port, host, parent, driver, index);
>         if (PTR_ERR(dev) != -ENODEV) {
>                 /* Skip creating cdev if we registered a serdev device */
>                 return dev;
>         }
> 
> -       return tty_register_device_attr(driver, index, device, drvdata,
> +       return tty_register_device_attr(driver, index, parent, drvdata,
>                         attr_grp);
>  }

Looks like this patch breaks the wakeup-irq hack in uart_suspend_port():

	tty_dev = device_find_child(uport->dev, &match, serial_match_port);
	if (tty_dev && device_may_wakeup(tty_dev)) {
		enable_irq_wake(uport->irq);
		put_device(tty_dev);
		mutex_unlock(&port->mutex);
		return 0;
	}

There may be more of these hard-coded assumptions, this one I happened
to be aware of.

Johan

  parent reply	other threads:[~2023-10-24 12:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 11:36 [RFC PATCH 1/2] serial: core: Move tty and serdev to be children of serial core port device Tony Lindgren
2023-10-24 11:36 ` [RFC PATCH 2/2] serial: core: Revert checks for tx runtime PM state Tony Lindgren
2023-10-24 11:52 ` [RFC PATCH 1/2] serial: core: Move tty and serdev to be children of serial core port device Greg Kroah-Hartman
2023-10-24 12:29   ` Tony Lindgren
2023-10-24 12:42     ` Andy Shevchenko
2023-10-24 12:45       ` Tony Lindgren
2023-10-24 14:01     ` Greg Kroah-Hartman
2023-10-25  6:51       ` Tony Lindgren
2023-10-25  7:33         ` Johan Hovold
2023-10-25  8:24           ` Tony Lindgren
2023-10-24 12:17 ` Andy Shevchenko
2023-10-24 12:43   ` Andy Shevchenko
2023-10-25  6:53     ` Tony Lindgren
2023-10-24 12:48 ` Johan Hovold [this message]
2023-10-24 13:37   ` Tony Lindgren

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=ZTe9NdS160EU1RJJ@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=d-gole@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=robh@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    /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 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).