On Thu, Oct 29, 2026 at 08:35:53AM -0500, Rob Herring (Arm) wrote:
> pm_runtime_get_if_active() can return an error including for !CONFIG_PM.
> Do not treat that as an active runtime-PM reference.
>
> Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
> Cc: [email protected]
> Signed-off-by: Rob Herring (Arm) <[email protected]>
> ---
> v4:
>  - new patch
> ---
>  drivers/accel/ethosu/ethosu_perfmon.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/ethosu/ethosu_perfmon.c 
> b/drivers/accel/ethosu/ethosu_perfmon.c
> index 26f625374f9d..0ae2df3ceac8 100644
> --- a/drivers/accel/ethosu/ethosu_perfmon.c
> +++ b/drivers/accel/ethosu/ethosu_perfmon.c
> @@ -71,7 +71,8 @@ void ethosu_perfmon_stop_locked(struct ethosu_device 
> *ethosu, struct ethosu_perf
>
>       ncounters = perfmon->ncounters - 1;
>
> -     if (!pm_runtime_get_if_active(ethosu->base.dev)) {

pm_runtime_get_if_active() return 1 when active
                           return 0 when suspend
                           return -EINVAL when !CONFIG_PM

!pm_runtime_get_if_active() shoud be correct if !CONFIG_PM. when !CONFIG_PM
we treat all devices is actived.

I think stub pm_runtime_get_if_active() for !CONFIG_PM return -EINVAL is
wrong.

It should be similar with stub

static inline int __pm_runtime_resume(struct device *dev, int rpmflags)
{
        return 1;
}

I will create patch change -EINVAL to 1.

Frank

> +     if (IS_ENABLED(CONFIG_PM) &&
> +         pm_runtime_get_if_active(ethosu->base.dev) <= 0) {
>               ethosu->perfmon_state.active = NULL;
>               return;
>       }
>
> --
> 2.53.0
>

Reply via email to