Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1362151rwb; Tue, 29 Nov 2022 12:30:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf56NvqUoRi00u5gM1SwSJnhbSFTKsAttdyc4thzQjxrjhwZIB9k9Ut+k2dedWBLKinbinKA X-Received: by 2002:a17:902:db09:b0:188:7dca:6f4d with SMTP id m9-20020a170902db0900b001887dca6f4dmr52552584plx.68.1669753824895; Tue, 29 Nov 2022 12:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669753824; cv=none; d=google.com; s=arc-20160816; b=r8vCzWHcjoijwftmSDIjk0GKfqgI6dFSS0ZULnoWll7fKCNEgJCD+yInxAJUfaqUBc LSUBhpCkfhIromuFouhjUO5XGgZ3rMKv/0erSLiB9+LjZLtU9QNgJjpep2p3tW4SbGKl dQnXQL266auMaufjY1FuEgozD7RsI26lbUqLTiX/5XwFeOYTiQaAIuorJ1xc/pcmAO+4 DYG4LY26Q6uLAQLJ69AcvK0WknDcrUCSuvYzyqItQEUrzuJq0NP2pndghUsX1OEfXzZa c125X+3lCABqFjBume7KDZS0LvVDE8i1WSAK6sjELv0D7DBtbO6Eit9+bddkRvdXNXdX I/2A== 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=oXo8DZzDmBVu1/2mkqAKNKUU5qOBP3khsqxV1Edxc1Y=; b=jkFEFuKiMlcoVDutvYvoNV1xYwCGzTD01/hN1GpK4+Yg/YLDrSedcCbGvcU8nlRQbz 1nIuK+5boeheYF/hSc6CBdLQ0FEekF/1zGESTMVzLvPbwjaCDlGNCy1eI5Q3CNk8e4iS 1BoA+w+mIyUFQu3VuAce4zCbutbliOlsKW/9UaPtMnfF1pYXFbm6rBtGaVMAdJKYU8Og 29vTRO3pHhHqxApNti7qVXyc068VWnAtZLRor7aRok4qHF9wTZOoMhZvePRUif8jXkuQ TDOVGt7rkRjU7iewIZWU63199TAjfno22/+EXK6JKLePHgEH7VPAl9LLOHQy4WLZst+x oHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Z3LZdktA; 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 x11-20020a170902820b00b001896ba3fc12si11037986pln.613.2022.11.29.12.30.14; Tue, 29 Nov 2022 12:30:24 -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=Z3LZdktA; 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 S236736AbiK2TWH (ORCPT + 84 others); Tue, 29 Nov 2022 14:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236863AbiK2TVZ (ORCPT ); Tue, 29 Nov 2022 14:21:25 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BF96D97B for ; Tue, 29 Nov 2022 11:20:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749595; 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=oXo8DZzDmBVu1/2mkqAKNKUU5qOBP3khsqxV1Edxc1Y=; b=Z3LZdktAxTcmLL1IE7KpG3dZoRAt6TjhkgpYiR2bkB5IQFOshRWQmQ6Ek/52OcPGQqQSOQ UnthQermtDUVb2aLFusE8hE6UOtSVNrPwSgp32BZtpyGvAWMSc99fd+fYaqWXPzHBykfGQ Gr2gdfqwWO2E+vlCe25rlnNpGgCFl7Y= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Steven Price , Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig Subject: [PATCH v2 16/26] drm: panfrost: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:32 +0000 Message-Id: <20221129191942.138244-3-paul@crapouillou.net> In-Reply-To: <20221129191942.138244-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> <20221129191942.138244-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 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, }, }; -- 2.35.1