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. ... > -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' ... > +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? -- With Best Regards, Andy Shevchenko