Skip to contentSkip to conversation

drm/amdgpu/vcn: fix compilation issue with legacy gcc

PATCH In review bobzhou 2 participants 2 messages Feb 23, 2023

Subsystems (2)
lore
Share & tools
lore

bobzhou

author
#0 lore raw

PATCH 1/1 drm/amdgpu/vcn: fix compilation issue with legacy gcc

This patch is used to fix following compilation issue with legacy gcc
error: ‘for’ loop initial declarations are only allowed in C99 mode

	for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +2 -1
index 213b43670f23..2331383490ff 100644
@@ -79,10 +79,11 @@ static int vcn_v4_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_ring *ring;
+	int i;
 
 	if (amdgpu_sriov_vf(adev)) {
 		adev->vcn.harvest_config = VCN_HARVEST_MMSCH;
-		for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+		for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 			ring = &adev->vcn.inst[i].ring_enc[0];
 			if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
 				adev->vcn.harvest_config |= 1 << i;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Regards,
Guchun

-----Original Message-----
From: bobzhou <[email protected]>
Sent: Thursday, February 23, 2023 3:13 PM
To: [email protected]; Chen, Guchun <[email protected]>; Cui, Flora <[email protected]>; Shi, Leslie <[email protected]>; Ma, Jun <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH] drm/amdgpu/vcn: fix compilation issue with legacy gcc

This patch is used to fix following compilation issue with legacy gcc
error: ‘for’ loop initial declarations are only allowed in C99 mode

	for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +2 -2
index 213b43670f23..2331383490ff 100644
@@ -79,10 +79,11 @@ static int vcn_v4_0_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_ring *ring;
+	int i;
 
 	if (amdgpu_sriov_vf(adev)) {
 		adev->vcn.harvest_config = VCN_HARVEST_MMSCH;
-		for (int i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+		for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 			ring = &adev->vcn.inst[i].ring_enc[0];
 			if (amdgpu_vcn_is_disabled_vcn(adev, VCN_ENCODE_RING, i)) {
 				adev->vcn.harvest_config |= 1 << i;
--

2.34.1