[PATCH] Revert "drm/radeon: Prefer dev_* variant over printk"

Chen, Guchun Guchun.Chen at amd.com
Tue Aug 1 01:41:30 UTC 2023


[Public]

> -----Original Message-----
> From: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM at amd.com>
> Sent: Monday, July 31, 2023 8:04 PM
> To: Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>; Chen, Guchun <Guchun.Chen at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; SHANMUGAM, SRINIVASAN
> <SRINIVASAN.SHANMUGAM at amd.com>; Bert Karwatzki
> <spasswolf at web.de>
> Subject: [PATCH] Revert "drm/radeon: Prefer dev_* variant over printk"

Missed commit ID here.

With it fixed, this patch is:
Reviewed-by: Guchun Chen <guchun.chen at amd.com>

Regards,
Guchun

> Usage of container_of is wrong here.
> struct acpi_device *adev = container_of(handle, struct acpi_device, handle)
>
> References: https://gitlab.freedesktop.org/drm/amd/-/issues/2744
> Cc: Guchun Chen <guchun.chen at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Bert Karwatzki <spasswolf at web.de>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
>  drivers/gpu/drm/radeon/radeon_atpx_handler.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> index fb4d931fdf18..595354e3ce0b 100644
> --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> @@ -94,8 +94,6 @@ static union acpi_object *radeon_atpx_call(acpi_handle
> handle, int function,
>       union acpi_object atpx_arg_elements[2];
>       struct acpi_object_list atpx_arg;
>       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
> -     struct acpi_device *adev = container_of(handle, struct acpi_device,
> handle);
> -     struct device *dev = &adev->dev;
>
>       atpx_arg.count = 2;
>       atpx_arg.pointer = &atpx_arg_elements[0]; @@ -117,8 +115,8 @@
> static union acpi_object *radeon_atpx_call(acpi_handle handle, int function,
>
>       /* Fail only if calling the method fails and ATPX is supported */
>       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
> -             dev_err(dev, "failed to evaluate ATPX got %s\n",
> -                     acpi_format_exception(status));
> +             pr_err("failed to evaluate ATPX got %s\n",
> +                    acpi_format_exception(status));
>               kfree(buffer.pointer);
>               return NULL;
>       }
> @@ -159,8 +157,6 @@ static void radeon_atpx_parse_functions(struct
> radeon_atpx_functions *f, u32 mas  static int radeon_atpx_validate(struct
> radeon_atpx *atpx)  {
>       u32 valid_bits = 0;
> -     struct acpi_device *adev = container_of(atpx->handle, struct
> acpi_device, handle);
> -     struct device *dev = &adev->dev;
>
>       if (atpx->functions.px_params) {
>               union acpi_object *info;
> @@ -175,7 +171,7 @@ static int radeon_atpx_validate(struct radeon_atpx
> *atpx)
>
>               size = *(u16 *) info->buffer.pointer;
>               if (size < 10) {
> -                     dev_err(dev, "ATPX buffer is too small: %zu\n", size);
> +                     pr_err("ATPX buffer is too small: %zu\n", size);
>                       kfree(info);
>                       return -EINVAL;
>               }
> @@ -206,7 +202,7 @@ static int radeon_atpx_validate(struct radeon_atpx
> *atpx)
>
>       atpx->is_hybrid = false;
>       if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
> -             dev_info(dev, "ATPX Hybrid Graphics\n");
> +             pr_info("ATPX Hybrid Graphics\n");
>               /*
>                * Disable legacy PM methods only when pcie port PM is
> usable,
>                * otherwise the device might fail to power off or power on.
> --
> 2.25.1



More information about the amd-gfx mailing list