Re: [PATCH v10 1/1] serial: core: Start managing serial controllers to enable runtime PM

From: Tony Lindgren
Date: Mon May 08 2023 - 09:35:17 EST


* Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> [230508 12:11]:
> On Mon, May 08, 2023 at 02:03:35PM +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.
>
> Sorry, I'm on vacation. But just brief comments below.
> In general looks good to me.

OK have a nice vacation :)

> > -obj-$(CONFIG_SERIAL_CORE) += serial_core.o
> > +obj-$(CONFIG_SERIAL_CORE) += serial_base.o
> > +serial_base-objs := serial_core.o serial_base_bus.o serial_ctrl.o serial_port.o
>
> 'objs' is for user space tools, kernel should use 'y'

Oh OK.

> > +static DEFINE_RUNTIME_DEV_PM_OPS(serial_port_pm, NULL,
> > + serial_port_runtime_resume, NULL);
>
> Maybe
>
> static DEFINE_RUNTIME_DEV_PM_OPS(serial_port_pm,
> NULL, serial_port_runtime_resume, NULL);
>
> for better logical split?

Sure.

Thanks,

Tony