28.11.2021 08:47, Michał Mirosław пишет: > On Sun, Nov 14, 2021 at 10:34:08PM +0300, Dmitry Osipenko wrote: >> Add runtime power management and support generic power domains. > [...] >> @@ -104,10 +127,17 @@ static int gr2d_open_channel(struct tegra_drm_client *client, >> struct tegra_drm_context *context) >> { >> struct gr2d *gr2d = to_gr2d(client); >> + int err; >> + >> + err = pm_runtime_resume_and_get(client->base.dev); >> + if (err) >> + return err; >> >> context->channel = host1x_channel_get(gr2d->channel); >> - if (!context->channel) >> + if (!context->channel) { >> + pm_runtime_put(context->client->base.dev); > > Could host1x_channel_get/put() handle pm_runtime* calls ? I would expect > this to be common code for the users. We already have host1x code that manages runtime PM of the client drivers, but it does that only for the code path of the new UAPI. In case of the older UAPI, seems we can move the RPM get/put into tegra/drm.c. I'll consider that change for v16, thank you. > BTW, pm_runtime_resume_and_get() uses different dev than > pm_runtime_put() in the error path - is this intended? These functions use the same dev. The context->client is redundant there, good catch.