[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230514054122.GH14287@atomide.com>
Date: Sun, 14 May 2023 08:41:22 +0300
From: Tony Lindgren <tony@...mide.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jirislaby@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Dhruva Gole <d-gole@...com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Johan Hovold <johan@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Vignesh Raghavendra <vigneshr@...com>,
linux-omap@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH v11 1/1] serial: core: Start managing serial controllers
to enable runtime PM
* Greg Kroah-Hartman <gregkh@...uxfoundation.org> [230513 11:10]:
> On Thu, May 11, 2023 at 09:53:51AM +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 physical serial controller devices.
> >
> > To do this, let's set up a struct bus and struct device for the serial
> > core controller as suggested by Greg and Jiri. The serial core controller
> > devices are children of the physical serial port device. The serial core
> > controller device is needed to support multiple different kind of ports
> > connected to single physical serial port device.
> >
> > Let's also set up a struct device for the serial core port. The serial
> > core port instances are children of the serial core controller device.
> >
> > With the serial core port device we can now flush pending TX on the
> > runtime PM resume as suggested by Johan.
>
> Much better, thanks!
>
> One thing jumps out at me though, you are passing around "raw" struct
> device pointers as the serial port structure, why?
>
> Shouldn't:
>
> > @@ -563,7 +564,8 @@ struct uart_port {
> > unsigned int minor;
> > resource_size_t mapbase; /* for ioremap */
> > resource_size_t mapsize;
> > - struct device *dev; /* parent device */
> > + struct device *dev; /* serial port physical parent device */
> > + struct device *port_dev; /* serial core port device */
>
> port_dev here be something like "struct serial_port" (or some better
> name)? That way you enforce the type being passed around to the serial
> code in this change which will help catch any type mistakes.
>
> Yes, this structure can just be a "wrapper" around 'struct device' but
> at least it's a unique type.
Good idea thanks, will change.
> Or am I missing why this was done this way?
No reason to keep it as struct device.
Regards,
Tony
Powered by blists - more mailing lists