Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Reorganize sysfs ini/fini calls

Aggregate sysfs ini/fini calls into separate functions. No functional
change.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
aa6674f2 db36632e

+51 -37
+51 -37
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 4385 4385 dev_info(adev->dev, "MCBP is enabled\n"); 4386 4386 } 4387 4387 4388 + static int amdgpu_device_sys_interface_init(struct amdgpu_device *adev) 4389 + { 4390 + int r; 4391 + 4392 + r = amdgpu_atombios_sysfs_init(adev); 4393 + if (r) 4394 + drm_err(&adev->ddev, 4395 + "registering atombios sysfs failed (%d).\n", r); 4396 + 4397 + r = amdgpu_pm_sysfs_init(adev); 4398 + if (r) 4399 + dev_err(adev->dev, "registering pm sysfs failed (%d).\n", r); 4400 + 4401 + r = amdgpu_ucode_sysfs_init(adev); 4402 + if (r) { 4403 + adev->ucode_sysfs_en = false; 4404 + dev_err(adev->dev, "Creating firmware sysfs failed (%d).\n", r); 4405 + } else 4406 + adev->ucode_sysfs_en = true; 4407 + 4408 + r = amdgpu_device_attr_sysfs_init(adev); 4409 + if (r) 4410 + dev_err(adev->dev, "Could not create amdgpu device attr\n"); 4411 + 4412 + r = devm_device_add_group(adev->dev, &amdgpu_board_attrs_group); 4413 + if (r) 4414 + dev_err(adev->dev, 4415 + "Could not create amdgpu board attributes\n"); 4416 + 4417 + amdgpu_fru_sysfs_init(adev); 4418 + amdgpu_reg_state_sysfs_init(adev); 4419 + amdgpu_xcp_sysfs_init(adev); 4420 + 4421 + return r; 4422 + } 4423 + 4424 + static void amdgpu_device_sys_interface_fini(struct amdgpu_device *adev) 4425 + { 4426 + if (adev->pm.sysfs_initialized) 4427 + amdgpu_pm_sysfs_fini(adev); 4428 + if (adev->ucode_sysfs_en) 4429 + amdgpu_ucode_sysfs_fini(adev); 4430 + amdgpu_device_attr_sysfs_fini(adev); 4431 + amdgpu_fru_sysfs_fini(adev); 4432 + 4433 + amdgpu_reg_state_sysfs_fini(adev); 4434 + amdgpu_xcp_sysfs_fini(adev); 4435 + } 4436 + 4388 4437 /** 4389 4438 * amdgpu_device_init - initialize the driver 4390 4439 * ··· 4862 4813 * operations performed in `late_init` might affect the sysfs 4863 4814 * interfaces creating. 4864 4815 */ 4865 - r = amdgpu_atombios_sysfs_init(adev); 4866 - if (r) 4867 - drm_err(&adev->ddev, 4868 - "registering atombios sysfs failed (%d).\n", r); 4869 - 4870 - r = amdgpu_pm_sysfs_init(adev); 4871 - if (r) 4872 - dev_err(adev->dev, "registering pm sysfs failed (%d).\n", r); 4873 - 4874 - r = amdgpu_ucode_sysfs_init(adev); 4875 - if (r) { 4876 - adev->ucode_sysfs_en = false; 4877 - dev_err(adev->dev, "Creating firmware sysfs failed (%d).\n", r); 4878 - } else 4879 - adev->ucode_sysfs_en = true; 4880 - 4881 - r = amdgpu_device_attr_sysfs_init(adev); 4882 - if (r) 4883 - dev_err(adev->dev, "Could not create amdgpu device attr\n"); 4884 - 4885 - r = devm_device_add_group(adev->dev, &amdgpu_board_attrs_group); 4886 - if (r) 4887 - dev_err(adev->dev, 4888 - "Could not create amdgpu board attributes\n"); 4889 - 4890 - amdgpu_fru_sysfs_init(adev); 4891 - amdgpu_reg_state_sysfs_init(adev); 4892 - amdgpu_xcp_sysfs_init(adev); 4816 + r = amdgpu_device_sys_interface_init(adev); 4893 4817 4894 4818 if (IS_ENABLED(CONFIG_PERF_EVENTS)) 4895 4819 r = amdgpu_pmu_init(adev); ··· 4984 4962 } 4985 4963 amdgpu_fence_driver_hw_fini(adev); 4986 4964 4987 - if (adev->pm.sysfs_initialized) 4988 - amdgpu_pm_sysfs_fini(adev); 4989 - if (adev->ucode_sysfs_en) 4990 - amdgpu_ucode_sysfs_fini(adev); 4991 - amdgpu_device_attr_sysfs_fini(adev); 4992 - amdgpu_fru_sysfs_fini(adev); 4993 - 4994 - amdgpu_reg_state_sysfs_fini(adev); 4995 - amdgpu_xcp_sysfs_fini(adev); 4965 + amdgpu_device_sys_interface_fini(adev); 4996 4966 4997 4967 /* disable ras feature must before hw fini */ 4998 4968 amdgpu_ras_pre_fini(adev);