Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2202273rwb; Mon, 7 Nov 2022 10:19:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM6EEu9Y6OJgPkNewKWfdMy5NCiDupZdCMsVQjjqZvHcwNRlSG6nRVyLqqjjZZpB1XKXv8z/ X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr50164203ejc.525.1667845198093; Mon, 07 Nov 2022 10:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667845198; cv=none; d=google.com; s=arc-20160816; b=ziTAYmTeZY8kY96eQLrAXygnHbTfYHCzeWAqR8ZvV0wHWh/sfozOgSO5x+ABvxzmfw 50LUeNaLnH3xPN4y6XJIZSz/chiTdQ1KvanAfOdpAiSVwjNNNkLEVz92YoaB0kezBwyS aRUAxkS9CPo9FXhDN4nR8S5IMMuRJFqLKfwxL/JVgRlryMz33gmmPABaq9dEmwzWnGXX xOALwCfEM0m9EmaE6BmdrKvIRXNPclfHkTTBg7D7F/rvIVZME+vGC8JrvxdjEDSABmtg EWpa8xS3uA8unfOBMZVzGTQK8J2VmCikhfP+nY4lewwRyIvmEFfQKTtAKe5/IU28jyF3 Y9Ow== 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=SczkVuoooim0YUgttnhtlNdCCDZ0hrrI0SjUiKFYBio=; b=0D+YonjF4EbcWxdf1fSxgrlYOrYRaXD0X2FhvCVdUT5+OYZa0yIeilXGBeY+CvOJMP sYYfeezZYAXJz+pmyY/bkFDwfi34Il8hGK/3khNRVAqRVTOFlY/HbP/1asvifk5qdRnN 7wRPZy8MMAPSv31U0LmQGe7BlxiXCu62bekWbC/3kd55y37G9T71n/xwzbUSo/tmLel7 u3vIcVPMCg1EBbzLfu3Bu689pB5ZuZTNF647/AzPz72rNqQYowu6TuFDrPFaPszTLYri 8W1y1N5iv3uL8RwWoisU3MKiOhXhrHaf2dJ6n3e4p1PHHq7DgEiN/MDfhobCum6YboH7 RKIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=glszKEq3; 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 wg11-20020a17090705cb00b0078d6418dcb8si10877801ejb.456.2022.11.07.10.19.35; Mon, 07 Nov 2022 10:19:58 -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=glszKEq3; 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 S233005AbiKGR5F (ORCPT + 93 others); Mon, 7 Nov 2022 12:57:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbiKGR41 (ORCPT ); Mon, 7 Nov 2022 12:56:27 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3E2026498 for ; Mon, 7 Nov 2022 09:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843597; 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=SczkVuoooim0YUgttnhtlNdCCDZ0hrrI0SjUiKFYBio=; b=glszKEq353IeTdaVP6rVugMjdsK+13RtgaSsRpj9sp/jR40icIRsKgcdOFk+UCMj+/ITO+ w5Fhn8AeEeqdg38vNpR+ZZV+jiXhzfcBN1Yb4SCi0/2nEEOxKyvQwuOUWxCDJdQPe6R6UV FsvAqOJDQGCjUMpey/9aTp94eRm1hxI= 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 , Emma Anholt Subject: [PATCH 23/26] drm: vc4: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:53 +0000 Message-Id: <20221107175256.360839-13-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 RUNTIME_PM_OPS() and pm_ptr() macros to handle the .runtime_suspend/.runtime_resume callbacks. These macros allow the suspend and resume 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. Note that this driver should probably use the DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide .suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and pm_runtime_force_resume() respectively; unless those callbacks really aren't needed. Signed-off-by: Paul Cercueil --- Cc: Emma Anholt Cc: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_v3d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index 56abb0d6bc39..6000c7032b92 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -368,7 +368,6 @@ void vc4_v3d_bin_bo_put(struct vc4_dev *vc4) mutex_unlock(&vc4->bin_bo_lock); } -#ifdef CONFIG_PM static int vc4_v3d_runtime_suspend(struct device *dev) { struct vc4_v3d *v3d = dev_get_drvdata(dev); @@ -397,7 +396,6 @@ static int vc4_v3d_runtime_resume(struct device *dev) return 0; } -#endif int vc4_v3d_debugfs_init(struct drm_minor *minor) { @@ -525,7 +523,7 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master, } static const struct dev_pm_ops vc4_v3d_pm_ops = { - SET_RUNTIME_PM_OPS(vc4_v3d_runtime_suspend, vc4_v3d_runtime_resume, NULL) + RUNTIME_PM_OPS(vc4_v3d_runtime_suspend, vc4_v3d_runtime_resume, NULL) }; static const struct component_ops vc4_v3d_ops = { @@ -557,6 +555,6 @@ struct platform_driver vc4_v3d_driver = { .driver = { .name = "vc4_v3d", .of_match_table = vc4_v3d_dt_match, - .pm = &vc4_v3d_pm_ops, + .pm = pm_ptr(&vc4_v3d_pm_ops), }, }; -- 2.35.1