lkml.org 
[lkml]   [2021]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 38/78] media: i2c: mt9m001: use pm_runtime_resume_and_get()
On Wed, Apr 28, 2021 at 01:28:53PM +0200, Mauro Carvalho Chehab wrote:
> Em Wed, 28 Apr 2021 12:05:26 +0200
> Johan Hovold <johan@kernel.org> escreveu:

> > Right, a resume failure is a pretty big issue and it's not really clear
> > how to to even handle that generally. But at remove() time you don't
> > have much choice but to go on and release resource anyway.
> >
> > So unless actually implementing some error handling too, using
> > pm_runtime_sync_get() without checking for errors is still preferred
> > over pm_runtime_resume_and_get(). That is
> >
> > pm_runtime_get_sync();
> > /* cleanup */
> > pm_runtime_disable()
> > pm_runtime_put_noidle();
> >
> > is better than:
> >
> > ret = pm_runtime_resume_and_get();
> > /* cleanup */
> > pm_runtime_disable();
> > if (ret == 0)
> > pm_runtime_put_noidle();
> >
> > unless you also start doing something ret.
>
> Perhaps the best would be to use, instead:
>
> pm_runtime_get_noresume();
> /* cleanup */
> pm_runtime_disable()
> pm_runtime_put_noidle();
> pm_runtime_set_suspended();
>
> I mean, at least for my eyes, it doesn't make sense to do a PM
> resume during driver's removal/unbind time.

The cleanup bit above would depend on the device being resumed so using
pm_runtime_get_noresume() makes little sense.

Some drivers disable clocks etc explicitly at remove instead of relying
on pm runtime for that and then they'd use the above scheme (plus
explicit pm_runtime_set_suspended()).

Johan

\
 
 \ /
  Last update: 2021-04-28 13:56    [W:0.062 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site