Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1347558rwb; Tue, 29 Nov 2022 12:16:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf6w9AViXRoIcxKzhHq6GGg4hsG6qleOhHJIKVZLi5S4QWsVASL/8nlj5UMdzKR7mgag2dxI X-Received: by 2002:a50:ff0d:0:b0:461:c6e8:452e with SMTP id a13-20020a50ff0d000000b00461c6e8452emr42993829edu.298.1669752985550; Tue, 29 Nov 2022 12:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669752985; cv=none; d=google.com; s=arc-20160816; b=DdZWXuvBKPie6yrAGASOeo9AqOKyK2cOWXIiWmUiFBqpFqAeg0uVAyLcwrijpyO1u1 OylUUR56D/+2by1YtDSxHbk3xF0oNqlF1hwqDreT6tczOtG9FEtXW4pOJ0P6ak8/ACSi PF+Xwid8ZJnVNTZ84rDwG+WDRN8SAmOGfqTmAPcRh5NrlsQxLJBxJAX+tfbBFBz7PMcN Tg0t6fXjuaP4js2n2VnxBCAQz0FLiY0rErkok93DWOZaH7VaeGQdiyuXoynBZO3Eg2fF mMNCC4W++jeEypXGTJ9bllPrt/0zncPQH3+TWP8WfidtDtCD3NJyin52odOoUoJPNE/f l7ZQ== 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=LJ8DQbIPu45uJFi2+s89p8C8So0glLs+3UhV12NFAG4=; b=SENNh9v9QcgSMv0LiuAY+h87IIJaPDqx537Fr547snWEbt/OJJbADquJunCA8pNarE BqHFQoMNM/Qpk83yhPqFPtmJxMLMaHYUFnVAX3Ignlgy+M5KqopmiFGJmf9RrIjbKec8 bJ9s0W/vbOvJAJqKAovzlJEgr1SKU8PHVIMvIMg94xP8GRTr06+zrrY3Rgixn5LXRIL2 N4UlJtjS4C35RCSWAFqgFINVGH/6pzuzCI9bYxhLCwKi2OQVO50oY/qtt9sUxi0/Hgyk DaX5acaLGG88a5RP3wKSiEkokQKZH8jLI3sdykwqNRFFz2+bxiR881zumsSFZ9Js7CvV V4eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=1bld4QEX; 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 g17-20020a1709065d1100b007c08e3b0e0fsi1652092ejt.242.2022.11.29.12.16.04; Tue, 29 Nov 2022 12:16:25 -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=1bld4QEX; 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 S236729AbiK2TZt (ORCPT + 84 others); Tue, 29 Nov 2022 14:25:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236892AbiK2TZ1 (ORCPT ); Tue, 29 Nov 2022 14:25:27 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9FBE2E for ; Tue, 29 Nov 2022 11:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749653; 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=LJ8DQbIPu45uJFi2+s89p8C8So0glLs+3UhV12NFAG4=; b=1bld4QEX0BAnu3Z14gTXZpmFtmvXP8F67tDurl3HqD8RxcF4B8CIQ8VC5WPwwqd6Ktn/EK 1KedmnMleBUB/U3DHVlgwJJIMabuy87w9VHSnZQvPy0xvKXHrNXFEHxq4WnlMT2wPzUTiZ a4WsVlCqWMxNe2ZKCZHvbzdWNBpO9Uc= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org Subject: [PATCH v2 26/26] drm/i915/gt: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:42 +0000 Message-Id: <20221129191942.138244-13-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 Instead of defining two versions of intel_sysfs_rc6_init(), one for each value of CONFIG_PM, add a check on !IS_ENABLED(CONFIG_PM) early in the function. This will allow the compiler to automatically drop the dead code 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: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Cc: intel-gfx@lists.freedesktop.org --- drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c index cf71305ad586..09b9365ededd 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c @@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject *kobj, struct attribute *attr, NULL); \ INTEL_GT_ATTR_RO(_name) -#ifdef CONFIG_PM static u32 get_residency(struct intel_gt *gt, enum intel_rc6_res_type id) { intel_wakeref_t wakeref; @@ -300,7 +299,7 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj) { int ret; - if (!HAS_RC6(gt->i915)) + if (!IS_ENABLED(CONFIG_PM) || !HAS_RC6(gt->i915)) return; ret = __intel_gt_sysfs_create_group(kobj, rc6_attr_group); @@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj) gt->info.id, ERR_PTR(ret)); } } -#else -static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj) -{ -} -#endif /* CONFIG_PM */ static u32 __act_freq_mhz_show(struct intel_gt *gt) { -- 2.35.1