Commit 15e19d83 authored by Jesse.Zhang's avatar Jesse.Zhang Committed by Alex Deucher
Browse files

drm/amd/amdgpu: Fix build errors due to declarations after labels



In C90 (which the kernel uses with -std=gnu89), declarations must
appear at the beginning of a block and cannot follow a label. The
switch cases in amdgpu_discovery.c and gmc_v12_1.c contained variable
declarations immediately after case labels, causing the compiler to
error:

drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c:533:3: error: a label can only be
part of a statement and a declaration is not a statement

Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarJesse Zhang <jesse.zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f802f7b0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -527,10 +527,11 @@ static void gmc_v12_1_get_coherence_flags(struct amdgpu_device *adev,
	unsigned int mtype, mtype_local, mtype_remote;
	bool snoop = false;
	bool is_local = false;
	bool is_aid_a1;

	switch (gc_ip_version) {
	case IP_VERSION(12, 1, 0):
		bool is_aid_a1 = (adev->rev_id & 0x10);
		is_aid_a1 = (adev->rev_id & 0x10);

		mtype_local = is_aid_a1 ? MTYPE_RW : MTYPE_NC;
		mtype_remote = is_aid_a1 ? MTYPE_NC : MTYPE_UC;
+3 −2
Original line number Diff line number Diff line
@@ -1220,6 +1220,7 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm,
	bool coherent = flags & (KFD_IOCTL_SVM_FLAG_COHERENT | KFD_IOCTL_SVM_FLAG_EXT_COHERENT);
	bool ext_coherent = flags & KFD_IOCTL_SVM_FLAG_EXT_COHERENT;
	unsigned int mtype_local, mtype_remote;
	bool is_aid_a1, is_local;

	if (domain == SVM_RANGE_VRAM_DOMAIN)
		bo_node = prange->svm_bo->node;
@@ -1307,8 +1308,8 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm,
		mapping_flags |= AMDGPU_VM_MTYPE_NC;
		break;
	case IP_VERSION(12, 1, 0):
		bool is_aid_a1 = (node->adev->rev_id & 0x10);
		bool is_local = (domain == SVM_RANGE_VRAM_DOMAIN) &&
		is_aid_a1 = (node->adev->rev_id & 0x10);
		is_local = (domain == SVM_RANGE_VRAM_DOMAIN) &&
				(bo_node->adev == node->adev);

		mtype_local = amdgpu_mtype_local == 0 ? AMDGPU_VM_MTYPE_RW :