Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362AbbH1KbF (ORCPT ); Fri, 28 Aug 2015 06:31:05 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:9037 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbbH1KbB (ORCPT ); Fri, 28 Aug 2015 06:31:01 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 28 Aug 2015 03:27:12 -0700 Subject: Re: [RFC PATCH 1/7] DMA: tegra-apb: Correct runtime-pm usage To: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Vinod Koul References: <1439905755-25150-1-git-send-email-jonathanh@nvidia.com> <55DB1AA9.7090906@nvidia.com> <20150824142143.GK13546@localhost> <13590312.K3yoQT5YDc@vostro.rjw.lan> <55DC375F.1070907@nvidia.com> <55DCF056.40004@intel.com> CC: Laxman Dewangan , Stephen Warren , Thierry Reding , "Alexandre Courbot" , , , , From: Jon Hunter Message-ID: <55E0385A.6070203@nvidia.com> Date: Fri, 28 Aug 2015 11:30:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55DCF056.40004@intel.com> X-Originating-IP: [10.21.132.159] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1600 Lines: 43 On 25/08/15 23:46, Rafael J. Wysocki wrote: > On 8/25/2015 11:37 AM, Jon Hunter wrote: [snip] >> Vinod, thinking about this some more, I am wondering if it is just >> better to get rid of the suspend/resume callbacks and simply handling >> the state in the runtime suspend/resume callbacks. I think that would be >> safe too, because once the clock has been disabled, then who knows what >> the context state will be. > > One caveat here: system suspend may be invoked at any time, so you need > to ensure that the device is properly suspended when that happens. > > I believe you at least need a ->suspend callback for that. Thanks, makes sense. On a related note, I see a few drivers, including this DMA driver doing the following in the driver ->remove callback. pm_runtime_disable(&pdev->dev); !pm_runtime_status_suspended(&pdev->dev)) tegra_dma_runtime_suspend(&pdev->dev); I understand that the code is trying to ensure that the device is suspended regardless of whether rpm is enabled or not in the kernel config. However, looking at the pm_runtime_status_suspended() function, AFAICT, it will always return false above as the disable_depth will be greater than 0. So I am concerned that the tegra_dma_runtime_suspend() is called even when not needed? However, I could also be missing something here. Cheers Jon -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/