Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2177546rwb; Mon, 7 Nov 2022 10:03:36 -0800 (PST) X-Google-Smtp-Source: AMsMyM77FIOWHIeP/gWU+fUGlGD0ATjKA3mgmRiZptPAIuefGF4ribVar+n8U1/LPWhYZG71U+md X-Received: by 2002:a17:906:504f:b0:7ad:fc14:fed2 with SMTP id e15-20020a170906504f00b007adfc14fed2mr29117862ejk.611.1667844216207; Mon, 07 Nov 2022 10:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667844216; cv=none; d=google.com; s=arc-20160816; b=LjblCoioXjQuMqmaNnyKOv8BaKD7WgH2IKWRjGdr69YX2antRCgTCXRBqhZXmEY5I1 5vDn8sLEAhfh9XrlPpV5c8k9MDMGBzoOc/Mp/g5Jhl+fdW4x1kBcRhm3hx0U42i93W9G K6HRBcdihw7SmW70oDB9ygewNVhH9N7zIrzAlTXulfKrsHovqIF+aYbrYZdj0/nCM3kT DfouXjZGto1Blo+XK0OtyY0cbGvuooE6zB67JMMkeJldONECrPvFDM0XAB2tzQplesys Eyo9qU/Fg2wZxY+95cSYY7RDYzMdcEIOG5n3C0vuKCaHb+AnoZ11T93h5pz7GY1xzRdo qQ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S+yQFkjdP/jifUhuMI/LX0bFF+LF4Dh5aR0516qergg=; b=aH0A3Ru2TItZnEa+fTvRI+Z9ViR2gRsV1ajFYrM+QNT+nyywXan2vSyn0TGA49xXqC kkLhLASg5NYHwEUn0wuJ5Lwwg3OwsynjhYlbwb0HNCUfEO4WSGQnMQbHjzuY3XjAe1nH w4ilgNBk9+J+ZUxPyOAOk/7aC3x8CPctI3luGZ2MCT9jLbvDUJCFebuQ9BemIRSbCeCK Bwpn1II3JSVGd/krCbZBiu4xmKTZT1RQzUBmw+8YxUb4mDcpRGoAnjACz9dT7MhaOqwT SVgXp+sZwkwNcd6NF7sOrRMZPXa3iJycuHjNWhv3M8X8tNSad+052l0W/tSJquZnIF1m u8ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=jIW5SaZ4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020aa7cd1a000000b0045fb7a04ce0si8848877edw.148.2022.11.07.10.03.12; Mon, 07 Nov 2022 10:03:36 -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; dkim=pass header.i=@crapouillou.net header.s=mail header.b=jIW5SaZ4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbiKGRzj (ORCPT + 94 others); Mon, 7 Nov 2022 12:55:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbiKGRy0 (ORCPT ); Mon, 7 Nov 2022 12:54:26 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7E4F248F5 for ; Mon, 7 Nov 2022 09:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843590; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+yQFkjdP/jifUhuMI/LX0bFF+LF4Dh5aR0516qergg=; b=jIW5SaZ4yHLJTfkFiKeDyZDbW7vGqUGKMhYBR7WPBlvLIjATO20mKsIJAikR0tcLgmxVwR JINbUfPpSgA6cl6x1qhoOFgMhgx9n3muxtGDTsf9TRPzcV0cUZjYrIe0faZfaCvlEHKZQl 6AadLDGpoXNEB/1GvFuYfP6NnW7hczY= From: Paul Cercueil To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig Subject: [PATCH 16/26] drm: panfrost: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:46 +0000 Message-Id: <20221107175256.360839-6-paul@crapouillou.net> In-Reply-To: <20221107175256.360839-1-paul@crapouillou.net> References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175256.360839-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 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 --- 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, }, }; -- 2.35.1