Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2204779rwb; Mon, 7 Nov 2022 10:22:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM5DRHCTQG8JK1nGKRBjXEqX07IEVbpH0QUYQ4p5Cdnd/73vdC4jXuv6DMbFCoZlCpxLHaKv X-Received: by 2002:a17:903:32c8:b0:187:2718:5313 with SMTP id i8-20020a17090332c800b0018727185313mr39776214plr.82.1667845320516; Mon, 07 Nov 2022 10:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667845320; cv=none; d=google.com; s=arc-20160816; b=Si9K7QRFaqrJztA8iquFWvUw8e+ZDBS37lxIc4OtV6MVxpJ31AgVJdnVr0i3o777vF vdde1KStpTG8bBcJubP7JVZCUccSh8009viNp+G+M7Ws5IFjD0hcKj0/juYTNs+57VF9 pb0weKmXqto+sydkAjmJS36KDif8mg61dMjQIGj33MKOyaDWZRqttjtf4R0mGU383hSX ZJ+1q2xx1rKJ91x8h22CkYfVv1IY34mB6iXuMPjJp5T7ljzRjySywksZkEDeYq8u7HGG f9XAoDl7jSe7zgrtRS4mTOdoM1hstqnVx2JTvQh3gT+WmXvHPe+zZFTp0ZyBydsppbKL rvlg== 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=q+3P3wqz1jwbsocGqfxEzObGi6ZWNcGmPZP0SRMAoFE=; b=WSwrk50GBx9fsIzS6QOigwS7fOtVfAWdiXhAchyU821uAO8R6he7KTBlsLyYUFPvpJ rGaxUS0T33HWUKGmJeMEGRSRagzGtIl1RD5xPWTEKalurrYEEsBFqNSsuWHoQ7XfpF8c VNVL8GZ9/fbnnI8OcIkLGwRq8uLQ7ATu+G6VoUpyoJUhyOyUgKo8BCfpd2+CSUSGd5dI Aj9upFOxZ51D4xZBDSINL7Ns2d1Am/MuwLkm1WxOMJn3KbEKShHdvAGAibjZqVREdWLi 2q/9eleRTXB0lfKJnF/05syowW3uvntvFpUR1/HrDf1whiuegJZsTFfIniXWwZKclDbJ oI9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=RZ2Gk2A4; 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 k16-20020aa788d0000000b0056e7b61ebf7si12857562pff.159.2022.11.07.10.21.47; Mon, 07 Nov 2022 10:22:00 -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=RZ2Gk2A4; 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 S232992AbiKGR4P (ORCPT + 93 others); Mon, 7 Nov 2022 12:56:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232788AbiKGRym (ORCPT ); Mon, 7 Nov 2022 12:54:42 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72FE924BE7; Mon, 7 Nov 2022 09:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843594; 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=q+3P3wqz1jwbsocGqfxEzObGi6ZWNcGmPZP0SRMAoFE=; b=RZ2Gk2A4SHM9nHT+NSSNbHwothCRQAikLa9tCH/TS9p0P01+9U6+f6/OljI8wBhxuWBeB6 UI8/kRqHmWCaQdV3d+Ew5a3yh1JnSfC/7MS2yCu6HEhxKCLPesKbhwRafN3yoWdYtrhEKf p6uyEDWMw333qBxCZyxEqWNtHP23fDM= 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 , Thierry Reding , Jonathan Hunter , linux-tegra@vger.kernel.org Subject: [PATCH 20/26] drm: tegra: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:50 +0000 Message-Id: <20221107175256.360839-10-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: Thierry Reding Cc: Jonathan Hunter Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/dpaux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 7dc681e2ee90..3c84e73d5051 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -598,7 +598,6 @@ static int tegra_dpaux_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM static int tegra_dpaux_suspend(struct device *dev) { struct tegra_dpaux *dpaux = dev_get_drvdata(dev); @@ -657,10 +656,9 @@ static int tegra_dpaux_resume(struct device *dev) clk_disable_unprepare(dpaux->clk); return err; } -#endif static const struct dev_pm_ops tegra_dpaux_pm_ops = { - SET_RUNTIME_PM_OPS(tegra_dpaux_suspend, tegra_dpaux_resume, NULL) + RUNTIME_PM_OPS(tegra_dpaux_suspend, tegra_dpaux_resume, NULL) }; static const struct tegra_dpaux_soc tegra124_dpaux_soc = { @@ -694,7 +692,7 @@ struct platform_driver tegra_dpaux_driver = { .driver = { .name = "tegra-dpaux", .of_match_table = tegra_dpaux_of_match, - .pm = &tegra_dpaux_pm_ops, + .pm = pm_ptr(&tegra_dpaux_pm_ops), }, .probe = tegra_dpaux_probe, .remove = tegra_dpaux_remove, -- 2.35.1