[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIlNY7xJYmqtxVOe@hovoldconsulting.com>
Date: Wed, 28 Apr 2021 13:56:19 +0200
From: Johan Hovold <johan@...nel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: Jacopo Mondi <jacopo@...ndi.org>, linuxarm@...wei.com,
mauro.chehab@...wei.com, Hans Verkuil <hverkuil-cisco@...all.nl>,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Subject: Re: [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@...nel.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
Powered by blists - more mailing lists