From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19918C433ED for ; Wed, 28 Apr 2021 11:56:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBCD8613FB for ; Wed, 28 Apr 2021 11:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231569AbhD1L46 (ORCPT ); Wed, 28 Apr 2021 07:56:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:54448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbhD1L4v (ORCPT ); Wed, 28 Apr 2021 07:56:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E04A613FB; Wed, 28 Apr 2021 11:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619610966; bh=MPbO7Ro5DqSGjMw1tQeHEY4DPlsgICBS9RIhgwkXLJE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YqWqoncwxC2+RzwVL5lys29C5dRQBinWO5AZPEi/c+524vWHDvbR3vQnMTa33xkwR U9Ymm0VAcopS6Jq3Jnkgtbxh3XfOeLV4BA7gtDb/najNNz7PVOaU5kjy7xKSv7TLhU 5XVHqodws0DuThMQJUIl1hz+9fZexQK6vD0B179vrMpwWAbVO2BkInjF5AMDGqkdvs bFR9Ln+/KLQCyiSDoIN7yswW4nYKQjZR4QLWhUGrupQ6iorbK1J/Cj5DwUyH3B5FU7 fANH1WFVGXilFVVDJyzscsMuAKsdKbEEOHEWxmu0VTt6etQMeZOPbHtJwIpBVOba5U mnpeBGITL6T7w== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lbinj-0004DT-Ak; Wed, 28 Apr 2021 13:56:20 +0200 Date: Wed, 28 Apr 2021 13:56:19 +0200 From: Johan Hovold To: Mauro Carvalho Chehab Cc: Jacopo Mondi , linuxarm@huawei.com, mauro.chehab@huawei.com, Hans Verkuil , Jacopo Mondi , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 38/78] media: i2c: mt9m001: use pm_runtime_resume_and_get() Message-ID: References: <20210424082454.2ciold3j3h2jw47m@uno.localdomain> <20210426163840.67ea8af9@coco.lan> <20210428103148.590191ac@coco.lan> <20210428132853.65b162a0@coco.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210428132853.65b162a0@coco.lan> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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