Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1358944pxy; Thu, 29 Apr 2021 05:35:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyazdlmkLpsyCYmE4PXwqDSFD9tvsPNY32B3dwKQFKy/DeKNhY0ZcaoaXCtRcgdwxkzmobK X-Received: by 2002:a05:6402:5107:: with SMTP id m7mr17825524edd.75.1619699748802; Thu, 29 Apr 2021 05:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619699748; cv=none; d=google.com; s=arc-20160816; b=MKvrgktxCJFDhZYGOG7wawh80SWn2kh/1tuXErK+whHR0XtMFpxTUDQ/89LerUhL5z tuHDB3w8k54kcQRfMinvuqpoL8yyFvO6JmqM9E/h3Yasm/JnVSVYPdMqu1qDtIwQ7c/X E/sN+4AOmbjb0os8hAU+ckHCk6uiP/lzdcKx9ezQZq2rq2eDb24iRxsfAjoJUNleUsyn nQcN0wMDn5rnCei3iS5xLV1BO5YW5ObDlKI+RbFg9VUHbMH1jOWkPn7nOogg1uwlKcMA L+SmH618DpLSR52p80EMO5iiGdcq/3xD2Tx6STgnisgqH7Rho7PIFuIhXiL9byHVCCn7 kugQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=+fbOj539U7JlJxKx94jCmhZjY1EaeG6hVLe/OeyW9BA=; b=BDkc6YSXc77FltNlkkCmKsIrtxKJy1ENpGDtvR9wbbJKa5HUmC0qZNNBAlwMQzxclm O2DFbVwkP9qytSqSQg44Mqt8Wnx1buYr6PBbqqzVAV8mj/HuGSL1BTSQHJWt0XGC/A8G QXxLhaznTDiiGQbRHn3U9LD/7ALTzdaPspPG3RHM1YZvVZvXoVKC9ASsonBEE5mCbOEb boxP1iV4uISDeFAFOFvDXJAO/ldsgUfHIerBi/Cspl4HIGOwlrGwSyPRbDPZZ2IkQAH3 BPNFPnuHf/Ym59XH0JdbsrkKtUIpNTkBHBCJ/k8mmf/bk1wLmdTbkHVI9qhWjkVdUTWL 4kow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pSAPQilu; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si211057ejo.378.2021.04.29.05.35.24; Thu, 29 Apr 2021 05:35:48 -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=@gmail.com header.s=20161025 header.b=pSAPQilu; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235751AbhD2Meu (ORCPT + 99 others); Thu, 29 Apr 2021 08:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbhD2Met (ORCPT ); Thu, 29 Apr 2021 08:34:49 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213A2C06138B; Thu, 29 Apr 2021 05:34:03 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id z13so23555854lft.1; Thu, 29 Apr 2021 05:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+fbOj539U7JlJxKx94jCmhZjY1EaeG6hVLe/OeyW9BA=; b=pSAPQilu7n+6xTr9GdEG0tb6PJM12QM070qCxvHnWCIze3Gcr+Y1X+IbvGDtRxTUgM EyOOFTxf9hWQBlaRIuLofOaQebEe5v0gWxDauGIRIaLBxzQZQULJfZHJUKxGdkb10gkc nD1wHPGKwDBP5o9agABg3XnIArwOCYPQSKMjVhR3w59xhvXls6FFml/j10Pwe9czFo6Z T7faf5Qfz88VW86L60gbzCGia3II+upwMhl4urxCbGztadHzxAw5ZUEZZpuSIrEqgrti aMKp0DRksQp+N/9uThNAeaKzsoGRnRjp6oHq0CgRtj1ykP9X5KS4ubBguxOUwo/dtsF4 c+pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+fbOj539U7JlJxKx94jCmhZjY1EaeG6hVLe/OeyW9BA=; b=NBZ6qrisZK+r/r0egW/szwjs5QHeDlkgBqldSV+slLEvVkjSX8aJY3H28isfeDdx7T njZDSLltdHIQZiiKnI5TVd0FYOfsYXFhgYF34BRq52KQe+BXh9DfjIF4wHGjjUvewOAs iiD4Zdnaai7T01uAJ2+UGcdqtItK14M7tY79FTH+Kj6yaRbyzKYEZ39J6y+X5jfsVK/S RjIgNfbFJImG7targ4SJT81Bqvu358EYtIA67eYZvHUpXUOi/7hL/ZPE8bUUwcUKWS8X ZAMOrl6/yMI0DUv+EAxqXZxzItEaYbiAJ4cO1PdADeqeRwMUQnjj37TltuTkgPshtP7l /wCQ== X-Gm-Message-State: AOAM530QECKQsA7rIOeBVAEGH00SJbcCpLFv/Lw5CO0pZkGEUFMSllkv 0/WZEkA87ftyUlHrDUIqVMo= X-Received: by 2002:a19:ad41:: with SMTP id s1mr24627108lfd.306.1619699641558; Thu, 29 Apr 2021 05:34:01 -0700 (PDT) Received: from [192.168.2.145] (109-252-193-102.dynamic.spd-mgts.ru. [109.252.193.102]) by smtp.googlemail.com with ESMTPSA id n7sm515001lft.65.2021.04.29.05.33.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Apr 2021 05:34:01 -0700 (PDT) Subject: Re: [PATCH v4 00/79] Address some issues with PM runtime at media subsystem To: Mauro Carvalho Chehab , Johan Hovold Cc: Shawn Tu , Ricardo Ribalda , Dafna Hirschfeld , Heiko Stuebner , linuxarm@huawei.com, Todor Tomov , Bjorn Andersson , Andrzej Hajda , "Lad, Prabhakar" , Thierry Reding , Pengutronix Kernel Team , linux-stm32@st-md-mailman.stormreply.com, Andrzej Pietrasiewicz , Leon Luo , Paul Kocialkowski , Mauro Carvalho Chehab , Dave Stevenson , Matt Ranostay , Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Chen-Yu Tsai , Andy Gross , Matthias Brugger , Dongchun Zhu , Sakari Ailus , Bingbu Cao , Marek Szyprowski , Shunqian Zheng , Tianshu Qiu , NXP Linux Team , Philipp Zabel , devel@driverdev.osuosl.org, Jacopo Mondi , Sylwester Nawrocki , linux-tegra@vger.kernel.org, Alexandre Torgue , Wenyou Yang , Manivannan Sadhasivam , linux-arm-msm@vger.kernel.org, Sascha Hauer , Steve Longerbeam , linux-media@vger.kernel.org, Maxime Ripard , Stanimir Varbanov , Benoit Parrot , Helen Koike , linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, Jacek Anaszewski , mauro.chehab@huawei.com, Sylwester Nawrocki , "Paul J. Murphy" , Ezequiel Garcia , Daniele Alessandrelli , Chiranjeevi Rapolu , linux-arm-kernel@lists.infradead.org, Jacob Chen , Jernej Skrabec , Hyungwoo Yang , linux-kernel@vger.kernel.org, Robert Foss , Dan Scally , Sowjanya Komatineni , Maxime Coquelin , linux-renesas-soc@vger.kernel.org, Yong Zhi , Shawn Guo References: <20210429121215.64a7cbdb@coco.lan> From: Dmitry Osipenko Message-ID: Date: Thu, 29 Apr 2021 15:33:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210429121215.64a7cbdb@coco.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 29.04.2021 13:18, Mauro Carvalho Chehab пишет: >> This is perfectly alright. Take a look at ov7740_remove() for example: >> >> pm_runtime_get_sync(&client->dev); >> pm_runtime_disable(&client->dev); >> pm_runtime_set_suspended(&client->dev); >> pm_runtime_put_noidle(&client->dev); >> >> ov7740_set_power(ov7740, 0); >> >> There's an explicit power-off after balancing the PM count and this will >> work regardless of the power state when entering this function. > Ok, but this should equally work: > > pm_runtime_disable(&client->dev); > pm_runtime_set_suspended(&client->dev); > > ov7740_set_power(ov7740, 0); > > as there's no additional cleanup made on this particular driver > between pm_runtime_get_sync() and pm_runtime_put_noidle(). > The pm_runtime_get_sync() turns hardware ON by invoking ov7740_set_power(ov7740, 1), and thus, the ON->OFF is kept balanced in both RPM-available and RPM-unavailable cases. The RPM state of device should be reset after driver removal. It doesn't look like any additional cleanups are needed by that ov7740 driver. The driver removal is opposite to the probe, hence it should be correct as-is.