Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp409680pxy; Wed, 28 Apr 2021 06:49:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgzQhWStnWnOdhBxoScDQ+dQpdPdaO5CTR7XMjAlKvOR698uP45PD1mEHsw53ioqCE6R1k X-Received: by 2002:a17:90a:c297:: with SMTP id f23mr21172387pjt.197.1619617742332; Wed, 28 Apr 2021 06:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619617742; cv=none; d=google.com; s=arc-20160816; b=cPAEk1OKDXrTuTgxIyKP63mgjAPz1A/GmuVqZvtZBCvcRoQOqaR9ui1p3EAmuop0WA MqsMF+Bi5+MM6A7ngnqVdglZJ+dg7IdP4hT0NGHMAnXvSEkAFi1VMsJERHz3tDpVpPV2 kDggsS2pgSpPB0wpOrUp7cc8ykZ8i9AHBBNyAURJ/RX8rqhAorfyxa2+glELK3Kb8Zuw 97sGt33WR7dQz8MImaQiZHfvHp8xcE3kwEtj9B0vjreGZxiQ76P1+m3vmvDD6o+y4My3 v+TzEIwR9ExZkobqqZkY3/tWX9Hmpr0X658s/82o9/A83QpSupvK2EG1kx1/TyihTn8T HkXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vkDhz3DcdJLQoxauN6X4m8ieVssMnXSmUtiP1el/aeQ=; b=RvoeR7t4FgQYtym2XkAcCtmOB1SpH9Nj5OJgvKQJUKkyZN4dM0aHI1U3q0rXVw4iN3 1JrGZEZRnLdEYfOvdA8UiE6vtOrgVyQHo5jjj1mMQncHR67Fd1jR/jCwgPBgRxQ4e2/q pZ8O41Sittso0VzUhbEpbqCH4A12bv/9T4+Nii0QW2DbJw8x5MuwatY120+nABKpW1VA yDq7g7a8Uzqxy9ieHDcEsOGuRIaRIU2RPGObjF50GYsq0j8DTLTuydta+8TM22Z1wZA3 nC5tkevpwGkE5AKUEatKx/CTmaEFQcofDGBM3IRLIEpwzbtEELDJiAmu7DHqlmakU+98 daHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YqWqoncw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si4032741plg.241.2021.04.28.06.48.48; Wed, 28 Apr 2021 06:49:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YqWqoncw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbhD1L4y (ORCPT + 99 others); Wed, 28 Apr 2021 07:56:54 -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