tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-4.21-wip head: 364c6471cc8cca8dbaa558077597c525b3d7f9e6 commit: 2c5acb77e1ad3dfa5658f6c8b769e264b53728b4 [79/110] drm/amdgpu: Add sysfs file for PCIe usage v5 New smatch warnings: drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:2138 amdgpu_pm_sysfs_init() warn: maybe use && instead of & drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:2138 amdgpu_pm_sysfs_init() warn: bitwise AND condition is false here drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:2184 amdgpu_pm_sysfs_fini() warn: maybe use && instead of & drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:2184 amdgpu_pm_sysfs_fini() warn: bitwise AND condition is false here Old smatch warnings: drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:593 amdgpu_set_pp_od_clk_voltage() error: uninitialized symbol 'ret'. git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git git remote update radeon-alex git checkout 2c5acb77e1ad3dfa5658f6c8b769e264b53728b4 vim +2138 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c d38ceaf99 Alex Deucher 2015-04-20 2034 d38ceaf99 Alex Deucher 2015-04-20 2035 int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) d38ceaf99 Alex Deucher 2015-04-20 2036 { 0624e145f Evan Quan 2019-01-07 2037 struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; d38ceaf99 Alex Deucher 2015-04-20 2038 int ret; d38ceaf99 Alex Deucher 2015-04-20 2039 c86f5ebfb Alex Deucher 2015-10-23 2040 if (adev->pm.sysfs_initialized) c86f5ebfb Alex Deucher 2015-10-23 2041 return 0; c86f5ebfb Alex Deucher 2015-10-23 2042 d2f52ac80 Rex Zhu 2017-09-22 2043 if (adev->pm.dpm_enabled == 0) d2f52ac80 Rex Zhu 2017-09-22 2044 return 0; d2f52ac80 Rex Zhu 2017-09-22 2045 d38ceaf99 Alex Deucher 2015-04-20 2046 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev, d38ceaf99 Alex Deucher 2015-04-20 2047 DRIVER_NAME, adev, d38ceaf99 Alex Deucher 2015-04-20 2048 hwmon_groups); d38ceaf99 Alex Deucher 2015-04-20 2049 if (IS_ERR(adev->pm.int_hwmon_dev)) { d38ceaf99 Alex Deucher 2015-04-20 2050 ret = PTR_ERR(adev->pm.int_hwmon_dev); d38ceaf99 Alex Deucher 2015-04-20 2051 dev_err(adev->dev, d38ceaf99 Alex Deucher 2015-04-20 2052 "Unable to register hwmon device: %d\n", ret); d38ceaf99 Alex Deucher 2015-04-20 2053 return ret; d38ceaf99 Alex Deucher 2015-04-20 2054 } d38ceaf99 Alex Deucher 2015-04-20 2055 d38ceaf99 Alex Deucher 2015-04-20 2056 ret = device_create_file(adev->dev, &dev_attr_power_dpm_state); d38ceaf99 Alex Deucher 2015-04-20 2057 if (ret) { d38ceaf99 Alex Deucher 2015-04-20 2058 DRM_ERROR("failed to create device file for dpm state\n"); d38ceaf99 Alex Deucher 2015-04-20 2059 return ret; d38ceaf99 Alex Deucher 2015-04-20 2060 } d38ceaf99 Alex Deucher 2015-04-20 2061 ret = device_create_file(adev->dev, &dev_attr_power_dpm_force_performance_level); d38ceaf99 Alex Deucher 2015-04-20 2062 if (ret) { d38ceaf99 Alex Deucher 2015-04-20 2063 DRM_ERROR("failed to create device file for dpm state\n"); d38ceaf99 Alex Deucher 2015-04-20 2064 return ret; d38ceaf99 Alex Deucher 2015-04-20 2065 } f3898ea12 Eric Huang 2015-12-11 2066 6d07fe7bc Rex Zhu 2017-09-25 2067 f3898ea12 Eric Huang 2015-12-11 2068 ret = device_create_file(adev->dev, &dev_attr_pp_num_states); f3898ea12 Eric Huang 2015-12-11 2069 if (ret) { f3898ea12 Eric Huang 2015-12-11 2070 DRM_ERROR("failed to create device file pp_num_states\n"); f3898ea12 Eric Huang 2015-12-11 2071 return ret; f3898ea12 Eric Huang 2015-12-11 2072 } f3898ea12 Eric Huang 2015-12-11 2073 ret = device_create_file(adev->dev, &dev_attr_pp_cur_state); f3898ea12 Eric Huang 2015-12-11 2074 if (ret) { f3898ea12 Eric Huang 2015-12-11 2075 DRM_ERROR("failed to create device file pp_cur_state\n"); f3898ea12 Eric Huang 2015-12-11 2076 return ret; f3898ea12 Eric Huang 2015-12-11 2077 } f3898ea12 Eric Huang 2015-12-11 2078 ret = device_create_file(adev->dev, &dev_attr_pp_force_state); f3898ea12 Eric Huang 2015-12-11 2079 if (ret) { f3898ea12 Eric Huang 2015-12-11 2080 DRM_ERROR("failed to create device file pp_force_state\n"); f3898ea12 Eric Huang 2015-12-11 2081 return ret; f3898ea12 Eric Huang 2015-12-11 2082 } f3898ea12 Eric Huang 2015-12-11 2083 ret = device_create_file(adev->dev, &dev_attr_pp_table); f3898ea12 Eric Huang 2015-12-11 2084 if (ret) { f3898ea12 Eric Huang 2015-12-11 2085 DRM_ERROR("failed to create device file pp_table\n"); f3898ea12 Eric Huang 2015-12-11 2086 return ret; f3898ea12 Eric Huang 2015-12-11 2087 } c85e299ff Eric Huang 2016-05-19 2088 f3898ea12 Eric Huang 2015-12-11 2089 ret = device_create_file(adev->dev, &dev_attr_pp_dpm_sclk); f3898ea12 Eric Huang 2015-12-11 2090 if (ret) { f3898ea12 Eric Huang 2015-12-11 2091 DRM_ERROR("failed to create device file pp_dpm_sclk\n"); f3898ea12 Eric Huang 2015-12-11 2092 return ret; f3898ea12 Eric Huang 2015-12-11 2093 } f3898ea12 Eric Huang 2015-12-11 2094 ret = device_create_file(adev->dev, &dev_attr_pp_dpm_mclk); f3898ea12 Eric Huang 2015-12-11 2095 if (ret) { f3898ea12 Eric Huang 2015-12-11 2096 DRM_ERROR("failed to create device file pp_dpm_mclk\n"); f3898ea12 Eric Huang 2015-12-11 2097 return ret; f3898ea12 Eric Huang 2015-12-11 2098 } f3898ea12 Eric Huang 2015-12-11 2099 ret = device_create_file(adev->dev, &dev_attr_pp_dpm_pcie); f3898ea12 Eric Huang 2015-12-11 2100 if (ret) { f3898ea12 Eric Huang 2015-12-11 2101 DRM_ERROR("failed to create device file pp_dpm_pcie\n"); f3898ea12 Eric Huang 2015-12-11 2102 return ret; f3898ea12 Eric Huang 2015-12-11 2103 } 8b2e574dc Eric Huang 2016-05-19 2104 ret = device_create_file(adev->dev, &dev_attr_pp_sclk_od); 8b2e574dc Eric Huang 2016-05-19 2105 if (ret) { 8b2e574dc Eric Huang 2016-05-19 2106 DRM_ERROR("failed to create device file pp_sclk_od\n"); 8b2e574dc Eric Huang 2016-05-19 2107 return ret; 8b2e574dc Eric Huang 2016-05-19 2108 } f2bdc05f7 Eric Huang 2016-05-24 2109 ret = device_create_file(adev->dev, &dev_attr_pp_mclk_od); f2bdc05f7 Eric Huang 2016-05-24 2110 if (ret) { f2bdc05f7 Eric Huang 2016-05-24 2111 DRM_ERROR("failed to create device file pp_mclk_od\n"); f2bdc05f7 Eric Huang 2016-05-24 2112 return ret; f2bdc05f7 Eric Huang 2016-05-24 2113 } 34bb2734d Eric Huang 2016-09-12 2114 ret = device_create_file(adev->dev, 37c5c4dbf Rex Zhu 2018-01-10 2115 &dev_attr_pp_power_profile_mode); 37c5c4dbf Rex Zhu 2018-01-10 2116 if (ret) { 37c5c4dbf Rex Zhu 2018-01-10 2117 DRM_ERROR("failed to create device file " 37c5c4dbf Rex Zhu 2018-01-10 2118 "pp_power_profile_mode\n"); 37c5c4dbf Rex Zhu 2018-01-10 2119 return ret; 37c5c4dbf Rex Zhu 2018-01-10 2120 } 0624e145f Evan Quan 2019-01-07 2121 if (hwmgr->od_enabled) { e3933f26b Rex Zhu 2018-01-16 2122 ret = device_create_file(adev->dev, e3933f26b Rex Zhu 2018-01-16 2123 &dev_attr_pp_od_clk_voltage); e3933f26b Rex Zhu 2018-01-16 2124 if (ret) { e3933f26b Rex Zhu 2018-01-16 2125 DRM_ERROR("failed to create device file " e3933f26b Rex Zhu 2018-01-16 2126 "pp_od_clk_voltage\n"); e3933f26b Rex Zhu 2018-01-16 2127 return ret; e3933f26b Rex Zhu 2018-01-16 2128 } 0624e145f Evan Quan 2019-01-07 2129 } b374d82dc Tom St Denis 2018-06-20 2130 ret = device_create_file(adev->dev, b374d82dc Tom St Denis 2018-06-20 2131 &dev_attr_gpu_busy_percent); b374d82dc Tom St Denis 2018-06-20 2132 if (ret) { b374d82dc Tom St Denis 2018-06-20 2133 DRM_ERROR("failed to create device file " b374d82dc Tom St Denis 2018-06-20 2134 "gpu_busy_level\n"); b374d82dc Tom St Denis 2018-06-20 2135 return ret; b374d82dc Tom St Denis 2018-06-20 2136 } 2c5acb77e Kent Russell 2019-01-03 2137 /* PCIe Perf counters won't work on APU nodes */ 2c5acb77e Kent Russell 2019-01-03 @2138 if (adev->flags & !AMD_IS_APU) { 2c5acb77e Kent Russell 2019-01-03 2139 ret = device_create_file(adev->dev, &dev_attr_pcie_bw); 2c5acb77e Kent Russell 2019-01-03 2140 if (ret) { 2c5acb77e Kent Russell 2019-01-03 2141 DRM_ERROR("failed to create device file pcie_bw\n"); 2c5acb77e Kent Russell 2019-01-03 2142 return ret; 2c5acb77e Kent Russell 2019-01-03 2143 } 2c5acb77e Kent Russell 2019-01-03 2144 } d38ceaf99 Alex Deucher 2015-04-20 2145 ret = amdgpu_debugfs_pm_init(adev); d38ceaf99 Alex Deucher 2015-04-20 2146 if (ret) { d38ceaf99 Alex Deucher 2015-04-20 2147 DRM_ERROR("Failed to register debugfs file for dpm!\n"); d38ceaf99 Alex Deucher 2015-04-20 2148 return ret; d38ceaf99 Alex Deucher 2015-04-20 2149 } d38ceaf99 Alex Deucher 2015-04-20 2150 c86f5ebfb Alex Deucher 2015-10-23 2151 adev->pm.sysfs_initialized = true; c86f5ebfb Alex Deucher 2015-10-23 2152 d38ceaf99 Alex Deucher 2015-04-20 2153 return 0; d38ceaf99 Alex Deucher 2015-04-20 2154 } d38ceaf99 Alex Deucher 2015-04-20 2155 d38ceaf99 Alex Deucher 2015-04-20 2156 void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) d38ceaf99 Alex Deucher 2015-04-20 2157 { 0624e145f Evan Quan 2019-01-07 2158 struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; 0624e145f Evan Quan 2019-01-07 2159 d2f52ac80 Rex Zhu 2017-09-22 2160 if (adev->pm.dpm_enabled == 0) d2f52ac80 Rex Zhu 2017-09-22 2161 return; d2f52ac80 Rex Zhu 2017-09-22 2162 d38ceaf99 Alex Deucher 2015-04-20 2163 if (adev->pm.int_hwmon_dev) d38ceaf99 Alex Deucher 2015-04-20 2164 hwmon_device_unregister(adev->pm.int_hwmon_dev); d38ceaf99 Alex Deucher 2015-04-20 2165 device_remove_file(adev->dev, &dev_attr_power_dpm_state); d38ceaf99 Alex Deucher 2015-04-20 2166 device_remove_file(adev->dev, &dev_attr_power_dpm_force_performance_level); 6d07fe7bc Rex Zhu 2017-09-25 2167 f3898ea12 Eric Huang 2015-12-11 2168 device_remove_file(adev->dev, &dev_attr_pp_num_states); f3898ea12 Eric Huang 2015-12-11 2169 device_remove_file(adev->dev, &dev_attr_pp_cur_state); f3898ea12 Eric Huang 2015-12-11 2170 device_remove_file(adev->dev, &dev_attr_pp_force_state); f3898ea12 Eric Huang 2015-12-11 2171 device_remove_file(adev->dev, &dev_attr_pp_table); 6d07fe7bc Rex Zhu 2017-09-25 2172 f3898ea12 Eric Huang 2015-12-11 2173 device_remove_file(adev->dev, &dev_attr_pp_dpm_sclk); f3898ea12 Eric Huang 2015-12-11 2174 device_remove_file(adev->dev, &dev_attr_pp_dpm_mclk); f3898ea12 Eric Huang 2015-12-11 2175 device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie); 8b2e574dc Eric Huang 2016-05-19 2176 device_remove_file(adev->dev, &dev_attr_pp_sclk_od); f2bdc05f7 Eric Huang 2016-05-24 2177 device_remove_file(adev->dev, &dev_attr_pp_mclk_od); 34bb2734d Eric Huang 2016-09-12 2178 device_remove_file(adev->dev, 37c5c4dbf Rex Zhu 2018-01-10 2179 &dev_attr_pp_power_profile_mode); 0624e145f Evan Quan 2019-01-07 2180 if (hwmgr->od_enabled) e3933f26b Rex Zhu 2018-01-16 2181 device_remove_file(adev->dev, e3933f26b Rex Zhu 2018-01-16 2182 &dev_attr_pp_od_clk_voltage); b374d82dc Tom St Denis 2018-06-20 2183 device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); 2c5acb77e Kent Russell 2019-01-03 @2184 if (adev->flags & !AMD_IS_APU) 2c5acb77e Kent Russell 2019-01-03 2185 device_remove_file(adev->dev, &dev_attr_pcie_bw); d38ceaf99 Alex Deucher 2015-04-20 2186 } d38ceaf99 Alex Deucher 2015-04-20 2187 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel