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

drm/amdgpu/swsmu: fix ARC build errors

We want to use the dev_* functions here rather than the pr_* variants.
Switch to using dev_warn() which mirrors what we do on other asics.

Fixes the following build errors on ARC:

../drivers/gpu/drm/amd/amdgpu/../powerplay/navi10_ppt.c: In function 'navi10_fill_i2c_req':
../arch/arc/include/asm/bug.h:24:2: error: implicit declaration of function 'pr_warn'; did you mean 'drm_warn'? [-Werror=implicit-function-declaration]

../drivers/gpu/drm/amd/amdgpu/../powerplay/sienna_cichlid_ppt.c: In function 'sienna_cichlid_fill_i2c_req':
../arch/arc/include/asm/bug.h:24:2: error: implicit declaration of function 'pr_warn'; did you mean 'drm_warn'? [-Werror=implicit-function-declaration]

Reported-by: kernel test robot <lkp@intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Evan Quan <evan.quan@amd.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: linux-snps-arc@lists.infradead.org
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+24 -4
+12 -2
drivers/gpu/drm/amd/powerplay/navi10_ppt.c
··· 2265 2265 { 2266 2266 int i; 2267 2267 2268 - BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); 2269 - 2270 2268 req->I2CcontrollerPort = 0; 2271 2269 req->I2CSpeed = 2; 2272 2270 req->SlaveAddress = address; ··· 2302 2304 struct smu_table_context *smu_table = &adev->smu.smu_table; 2303 2305 struct smu_table *table = &smu_table->driver_table; 2304 2306 2307 + if (numbytes > MAX_SW_I2C_COMMANDS) { 2308 + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", 2309 + numbytes, MAX_SW_I2C_COMMANDS); 2310 + return -EINVAL; 2311 + } 2312 + 2305 2313 memset(&req, 0, sizeof(req)); 2306 2314 navi10_fill_i2c_req(&req, false, address, numbytes, data); 2307 2315 ··· 2343 2339 uint32_t ret; 2344 2340 SwI2cRequest_t req; 2345 2341 struct amdgpu_device *adev = to_amdgpu_device(control); 2342 + 2343 + if (numbytes > MAX_SW_I2C_COMMANDS) { 2344 + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", 2345 + numbytes, MAX_SW_I2C_COMMANDS); 2346 + return -EINVAL; 2347 + } 2346 2348 2347 2349 memset(&req, 0, sizeof(req)); 2348 2350 navi10_fill_i2c_req(&req, true, address, numbytes, data);
+12 -2
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
··· 2445 2445 { 2446 2446 int i; 2447 2447 2448 - BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); 2449 - 2450 2448 req->I2CcontrollerPort = 0; 2451 2449 req->I2CSpeed = 2; 2452 2450 req->SlaveAddress = address; ··· 2482 2484 struct smu_table_context *smu_table = &adev->smu.smu_table; 2483 2485 struct smu_table *table = &smu_table->driver_table; 2484 2486 2487 + if (numbytes > MAX_SW_I2C_COMMANDS) { 2488 + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", 2489 + numbytes, MAX_SW_I2C_COMMANDS); 2490 + return -EINVAL; 2491 + } 2492 + 2485 2493 memset(&req, 0, sizeof(req)); 2486 2494 sienna_cichlid_fill_i2c_req(&req, false, address, numbytes, data); 2487 2495 ··· 2523 2519 uint32_t ret; 2524 2520 SwI2cRequest_t req; 2525 2521 struct amdgpu_device *adev = to_amdgpu_device(control); 2522 + 2523 + if (numbytes > MAX_SW_I2C_COMMANDS) { 2524 + dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", 2525 + numbytes, MAX_SW_I2C_COMMANDS); 2526 + return -EINVAL; 2527 + } 2526 2528 2527 2529 memset(&req, 0, sizeof(req)); 2528 2530 sienna_cichlid_fill_i2c_req(&req, true, address, numbytes, data);