linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Johan Hovold" <johan@kernel.org>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] serial: core: Start managing serial controllers to enable runtime PM
Date: Mon, 27 Jun 2022 16:48:13 +0300	[thread overview]
Message-ID: <Yrm1HaUtjTMcSIE+@atomide.com> (raw)
In-Reply-To: <Yrmfr3GfXYhclKXA@kroah.com>

* Greg Kroah-Hartman <gregkh@linuxfoundation.org> [220627 12:23]:
> On Wed, Jun 15, 2022 at 09:24:55AM +0300, Tony Lindgren wrote:
> > We want to enable runtime PM for serial port device drivers in a generic
> > way. To do this, we want to have the serial core layer manage the
> > registered serial port controllers. For runtime PM, we need a way to find
> > the serial ports for each serial port controller device.
> > 
> > The serial core manages ports. Each serial controller can have multiple
> > ports. As serial core has no struct device, and the serial port device
> > drivers have their own driver data, we cannot currently start making
> > use of serial core generic data easily without changing all the serial
> > port device drivers.
> 
> Really?  Why not make struct uart_port a real struct device?

Okie dokie

> > We could consider adding a serial core specific struct device. It would
> > be a child of the serial port device, and would allow us eventually to use
> > device_links to add generic runtime PM calls for example. But as the serial
> > core layer is not a device driver, driver specific features would need to
> > be added, and are probably not justified for a virtual device.
> 
> I think it's very justified, let's not paper over this whole thing by
> adding a kref stuck in in the middle and trying to hook up the PM code
> to it, instead of just using all of the PM logic that the driver model
> already provides.

OK. Having the serial controller be the parent device for the port device
will make runtime PM work as designed :)

> > Considering the above, let's improve the serial core layer so we can
> > manage the serial port controllers better. Let's register the controllers
> > with the serial core layer in addition to the serial ports.
> 
> Why can't controllers be a device as well?

The controllers are devices already probed by the serial port drivers.
What's missing is mapping the ports (as devices based on the comments
above) to the controller devices. I don't think we need another struct
device for the serial controller in addition to the serial port driver
device and it's child port devices.

> Let's try to work with the driver model here, not work around it, if at
> all possible.  We never did a full conversion of the serial layer to the
> driver core all those decades ago.  Perhaps now is the time to really do
> that.

Yes so it seems.

Regards,

Tony

  reply	other threads:[~2022-06-27 13:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15  6:24 [PATCH v2 1/1] serial: core: Start managing serial controllers to enable runtime PM Tony Lindgren
2022-06-15  9:17 ` Andy Shevchenko
2022-06-16  8:23   ` Tony Lindgren
2022-06-16  8:51   ` Tony Lindgren
2022-06-27 12:16 ` Greg Kroah-Hartman
2022-06-27 13:48   ` Tony Lindgren [this message]
2022-11-24  6:53     ` Jiri Slaby
2022-11-24 15:37       ` Tony Lindgren
2022-11-24 16:06         ` 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=Yrm1HaUtjTMcSIE+@atomide.com \
    --to=tony@atomide.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --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).