Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp723324rwb; Wed, 9 Nov 2022 07:58:41 -0800 (PST) X-Google-Smtp-Source: AMsMyM4r+9+lSRWt2xsAO6YBoR/V/dBbkz3w582BryQHYBiV6KLlw6W7dtCAOeI31iAVvyTgVmlT X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr57241506ejb.551.1668009521707; Wed, 09 Nov 2022 07:58:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668009521; cv=none; d=google.com; s=arc-20160816; b=0Knrdjyx+Omtov/uoASrZsaetn+lZOIk6NxVAME1MN9XBsXNxhxunphIi7WwOhZsCL Ou0qh5lo24GOwVquvtJvLH3o8oAcKOA424Zc36OelIlm8VAtYVSyfTgo5EH3GSOLRFR2 XnJN+hCs0SULtnL0BidQ1BIOo11yOWG3fIA3m1+m05GqwX/cEKxtiowjBXQGDRy56pez ZNZoJ2jfgt4isr2FLKa/1TLSsghIbxASJOuAGTyZ5s0qUjoKvlyzDKp8mpVDOqiw6Q3S 3OWP+/mcJcR6qb37G8EYR6MKLpqTPRwbOZhUqMi4nr+O7CnHZRe044VXTmKHJQixHdbX z9Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=RRyszD8B7NXPOXXP9dD5cgoopygIQ+/VR1/UnBYKjz0=; b=uV51NFhmFFUa/IfjJboxRiRHxLZNqUY+i+IcZN9cpjxSGXUI6wr8IzAixeNAa4ja9D yietOK8TAfndfgN4tBWPWjXXg+aH778AEzkufL+BEBZquIBUmXujuTZK/f6vGWSdFgNJ dCeTLWhRvFXw8+zbSnws2gNXR3L43jaCZ8smiIu/zPItaX7l+eGpoprUWJ6Bk2EqNyBa znUnVspAqRws7EbUuE7AokTaDDIqwW+odPB0GIM6XeVBplXy5bUwdXERmjjCeosjPH8m hKGEVTYeYGJX2u00Y3MujsrRyaURcnDlyQziOc9ZOiyLn7UpbYO0/CEAYLtUS3u5xRNc cXtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020aa7d458000000b004517955b673si13489905edr.124.2022.11.09.07.58.18; Wed, 09 Nov 2022 07:58:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbiKIPRB (ORCPT + 92 others); Wed, 9 Nov 2022 10:17:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbiKIPQz (ORCPT ); Wed, 9 Nov 2022 10:16:55 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 517581CB24 for ; Wed, 9 Nov 2022 07:16:54 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3766C1FB; Wed, 9 Nov 2022 07:17:00 -0800 (PST) Received: from [10.57.1.94] (unknown [10.57.1.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C8903F73D; Wed, 9 Nov 2022 07:16:51 -0800 (PST) Message-ID: Date: Wed, 9 Nov 2022 15:16:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 16/26] drm: panfrost: Remove #ifdef guards for PM related functions Content-Language: en-GB To: Paul Cercueil , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175256.360839-1-paul@crapouillou.net> <20221107175256.360839-6-paul@crapouillou.net> From: Steven Price In-Reply-To: <20221107175256.360839-6-paul@crapouillou.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/11/2022 17:52, Paul Cercueil wrote: > Use the EXPORT_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr() macros to handle > the PM callbacks. > > These macros allow the PM functions to be automatically dropped by the > compiler when CONFIG_PM is disabled, without having to use #ifdef > guards. > > This has the advantage of always compiling these functions in, > independently of any Kconfig option. Thanks to that, bugs and other > regressions are subsequently easier to catch. > > Signed-off-by: Paul Cercueil Reviewed-by: Steven Price > --- > Cc: Rob Herring > Cc: Tomeu Vizoso > Cc: Steven Price > Cc: Alyssa Rosenzweig > --- > drivers/gpu/drm/panfrost/panfrost_device.c | 10 ++++++---- > drivers/gpu/drm/panfrost/panfrost_device.h | 4 ++-- > drivers/gpu/drm/panfrost/panfrost_drv.c | 7 +------ > 3 files changed, 9 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c > index ee612303f076..fa1a086a862b 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.c > +++ b/drivers/gpu/drm/panfrost/panfrost_device.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > > #include "panfrost_device.h" > @@ -400,8 +401,7 @@ void panfrost_device_reset(struct panfrost_device *pfdev) > panfrost_job_enable_interrupts(pfdev); > } > > -#ifdef CONFIG_PM > -int panfrost_device_resume(struct device *dev) > +static int panfrost_device_resume(struct device *dev) > { > struct panfrost_device *pfdev = dev_get_drvdata(dev); > > @@ -411,7 +411,7 @@ int panfrost_device_resume(struct device *dev) > return 0; > } > > -int panfrost_device_suspend(struct device *dev) > +static int panfrost_device_suspend(struct device *dev) > { > struct panfrost_device *pfdev = dev_get_drvdata(dev); > > @@ -423,4 +423,6 @@ int panfrost_device_suspend(struct device *dev) > > return 0; > } > -#endif > + > +EXPORT_GPL_RUNTIME_DEV_PM_OPS(panfrost_pm_ops, panfrost_device_suspend, > + panfrost_device_resume, NULL); > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 8b25278f34c8..d9ba68cffb77 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -7,6 +7,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -172,8 +173,7 @@ int panfrost_device_init(struct panfrost_device *pfdev); > void panfrost_device_fini(struct panfrost_device *pfdev); > void panfrost_device_reset(struct panfrost_device *pfdev); > > -int panfrost_device_resume(struct device *dev); > -int panfrost_device_suspend(struct device *dev); > +extern const struct dev_pm_ops panfrost_pm_ops; > > enum drm_panfrost_exception_type { > DRM_PANFROST_EXCEPTION_OK = 0x00, > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c > index 2fa5afe21288..fa619fe72086 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c > @@ -676,17 +676,12 @@ static const struct of_device_id dt_match[] = { > }; > MODULE_DEVICE_TABLE(of, dt_match); > > -static const struct dev_pm_ops panfrost_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) > - SET_RUNTIME_PM_OPS(panfrost_device_suspend, panfrost_device_resume, NULL) > -}; > - > static struct platform_driver panfrost_driver = { > .probe = panfrost_probe, > .remove = panfrost_remove, > .driver = { > .name = "panfrost", > - .pm = &panfrost_pm_ops, > + .pm = pm_ptr(&panfrost_pm_ops), > .of_match_table = dt_match, > }, > };