From: Tony Lindgren <tony@atomide.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"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: Thu, 24 Nov 2022 17:37:07 +0200 [thread overview]
Message-ID: <Y3+PoxJNJm0Pe+Xm@atomide.com> (raw)
In-Reply-To: <562c1505-d3bc-6422-9598-15c399e6fbba@kernel.org>
Hi,
* Jiri Slaby <jirislaby@kernel.org> [221124 06:53]:
> Hi,
>
> I am returning to v2, as I managed to read only v3 and only now. But here
> was already the point below.
>
> On 27. 06. 22, 15:48, Tony Lindgren wrote:
> > > > 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.
>
> To be honest, I don't like the patch (even v3). We have uart_state which I
> already hate and now we have another structure holding *some* other info
> about a serial device (apart from uart_port). It's mess already and hard to
> follow, esp. to newcomers.
Yup the serial code sure is hard to follow..
> AFAIU, what Greg suggests would be:
>
> PCI/platform/acpi/whatever struct dev
> -> serial controller 1 struct dev
> -> serial port 1 struct dev (tty_port instance exists for this)
> -> serial port 2 struct dev (tty_port instance exists for this)
> -> ...
> -> serial controller 2 struct dev
> -> serial port 1 struct dev (tty_port instance exists for this)
> -> serial port 2 struct dev (tty_port instance exists for this)
> -> ...
Oh you want the serial controller struct device as a child of the
hardware controller struct device. Yeah that makes sense to put it there.
I was kind of thinking we want the port devices be direct children of
the hardware struct device, but I guess there is no such need.
> And you are objecting that mostly (or in all cases?), there will never be
> "serial controller 2"?
I'm was not aware of the need for multiple serial port controllers
connected to a single hardware controller struct device. Is there an
example for that somewhere?
Not that multiple serial controller struct devices matters with your
suggestion, just wondering.
> But given your description, I believe you need it anyway -- side note: does
> really the PM layer/or you need it or would you be fine with "serial port N"
> dev children? But provided you don't have the controller, you work around it
> by struct serial_controller. So what's actually the point of the workaround
> instead of sticking to proper driver model? With the workaround you seem you
> have to implement all the binding, lookup and such yourself anyway. And that
> renders the serial even worse :P. Let's do the reverse instead.
To me it seems your suggestion actually makes things easier for runtime
PM :)
We can just enable runtime PM for the serial controller struct device
without tinkering with the parent hardware controller struct device.
> The only thing I am not sure about, whether tty_port should be struct dev
> too -- and if it should have serial port 1 as a parent. But likely so. And
> then with pure tty (i.e. tty_driver's, not uart_driver's), it would have
> PCI/platform/acpi/whatever as a parent directly.
That seems like a separate set of patches, no? Or is there some need right
now to have some child struct device as a direct child of the hardware
controller struct device?
> In sum, the above structure makes perfect sense to me. There has only been
> noone to do the real work yet. And having tty_port was a hard prerequisite
> for this to happen. And that happened long time ago. All this would need a
> lot of work initially¹⁾, but it paid off a lot in long term.
>
> ¹⁾I know what I am writing about -- I converted HID. After all, the core was
> only 1000 lines patch (cf 85cdaf524b7d) + patches to convert all the drivers
> incrementally (like 8c19a51591).
Cool, thanks for your suggestions.
Regards,
Tony
next prev parent reply other threads:[~2022-11-24 15:37 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
2022-11-24 6:53 ` Jiri Slaby
2022-11-24 15:37 ` Tony Lindgren [this message]
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=Y3+PoxJNJm0Pe+Xm@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).