Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp257836pxb; Wed, 11 Nov 2020 03:00:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo6qWtiQZWrqpPdgmMDaDCA+eB984/rXuPb1+2oznD86chg0p71WYuUOA/XRNxhek7IU+U X-Received: by 2002:a50:85c6:: with SMTP id q6mr4488792edh.126.1605092438782; Wed, 11 Nov 2020 03:00:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605092438; cv=none; d=google.com; s=arc-20160816; b=PBf9GGzH8TdkzNIw9juCaEFKfWU+J9lzJDuKZPcur4srqZD4Q0TRUfV1Q2IIjJxEEA vBlDt8D3pHb+EF6bICD8cvRrnkMFqbsT9bVGBZrL+/Y3RO5ZgkQLFzR0ksybmGv9KdWz yqN9h8sMpMS1/1p8NvXsS/oFRt0+YDc6GS8bp/OAcwgwC8t8ZuV7hJ+xXnjSUBZ1daBX GGDzGSeAXKlpMlA92yk97CCqh2AO9IZ0ZGqfqd5kZ2F5v9oG3NsBT0n3jCakRGnH6Ihi h6ZLPVUxyRJiffK03wG+k9VW5mK6Z/Hb1R0YLdki4Zvxq6DGlWn1pGIx9S03LDJgP5mw +5AQ== 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=6Am7vF03M3y7nZWhSx5oc2uWbFc0LDWaXtZFle9eRs8=; b=uPwn8E/4kPyqZh+Y4ihq+TRwaJrY5GlxgqKc+pq9U+lZnG7T82u9iB30i5O7a+17HF Dm4LMGsc6cg+GgEhIIafZNMRPIwG+C2ZdLp7g+XXY0HaqBI0jWQYkZCOAkTQOWhGeNi9 bebPuhqqIpb74jGz2n2ONY2YIuA9d8RgNeET/bQTltzd7eniBZjcytAoeiQyU5a7NwG2 uPyqbg2EUMEQZlzsrJOOSeThE2GsXrfIazMmWiNrG/7omdt+2XLLYr/tmEj33WEvhPu4 G00gzoTIlQAeP9ahZPtDEzthNwBI6cJbiHjy7wS071KYo8fOq8pMtnOB7dp05Mu2F1uO WHbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C+xKOoyx; 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 o18si1078219ejd.107.2020.11.11.03.00.13; Wed, 11 Nov 2020 03:00:38 -0800 (PST) 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=C+xKOoyx; 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 S1726130AbgKKK53 (ORCPT + 99 others); Wed, 11 Nov 2020 05:57:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgKKK52 (ORCPT ); Wed, 11 Nov 2020 05:57:28 -0500 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C24C9C0613D1; Wed, 11 Nov 2020 02:57:28 -0800 (PST) Received: by mail-pj1-x1041.google.com with SMTP id f12so524335pjp.4; Wed, 11 Nov 2020 02:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6Am7vF03M3y7nZWhSx5oc2uWbFc0LDWaXtZFle9eRs8=; b=C+xKOoyxAz5GjK3Rf4UzrNHirPH+2MrY7rzjV05ZEdn21y4VBaFilCaUbqUtqj4LJx f/Cf7GpSUUk3P7pC/pfXQHC19ro+nkqFGuGSZnOQ/u4OaUzQpB0b/TzpqpfmaQWyDhII MLabBrSE6Qx241lHyxhFLYEKs5BmOSfm/ToIfeK3hPWgvShWMJY38H+cQjwTEdEI1cYD ilyb5rCSbAHd6XikT+x9MdH50c5/FDW9p41ZoUUn/MAb+U3abkVhaM5LBn0mdULDqwQp dJfWJ9cr6i/46q/T0f9+n5xsrIpXhZq8w9ZH3hwO7uB/SLLeWdMhXo1fwmHDOdhTDSo5 Bn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6Am7vF03M3y7nZWhSx5oc2uWbFc0LDWaXtZFle9eRs8=; b=rIoN5ffqfV9O7BcX0xYKWLkwUa8EJrEvWKuZuVhQkLAyC47IjcLl/sYzYm7/hUyIaR 7NL3x3mBZwjIhxqo7CEkoeNnZr+3h+pCuOpXw69t4cVmpX2eRCuae5/LxisYMKLeLE8U SoTvzuiWyy7lzBr+w9H9YfiCesXpjtfzD/a0Xr7iHUAKOJgvT8YxLX/rmGG+KwPJ8leQ FMgRR9UFzMC8AZSHlx78jjf9u7qUJAc5Nx632kGHa6qGdzd50DgtYW92racMSY4OkGlE 9i36miX1S01PrABx0GFoz/qTs9QTjm0Nudo/JDD0ClmtNkWDYhUdimfvYklRJfGLZsA9 HHlg== X-Gm-Message-State: AOAM5303MgcwkSz+aZwtFB2qXkkUuJ0HFQt5xu2SpHGDQSTRdgO92nrg UkP+w7ndHsF7PQ3uRS2xC+k= X-Received: by 2002:a17:90a:5508:: with SMTP id b8mr3331730pji.85.1605092248166; Wed, 11 Nov 2020 02:57:28 -0800 (PST) Received: from gmail.com ([223.179.149.110]) by smtp.gmail.com with ESMTPSA id y23sm2228745pje.41.2020.11.11.02.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 02:57:27 -0800 (PST) Date: Wed, 11 Nov 2020 16:24:58 +0530 From: Vaibhav Gupta To: Jarkko Nikula Cc: Ajay Gupta , Bjorn Helgaas , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH v1] i2c: nvidia-gpu: drop empty stub for runtime pm Message-ID: References: <20201107082151.58239-1-vaibhavgupta40@gmail.com> <20201107090442.GA107675@gmail.com> <6989eb51-a36c-6e43-86f3-9b02ab490d95@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6989eb51-a36c-6e43-86f3-9b02ab490d95@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 02:33:43PM +0200, Jarkko Nikula wrote: > On 11/7/20 11:04 AM, Vaibhav Gupta wrote: > > On Sat, Nov 07, 2020 at 01:51:51PM +0530, Vaibhav Gupta wrote: > > > After the commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback > > > functions") we no more need empty stubs for runtime-pm to work. > > > > > > The driver has no device specific task(s) for .suspend() . The stub was > > > placed just for runtime-pm, which can be dropped now. > > > > > > Reported-by: Bjorn Helgaas > > > Signed-off-by: Vaibhav Gupta > > > --- > > > drivers/i2c/busses/i2c-nvidia-gpu.c | 10 +--------- > > > 1 file changed, 1 insertion(+), 9 deletions(-) > > > > > > diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c > > > index f9a69b109e5c..6b20601ffb13 100644 > > > --- a/drivers/i2c/busses/i2c-nvidia-gpu.c > > > +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c > > > @@ -353,15 +353,7 @@ static void gpu_i2c_remove(struct pci_dev *pdev) > > > pci_free_irq_vectors(pdev); > > > } > > > -/* > > > - * We need gpu_i2c_suspend() even if it is stub, for runtime pm to work > > > - * correctly. Without it, lspci shows runtime pm status as "D0" for the card. > > > - * Documentation/power/pci.rst also insists for driver to provide this. > > > - */ > > > -static __maybe_unused int gpu_i2c_suspend(struct device *dev) > > > -{ > > > - return 0; > > > -} > > > +#define gpu_i2c_suspend NULL > Perhaps we can put NULL directly into UNIVERSAL_DEV_PM_OPS() for the suspend > callback? > Yes. I have noticed that the approach for this is random. Many drivers pass NULL directly to the dev_pm_ops type variable, and rest of them use a macro. I used it for symmetry. I mean there is 'gpu_i2c_resume', so although a macro, I have put a 'gpu_i2c_suspend'. Although it won't make any significant change, but if required, I can send another patch where NULL is passed into UNIVERSAL_DEV_PM_OPS() instead. > > > static __maybe_unused int gpu_i2c_resume(struct device *dev) > > > { > > > -- > > > 2.28.0 > > > > > The patch is only compile-tested. > > > It should work also system suspend point of view. This patch affects also it > since callbacks are set with the UNIVERSAL_DEV_PM_OPS(). Means the same > callback is used for runtime PM and system suspend. > > I quickly debugged this with an another driver and PCI stack does put the > device into D3 state in system suspend from pci_prepare_to_sleep() if the > suspend callback is not set and device was on prior it. > > Reviewed-by: Jarkko Nikula Thanks for debugging. Theoretically too, according to generic framework, drivers are supposed to do only device specific jobs. If there is none, or callback is set as NULL, remaining work to put the device in lower power state is PCI stack's task. --Vaibhav