RE: [PATCH 1/2] firmware: arm_scmi: bus: Add pm ops

Peng Fan
2025-06-20T05:23:41Z

Hi Dan,

> Subject: Re: [PATCH 1/2] firmware: arm_scmi: bus: Add pm ops
>
> On Fri, Jun 20, 2025 at 11:37:13AM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Take platform_pm_ops as reference. Add pm ops for scmi_bus_type,
> then
> > the scmi devices under scmi bus could have their own hooks for
> > suspend, resume function.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > drivers/firmware/arm_scmi/bus.c | 45
> > +++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 45 insertions(+)
> >
> > diff --git a/drivers/firmware/arm_scmi/bus.c
> > b/drivers/firmware/arm_scmi/bus.c index
> >
> 1adef03894751dae9bb752b8c7f86e5d01c5d4fd..2d1ef73cb6d39ac61
> 1afa5d0008c
> > 46515e297b93 100644
> > --- a/drivers/firmware/arm_scmi/bus.c
> > +++ b/drivers/firmware/arm_scmi/bus.c
> > @@ -323,6 +323,50 @@ static struct attribute
> > *scmi_device_attributes_attrs[] = { };
> > ATTRIBUTE_GROUPS(scmi_device_attributes);
> >
> > +#ifdef CONFIG_SUSPEND
> > +static int scmi_pm_suspend(struct device *dev) {
> > + const struct device_driver *drv = dev->driver;
> > + int ret = 0;
> > +
> > + if (!drv)
> > + return 0;
> > +
> > + if (drv->pm) {
> > + if (drv->pm->suspend)
> > + ret = drv->pm->suspend(dev);
> > + }
> > +
> > + return ret;
> > +}
>
> These could be done on one line:
>
> static int scmi_pm_suspend(struct device *dev) {
> const struct device_driver *drv = dev->driver;
>
> if (drv && drv->pm && drv->pm->suspend)
> return drv->pm->suspend(dev);

Sure. Fix in V2 after I collect more comments.

Thanks,
Peng.

>
> return 0;
> }
>
> regards,
> dan carpenter