@@ -1602,7 +1602,7 @@ static DEVICE_ATTR(current_compute_partition, 0644,
16021602static DEVICE_ATTR (available_compute_partition , 0444 ,
16031603 amdgpu_gfx_get_available_compute_partition , NULL) ;
16041604
1605- int amdgpu_gfx_sysfs_init (struct amdgpu_device * adev )
1605+ static int amdgpu_gfx_sysfs_xcp_init (struct amdgpu_device * adev )
16061606{
16071607 struct amdgpu_xcp_mgr * xcp_mgr = adev -> xcp_mgr ;
16081608 bool xcp_switch_supported ;
@@ -1629,7 +1629,7 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)
16291629 return r ;
16301630}
16311631
1632- void amdgpu_gfx_sysfs_fini (struct amdgpu_device * adev )
1632+ static void amdgpu_gfx_sysfs_xcp_fini (struct amdgpu_device * adev )
16331633{
16341634 struct amdgpu_xcp_mgr * xcp_mgr = adev -> xcp_mgr ;
16351635 bool xcp_switch_supported ;
@@ -1646,25 +1646,47 @@ void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev)
16461646 & dev_attr_available_compute_partition );
16471647}
16481648
1649- int amdgpu_gfx_sysfs_isolation_shader_init (struct amdgpu_device * adev )
1649+ static int amdgpu_gfx_sysfs_isolation_shader_init (struct amdgpu_device * adev )
16501650{
16511651 int r ;
16521652
16531653 r = device_create_file (adev -> dev , & dev_attr_enforce_isolation );
16541654 if (r )
16551655 return r ;
1656+ if (adev -> gfx .enable_cleaner_shader )
1657+ r = device_create_file (adev -> dev , & dev_attr_run_cleaner_shader );
16561658
1657- r = device_create_file (adev -> dev , & dev_attr_run_cleaner_shader );
1658- if (r )
1659+ return r ;
1660+ }
1661+
1662+ static void amdgpu_gfx_sysfs_isolation_shader_fini (struct amdgpu_device * adev )
1663+ {
1664+ device_remove_file (adev -> dev , & dev_attr_enforce_isolation );
1665+ if (adev -> gfx .enable_cleaner_shader )
1666+ device_remove_file (adev -> dev , & dev_attr_run_cleaner_shader );
1667+ }
1668+
1669+ int amdgpu_gfx_sysfs_init (struct amdgpu_device * adev )
1670+ {
1671+ int r ;
1672+
1673+ r = amdgpu_gfx_sysfs_xcp_init (adev );
1674+ if (r ) {
1675+ dev_err (adev -> dev , "failed to create xcp sysfs files" );
16591676 return r ;
1677+ }
16601678
1661- return 0 ;
1679+ r = amdgpu_gfx_sysfs_isolation_shader_init (adev );
1680+ if (r )
1681+ dev_err (adev -> dev , "failed to create isolation sysfs files" );
1682+
1683+ return r ;
16621684}
16631685
1664- void amdgpu_gfx_sysfs_isolation_shader_fini (struct amdgpu_device * adev )
1686+ void amdgpu_gfx_sysfs_fini (struct amdgpu_device * adev )
16651687{
1666- device_remove_file (adev -> dev , & dev_attr_enforce_isolation );
1667- device_remove_file (adev -> dev , & dev_attr_run_cleaner_shader );
1688+ amdgpu_gfx_sysfs_xcp_fini (adev );
1689+ amdgpu_gfx_sysfs_isolation_shader_fini (adev );
16681690}
16691691
16701692int amdgpu_gfx_cleaner_shader_sw_init (struct amdgpu_device * adev ,
0 commit comments