Skip to content

Commit 305a81b

Browse files
committed
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 <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Evan Quan <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: [email protected] Acked-by: Randy Dunlap <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent dd7a595 commit 305a81b

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,8 +2336,6 @@ static void navi10_fill_i2c_req(SwI2cRequest_t *req, bool write,
23362336
{
23372337
int i;
23382338

2339-
BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
2340-
23412339
req->I2CcontrollerPort = 0;
23422340
req->I2CSpeed = 2;
23432341
req->SlaveAddress = address;
@@ -2375,6 +2373,12 @@ static int navi10_i2c_read_data(struct i2c_adapter *control,
23752373
struct smu_table_context *smu_table = &adev->smu.smu_table;
23762374
struct smu_table *table = &smu_table->driver_table;
23772375

2376+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2377+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2378+
numbytes, MAX_SW_I2C_COMMANDS);
2379+
return -EINVAL;
2380+
}
2381+
23782382
memset(&req, 0, sizeof(req));
23792383
navi10_fill_i2c_req(&req, false, address, numbytes, data);
23802384

@@ -2411,6 +2415,12 @@ static int navi10_i2c_write_data(struct i2c_adapter *control,
24112415
SwI2cRequest_t req;
24122416
struct amdgpu_device *adev = to_amdgpu_device(control);
24132417

2418+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2419+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2420+
numbytes, MAX_SW_I2C_COMMANDS);
2421+
return -EINVAL;
2422+
}
2423+
24142424
memset(&req, 0, sizeof(req));
24152425
navi10_fill_i2c_req(&req, true, address, numbytes, data);
24162426

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,8 +2422,6 @@ static void sienna_cichlid_fill_i2c_req(SwI2cRequest_t *req, bool write,
24222422
{
24232423
int i;
24242424

2425-
BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
2426-
24272425
req->I2CcontrollerPort = 0;
24282426
req->I2CSpeed = 2;
24292427
req->SlaveAddress = address;
@@ -2461,6 +2459,12 @@ static int sienna_cichlid_i2c_read_data(struct i2c_adapter *control,
24612459
struct smu_table_context *smu_table = &adev->smu.smu_table;
24622460
struct smu_table *table = &smu_table->driver_table;
24632461

2462+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2463+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2464+
numbytes, MAX_SW_I2C_COMMANDS);
2465+
return -EINVAL;
2466+
}
2467+
24642468
memset(&req, 0, sizeof(req));
24652469
sienna_cichlid_fill_i2c_req(&req, false, address, numbytes, data);
24662470

@@ -2497,6 +2501,12 @@ static int sienna_cichlid_i2c_write_data(struct i2c_adapter *control,
24972501
SwI2cRequest_t req;
24982502
struct amdgpu_device *adev = to_amdgpu_device(control);
24992503

2504+
if (numbytes > MAX_SW_I2C_COMMANDS) {
2505+
dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
2506+
numbytes, MAX_SW_I2C_COMMANDS);
2507+
return -EINVAL;
2508+
}
2509+
25002510
memset(&req, 0, sizeof(req));
25012511
sienna_cichlid_fill_i2c_req(&req, true, address, numbytes, data);
25022512

0 commit comments

Comments
 (0)