[PATCH 8/9] drm/amd/powerplay: drop unnecessary dynamic buffer allocation

Alex Deucher alexdeucher at gmail.com
Tue Jun 2 15:12:24 UTC 2020


On Mon, Jun 1, 2020 at 3:31 AM Evan Quan <evan.quan at amd.com> wrote:
>
> Since the structure comes with only several bytes.
>
> Change-Id: Ie9df0db543fdd4cf5b963a286ef40dee03c436bf
> Signed-off-by: Evan Quan <evan.quan at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     |  3 ---
>  drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |  2 +-
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c      | 15 +++------------
>  3 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index e55c6458b212..b353ac1b0f07 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1121,9 +1121,6 @@ static int smu_sw_fini(void *handle)
>         struct smu_context *smu = &adev->smu;
>         int ret;
>
> -       kfree(smu->irq_source);
> -       smu->irq_source = NULL;
> -
>         ret = smu_smc_table_sw_fini(smu);
>         if (ret) {
>                 pr_err("Failed to sw fini smc table!\n");
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index 4aa63dc79124..7fed2556213f 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -356,7 +356,7 @@ struct smu_baco_context
>  struct smu_context
>  {
>         struct amdgpu_device            *adev;
> -       struct amdgpu_irq_src           *irq_source;
> +       struct amdgpu_irq_src           irq_source;
>
>         const struct pptable_funcs      *ppt_funcs;
>         struct mutex                    mutex;
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index 891781a5c0d4..e2b1c619151f 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -1167,7 +1167,7 @@ int smu_v11_0_enable_thermal_alert(struct smu_context *smu)
>                 if (ret)
>                         return ret;
>
> -               ret = amdgpu_irq_get(adev, smu->irq_source, 0);
> +               ret = amdgpu_irq_get(adev, &smu->irq_source, 0);
>                 if (ret)
>                         return ret;
>
> @@ -1191,7 +1191,7 @@ int smu_v11_0_enable_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)
> @@ -1607,18 +1607,9 @@ static const struct amdgpu_irq_src_funcs smu_v11_0_irq_funcs =
>  int smu_v11_0_register_irq_handler(struct smu_context *smu)
>  {
>         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;
>
> -       /* 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->funcs = &smu_v11_0_irq_funcs;
>
> --
> 2.26.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list