From patchwork Mon Apr 17 21:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 84470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2410751vqo; Mon, 17 Apr 2023 14:25:03 -0700 (PDT) X-Google-Smtp-Source: AKy350bfxTeccXXCbLtSOj/rIHz+667x7fzMQv2Bm92ngXlvAcJGGlEETlkaPDqHz8/uttJtJVLH X-Received: by 2002:a05:6a00:2da6:b0:63d:2d99:2e7c with SMTP id fb38-20020a056a002da600b0063d2d992e7cmr2937009pfb.0.1681766703537; Mon, 17 Apr 2023 14:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681766703; cv=none; d=google.com; s=arc-20160816; b=u9wnXCveK6SnMWSPFCnM5z5IyAO4T470J9qKWFqS9a1YxvuhEVwa02kS0eMiS40G9X bX76/DeHctckR2P2CRyEpuQoHOG4uAfO8n8Z4i1feNzwL+lQ8r8vIc3v84LsLbm4ppd5 LOl3D4XW1Uha+BeyPhEqLK8z3CnoN9v49F7a9wROhlA6pMyWgTw3PMUmgm2t1inYLLbo I2Wzi19HylmG3cnqUrrTpjuvw3ly+nWu13Qjp07TOOiucwl7DQrEGVfkajJkd8mBmkGM vlf5Zvi+fslS5GQfOx2iuOxt34BgbeGQcCWbHV5O0XqV5nyH/KNSCQcJhko834kuIe+b hWeA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=iQuGONMg0gVMmKMymt1WrqRHreBQDtBopG/0Gb2lXo0=; b=FQXru9gGu+kJp7UUkHk9cI6ozOCysKp80eXg7I0jXOt2mv3aW3G7EmoArhmda0z0MW 8ZfEAOGDIjXiAKNgYK0aipA0aC/+Slxf9cpLgtcDDlfUKbOUs9GALumSaNu0qh0t52zY Pru5JNEy4zv9EzUpq1b6MZ7OoJcjiEfk8vQ3qSBW/VljN9adv09Zqipo3yE66r4Vpenv 8nGLdesznwOD9wmM3Vy9hvBBwV+Dltq56npBhSSibWmbJrRrYgD9WPQ+g48lm1NcVHSk m9M+9DpXFUw6sascs7NibenGFSAx22K471PgMbCBzV1qJIxSDISAaS/uPjO7U5LqX4IQ MsDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GwWfpxW4; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020aa7968e000000b0063afbcffff5si11172826pfk.15.2023.04.17.14.24.49; Mon, 17 Apr 2023 14:25:03 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=GwWfpxW4; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjDQVFd (ORCPT + 99 others); Mon, 17 Apr 2023 17:05:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbjDQVFa (ORCPT ); Mon, 17 Apr 2023 17:05:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F6110F0 for ; Mon, 17 Apr 2023 14:05:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A70D62A35 for ; Mon, 17 Apr 2023 21:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83730C433D2; Mon, 17 Apr 2023 21:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681765528; bh=52CmbMWSGGlcsW0V31cEnaaOdCM0vYFCDeDCtkUevl0=; h=From:To:Cc:Subject:Date:From; b=GwWfpxW4bU6LZiq+Q8pr5OqGmmUa/5KdN85Ai8A0eDaznC0OnH4A/r02FYwzR9bbP UhmPxtE3k7+tEpJy4Zd3/k5hO0VYaF7pEK2HQMSvhmozzsh0Z8XZvHI5A4aWBRuTTm YT3IhkxDLQ6tIEpCyfj6XN+AeyKunLeafgyNZNFatfXlZFw5PKgT7wYDzKaX1JsHqK PgBc/4rOyZB1wrw3vEBeMDIIoZz0iEu7DNdQbe/H/VyYreGS6MHoYvIDMSpsWhJB81 vhor1cAGc+wKO53K7B0DQhVKVozvCy51HCNxi2hub53JvXOeVD2fXSUJTuevUKcW4N ufmoTAICrFe1w== From: Arnd Bergmann To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: Arnd Bergmann , Thomas Zimmermann , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/radeon: move prototypes to header Date: Mon, 17 Apr 2023 23:04:50 +0200 Message-Id: <20230417210523.2553531-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1763460202932988297?= X-GMAIL-MSGID: =?utf-8?q?1763460202932988297?= From: Arnd Bergmann Global functions in radeon_atpx_handler.c are not declared in a header but instead in each file using them. This risks the types getting out of sync and causes warnings: drivers/gpu/drm/radeon/radeon_atpx_handler.c:64:6: error: no previous prototype for 'radeon_has_atpx' [-Werror=missing-prototypes] drivers/gpu/drm/radeon/radeon_atpx_handler.c:68:6: error: no previous prototype for 'radeon_has_atpx_dgpu_power_cntl' [-Werror=missing-prototypes] drivers/gpu/drm/radeon/radeon_atpx_handler.c:72:6: error: no previous prototype for 'radeon_is_atpx_hybrid' [-Werror=missing-prototypes] drivers/gpu/drm/radeon/radeon_atpx_handler.c:76:6: error: no previous prototype for 'radeon_atpx_dgpu_req_power_for_displays' [-Werror=missing-prototypes] drivers/gpu/drm/radeon/radeon_atpx_handler.c:594:6: error: no previous prototype for 'radeon_register_atpx_handler' [-Werror=missing-prototypes] drivers/gpu/drm/radeon/radeon_atpx_handler.c:612:6: error: no previous prototype for 'radeon_unregister_atpx_handler' [-Werror=missing-prototypes] Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/radeon/radeon.h | 18 ++++++++++++++++++ drivers/gpu/drm/radeon/radeon_acpi.c | 6 ------ drivers/gpu/drm/radeon/radeon_atpx_handler.c | 1 + drivers/gpu/drm/radeon/radeon_device.c | 8 -------- drivers/gpu/drm/radeon/radeon_drv.c | 13 ------------- drivers/gpu/drm/radeon/radeon_kms.c | 6 ------ 6 files changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 8afb03bbce29..74fb4dfc3e5e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2964,6 +2964,24 @@ void radeon_irq_kms_set_irq_n_enabled(struct radeon_device *rdev, void radeon_audio_component_init(struct radeon_device *rdev); void radeon_audio_component_fini(struct radeon_device *rdev); +/* atpx handler */ +#if defined(CONFIG_VGA_SWITCHEROO) +bool radeon_has_atpx(void); +void radeon_register_atpx_handler(void); +void radeon_unregister_atpx_handler(void); +bool radeon_has_atpx_dgpu_power_cntl(void); +bool radeon_is_atpx_hybrid(void); +bool radeon_atpx_dgpu_req_power_for_displays(void); +#else +static inline bool radeon_has_atpx(void) { return false; } +static inline void radeon_register_atpx_handler(void) {} +static inline void radeon_unregister_atpx_handler(void) {} +static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; } +static inline bool radeon_is_atpx_hybrid(void) { return false; } +static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; } +#endif + + #include "radeon_object.h" #endif diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 5771d1fcb073..695c673eb9f6 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c @@ -38,12 +38,6 @@ #include "radeon_acpi.h" #include "radeon_pm.h" -#if defined(CONFIG_VGA_SWITCHEROO) -bool radeon_atpx_dgpu_req_power_for_displays(void); -#else -static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; } -#endif - #define ACPI_AC_CLASS "ac_adapter" struct atif_verify_interface { diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 6f93f54bf651..dfd30558f8e8 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c @@ -12,6 +12,7 @@ #include #include "radeon_acpi.h" +#include "radeon.h" struct radeon_atpx_functions { bool px_params; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index afbb3a80c0c6..180f8aa971b4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -113,14 +113,6 @@ static const char radeon_family_name[][16] = { "LAST", }; -#if defined(CONFIG_VGA_SWITCHEROO) -bool radeon_has_atpx_dgpu_power_cntl(void); -bool radeon_is_atpx_hybrid(void); -#else -static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; } -static inline bool radeon_is_atpx_hybrid(void) { return false; } -#endif - #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) struct radeon_px_quirk { diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index e4374814f0ef..d8d75b347678 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -128,19 +128,6 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args); -/* atpx handler */ -#if defined(CONFIG_VGA_SWITCHEROO) -void radeon_register_atpx_handler(void); -void radeon_unregister_atpx_handler(void); -bool radeon_has_atpx_dgpu_power_cntl(void); -bool radeon_is_atpx_hybrid(void); -#else -static inline void radeon_register_atpx_handler(void) {} -static inline void radeon_unregister_atpx_handler(void) {} -static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; } -static inline bool radeon_is_atpx_hybrid(void) { return false; } -#endif - int radeon_no_wb; int radeon_modeset = -1; int radeon_dynclks = -1; diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index e0214cf1b43b..2a491381fb26 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -41,12 +41,6 @@ #include "radeon_drv.h" #include "radeon_kms.h" -#if defined(CONFIG_VGA_SWITCHEROO) -bool radeon_has_atpx(void); -#else -static inline bool radeon_has_atpx(void) { return false; } -#endif - /** * radeon_driver_unload_kms - Main unload function for KMS. *