Commit aaddad1f authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: move amdgpu_irq_src to the smu structure allocation

Rather than allocating it dynamically at runtime considering it is only
several bytes in size.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e6f1eb4c
...@@ -1102,9 +1102,6 @@ static int smu_sw_fini(void *handle) ...@@ -1102,9 +1102,6 @@ static int smu_sw_fini(void *handle)
struct smu_context *smu = &adev->smu; struct smu_context *smu = &adev->smu;
int ret; int ret;
kfree(smu->irq_source);
smu->irq_source = NULL;
ret = smu_smc_table_sw_fini(smu); ret = smu_smc_table_sw_fini(smu);
if (ret) { if (ret) {
pr_err("Failed to sw fini smc table!\n"); pr_err("Failed to sw fini smc table!\n");
......
...@@ -356,7 +356,7 @@ struct smu_baco_context ...@@ -356,7 +356,7 @@ struct smu_baco_context
struct smu_context struct smu_context
{ {
struct amdgpu_device *adev; struct amdgpu_device *adev;
struct amdgpu_irq_src *irq_source; struct amdgpu_irq_src irq_source;
const struct pptable_funcs *ppt_funcs; const struct pptable_funcs *ppt_funcs;
struct mutex mutex; struct mutex mutex;
......
...@@ -1174,7 +1174,7 @@ int smu_v11_0_enable_thermal_alert(struct smu_context *smu) ...@@ -1174,7 +1174,7 @@ int smu_v11_0_enable_thermal_alert(struct smu_context *smu)
if (ret) if (ret)
return ret; return ret;
ret = amdgpu_irq_get(adev, smu->irq_source, 0); ret = amdgpu_irq_get(adev, &smu->irq_source, 0);
if (ret) if (ret)
return ret; return ret;
...@@ -1198,7 +1198,7 @@ int smu_v11_0_enable_thermal_alert(struct smu_context *smu) ...@@ -1198,7 +1198,7 @@ int smu_v11_0_enable_thermal_alert(struct smu_context *smu)
int smu_v11_0_disable_thermal_alert(struct smu_context *smu) int smu_v11_0_disable_thermal_alert(struct smu_context *smu)
{ {
return amdgpu_irq_put(smu->adev, smu->irq_source, 0); return amdgpu_irq_put(smu->adev, &smu->irq_source, 0);
} }
static uint16_t convert_to_vddc(uint8_t vid) static uint16_t convert_to_vddc(uint8_t vid)
...@@ -1615,18 +1615,9 @@ static const struct amdgpu_irq_src_funcs smu_v11_0_irq_funcs = ...@@ -1615,18 +1615,9 @@ static const struct amdgpu_irq_src_funcs smu_v11_0_irq_funcs =
int smu_v11_0_register_irq_handler(struct smu_context *smu) int smu_v11_0_register_irq_handler(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
struct amdgpu_irq_src *irq_src = smu->irq_source; struct amdgpu_irq_src *irq_src = &smu->irq_source;
int ret = 0; int ret = 0;
/* already register */
if (irq_src)
return 0;
irq_src = kzalloc(sizeof(struct amdgpu_irq_src), GFP_KERNEL);
if (!irq_src)
return -ENOMEM;
smu->irq_source = irq_src;
irq_src->num_types = 1; irq_src->num_types = 1;
irq_src->funcs = &smu_v11_0_irq_funcs; irq_src->funcs = &smu_v11_0_irq_funcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment