Commit a494a7ce authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Alex Deucher

Revert "drm/amdgpu: Prefer dev_* variant over printk in amdgpu_atpx_handler.c"

Usage of container_of is wrong here.
struct acpi_device *adev = container_of(handle, struct acpi_device, handle)

This reverts commit b0bd0a92.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/2744
Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Bert Karwatzki <spasswolf@web.de>
Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 30a56f32
...@@ -74,29 +74,24 @@ struct atpx_mux { ...@@ -74,29 +74,24 @@ struct atpx_mux {
u16 mux; u16 mux;
} __packed; } __packed;
bool amdgpu_has_atpx(void) bool amdgpu_has_atpx(void) {
{
return amdgpu_atpx_priv.atpx_detected; return amdgpu_atpx_priv.atpx_detected;
} }
bool amdgpu_has_atpx_dgpu_power_cntl(void) bool amdgpu_has_atpx_dgpu_power_cntl(void) {
{
return amdgpu_atpx_priv.atpx.functions.power_cntl; return amdgpu_atpx_priv.atpx.functions.power_cntl;
} }
bool amdgpu_is_atpx_hybrid(void) bool amdgpu_is_atpx_hybrid(void) {
{
return amdgpu_atpx_priv.atpx.is_hybrid; return amdgpu_atpx_priv.atpx.is_hybrid;
} }
bool amdgpu_atpx_dgpu_req_power_for_displays(void) bool amdgpu_atpx_dgpu_req_power_for_displays(void) {
{
return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays; return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays;
} }
#if defined(CONFIG_ACPI) #if defined(CONFIG_ACPI)
void *amdgpu_atpx_get_dhandle(void) void *amdgpu_atpx_get_dhandle(void) {
{
return amdgpu_atpx_priv.dhandle; return amdgpu_atpx_priv.dhandle;
} }
#endif #endif
...@@ -118,8 +113,6 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function, ...@@ -118,8 +113,6 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
union acpi_object atpx_arg_elements[2]; union acpi_object atpx_arg_elements[2];
struct acpi_object_list atpx_arg; struct acpi_object_list atpx_arg;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 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.count = 2;
atpx_arg.pointer = &atpx_arg_elements[0]; atpx_arg.pointer = &atpx_arg_elements[0];
...@@ -141,8 +134,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function, ...@@ -141,8 +134,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
/* Fail only if calling the method fails and ATPX is supported */ /* Fail only if calling the method fails and ATPX is supported */
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
dev_err(dev, "failed to evaluate ATPX got %s\n", printk("failed to evaluate ATPX got %s\n",
acpi_format_exception(status)); acpi_format_exception(status));
kfree(buffer.pointer); kfree(buffer.pointer);
return NULL; return NULL;
} }
...@@ -183,8 +176,6 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas ...@@ -183,8 +176,6 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas
static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
{ {
u32 valid_bits = 0; 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) { if (atpx->functions.px_params) {
union acpi_object *info; union acpi_object *info;
...@@ -199,7 +190,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) ...@@ -199,7 +190,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
size = *(u16 *) info->buffer.pointer; size = *(u16 *) info->buffer.pointer;
if (size < 10) { if (size < 10) {
dev_err(dev, "ATPX buffer is too small: %zu\n", size); printk("ATPX buffer is too small: %zu\n", size);
kfree(info); kfree(info);
return -EINVAL; return -EINVAL;
} }
...@@ -232,11 +223,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) ...@@ -232,11 +223,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
atpx->is_hybrid = false; atpx->is_hybrid = false;
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) { if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) {
dev_info(dev, "ATPX Hybrid Graphics, forcing to ATPX\n"); printk("ATPX Hybrid Graphics, forcing to ATPX\n");
atpx->functions.power_cntl = true; atpx->functions.power_cntl = true;
atpx->is_hybrid = false; atpx->is_hybrid = false;
} else { } else {
dev_info(dev, "ATPX Hybrid Graphics\n"); printk("ATPX Hybrid Graphics\n");
/* /*
* Disable legacy PM methods only when pcie port PM is usable, * Disable legacy PM methods only when pcie port PM is usable,
* otherwise the device might fail to power off or power on. * otherwise the device might fail to power off or power on.
...@@ -269,8 +260,6 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx) ...@@ -269,8 +260,6 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
struct atpx_verify_interface output; struct atpx_verify_interface output;
size_t size; size_t size;
int err = 0; int err = 0;
struct acpi_device *adev = container_of(atpx->handle, struct acpi_device, handle);
struct device *dev = &adev->dev;
info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL); info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL);
if (!info) if (!info)
...@@ -289,8 +278,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx) ...@@ -289,8 +278,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
memcpy(&output, info->buffer.pointer, size); memcpy(&output, info->buffer.pointer, size);
/* TODO: check version? */ /* TODO: check version? */
dev_info(dev, "ATPX version %u, functions 0x%08x\n", printk("ATPX version %u, functions 0x%08x\n",
output.version, output.function_bits); output.version, output.function_bits);
amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits); amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits);
......
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