mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 20:58:14 -04:00
drm/amd/pm: Use devm_i2c_add_adapter() in the i2c init
Instead of using i2c_add_adapter() and i2c_del_adapter(), replace them with devm_i2c_add_adapter() to simplify the i2c logic. Signed-off-by: Rodrigo Siqueira <siqueira@igalia.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
63137c7c8c
commit
f4dfc4447d
@@ -1641,33 +1641,22 @@ static int aldebaran_i2c_control_init(struct smu_context *smu)
|
||||
control->quirks = &aldebaran_i2c_control_quirks;
|
||||
i2c_set_adapdata(control, smu_i2c);
|
||||
|
||||
res = i2c_add_adapter(control);
|
||||
res = devm_i2c_add_adapter(adev->dev, control);
|
||||
if (res) {
|
||||
DRM_ERROR("Failed to register hw i2c, err: %d\n", res);
|
||||
goto Out_err;
|
||||
return res;
|
||||
}
|
||||
|
||||
adev->pm.ras_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
|
||||
adev->pm.fru_eeprom_i2c_bus = &adev->pm.smu_i2c[0].adapter;
|
||||
|
||||
return 0;
|
||||
Out_err:
|
||||
i2c_del_adapter(control);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void aldebaran_i2c_control_fini(struct smu_context *smu)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_SMU_I2C_BUSES; i++) {
|
||||
struct amdgpu_smu_i2c_bus *smu_i2c = &adev->pm.smu_i2c[i];
|
||||
struct i2c_adapter *control = &smu_i2c->adapter;
|
||||
|
||||
i2c_del_adapter(control);
|
||||
}
|
||||
adev->pm.ras_eeprom_i2c_bus = NULL;
|
||||
adev->pm.fru_eeprom_i2c_bus = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user