From patchwork Mon Nov 7 17:55:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 16630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2207843wru; Mon, 7 Nov 2022 10:07:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM7sG2PJ8uRsoQe3de3vtAQJpnjujGvVBupQ9EVo6MaWNZ5oKNDAhNAfTYNuup3RVqB+lasT X-Received: by 2002:a17:906:11cc:b0:7ad:e178:de59 with SMTP id o12-20020a17090611cc00b007ade178de59mr825061eja.449.1667844464293; Mon, 07 Nov 2022 10:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667844464; cv=none; d=google.com; s=arc-20160816; b=FOm+0bme4TbNRRurb8c4ME7Fxu4dr+kP//cXvm7xpNHgQXazy051dzhul5zVqXZg0P x0YjSSygqW5l0OEF4P8dzJK3972WKFw4Ky9muuWaU8LNthuVUAb9XR7d9WNyI2Ji1OKz EaVOkVB2Wjm9bE1ezr2gc7gC9wnQk5pcq4nEw1cvs7UjqM+gdzMFyAb86oBcYxxnYsXx /MN8ApVkzlw05INM1HqnFHKBrY4MBDPUqrIWBJnowVyaoT0Fnb9/Ao7nsdqBkwgPOpQZ OEjXBkKSqWclT02deJwxegA7uQ8u8RdwFIf9sOaVXC1SWv474dGSkmViJ9SN4kmOCE0Z JfmA== 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=5mAEA/+FkdzN3Ma2ZqP/XBBMcVgHH0HAXQLxvGbSpU0=; b=ZYqBGpgPCckYtmbUyKNeZft+VmtK05BBXf2LYYleYvoSn2Ap9h1aBvngZiPM9FNuD5 JAlzbf0dQl/yOKL0rIlUL4jE9IMWVvG6Q9kxuoELXcIVtOQ8JwKD1bSiv9l0gTMgCQe9 1S65+tSyQsl62mRq3cS3sQo7lLwjKABCX1tOdjfcER6Qh0uedxM0EFSkZu3ergZHoms0 O3rxDPqZ0bNF+Axg4V5vV5GxIxB4m5pQZpoZCTEy6B3uCe5ty5QTssmJXoOxK/SIyN3O AdM3D//yYzdL9InwwSRhG9cBmscHY3m87nvI5gB6jtrhTo7bKJoLJewmIjlY2XBWU8RI 5afw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=l3Lmt0Yd; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js21-20020a17090797d500b0078df948151esi10483767ejc.946.2022.11.07.10.07.19; Mon, 07 Nov 2022 10:07:44 -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=l3Lmt0Yd; 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 S232910AbiKGR7F (ORCPT + 99 others); Mon, 7 Nov 2022 12:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232098AbiKGR6d (ORCPT ); Mon, 7 Nov 2022 12:58:33 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB88729341 for ; Mon, 7 Nov 2022 09:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843720; 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=5mAEA/+FkdzN3Ma2ZqP/XBBMcVgHH0HAXQLxvGbSpU0=; b=l3Lmt0YdceLN+zlv4/YzlXycceCpqax6TX+6l5d2OvDLFagqDeMLvmOEcLVvV1hoAdWqp+ PxEq1lJ0Zqcq7bDf9QPOjtIpEaqINpOHnw/Np/t2lhf1GrVgSvYo3as1TsOjWbn6voYE8Y 4f5F8WKGAKoJYmaGP5KsQWrr+1OJUw4= 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 , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org Subject: [PATCH 26/26] drm/i915/gt: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:55:10 +0000 Message-Id: <20221107175510.361051-3-paul@crapouillou.net> In-Reply-To: <20221107175510.361051-1-paul@crapouillou.net> References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175510.361051-1-paul@crapouillou.net> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748861677001677700?= X-GMAIL-MSGID: =?utf-8?q?1748861677001677700?= 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 2b5f05b31187..decf892a4508 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, i915_reg_t reg) { 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) {