Re: [PATCH 3/3] drm/amdgpu: move function declaration to header file

From: Alex Deucher
Date: Mon Oct 24 2016 - 12:29:14 EST


On Sat, Oct 22, 2016 at 4:48 AM, Baoyou Xie <baoyou.xie@xxxxxxxxxx> wrote:
> We get 1 warning when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:37:6: warning: no previous prototype for 'amdgpu_pm_acpi_event_handler' [-Wmissing-prototypes]
>
> In fact, this function is defined in
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c, but should be declared
> in a header file. So this patch moves the function declaration
> to drivers/gpu/drm/amd/amdgpu/amdgpu.h.

I want to try and avoid making amdgpu.h a random dumping ground for
function defs. Let's put it in amdgpu_pm.h instead. How about the
attached patch?

Alex


>
> Signed-off-by: Baoyou Xie <baoyou.xie@xxxxxxxxxx>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 1 -
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 039b57e..c0bc42b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2145,6 +2145,8 @@ void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v);
> u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index);
> void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v);
>
> +void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
> +
> /*
> * Registers read & write functions.
> */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 5796539..d77d630 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -33,7 +33,6 @@
> #include "amd_acpi.h"
> #include "atom.h"
>
> -extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
> /* Call the ATIF method
> */
> /**
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
From 3714f3beec519d4e49ce6a482688ae98072979da Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@xxxxxxx>
Date: Mon, 24 Oct 2016 12:24:11 -0400
Subject: [PATCH] drm/amdgpu: amdgpu_pm_acpi_event_handler definition to a
header file

Add it to amdgpu_pm.h Fixes building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:37:6: warning: no previous prototype for 'amdgpu_pm_acpi_event_handler' [-Wmissing-prototypes]

Inspired by a similar patch from Baoyou Xie.

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 5796539..ec22e64 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -30,10 +30,10 @@
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
#include "amdgpu.h"
+#include "amdgpu_pm.h"
#include "amd_acpi.h"
#include "atom.h"

-extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
/* Call the ATIF method
*/
/**
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
index 5fd7734..7e14521 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
@@ -28,6 +28,7 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev);
void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev);
void amdgpu_pm_print_power_states(struct amdgpu_device *adev);
void amdgpu_pm_compute_clocks(struct amdgpu_device *adev);
+void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
void amdgpu_dpm_thermal_work_handler(struct work_struct *work);
void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);
void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable);
--
2.5.5