Skip to content

Commit b0bd0a9

Browse files
srishanmalexdeucher
authored andcommitted
drm/amdgpu: Prefer dev_* variant over printk in amdgpu_atpx_handler.c
Changed from printk to dev_* variants so that we get better debug info when there are multiple GPUs in the system. Fixes other style issue: ERROR: open brace '{' following function definitions go on the next line WARNING: printk() should include KERN_<LEVEL> facility level Cc: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 7593164 commit b0bd0a9

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,29 @@ struct atpx_mux {
7474
u16 mux;
7575
} __packed;
7676

77-
bool amdgpu_has_atpx(void) {
77+
bool amdgpu_has_atpx(void)
78+
{
7879
return amdgpu_atpx_priv.atpx_detected;
7980
}
8081

81-
bool amdgpu_has_atpx_dgpu_power_cntl(void) {
82+
bool amdgpu_has_atpx_dgpu_power_cntl(void)
83+
{
8284
return amdgpu_atpx_priv.atpx.functions.power_cntl;
8385
}
8486

85-
bool amdgpu_is_atpx_hybrid(void) {
87+
bool amdgpu_is_atpx_hybrid(void)
88+
{
8689
return amdgpu_atpx_priv.atpx.is_hybrid;
8790
}
8891

89-
bool amdgpu_atpx_dgpu_req_power_for_displays(void) {
92+
bool amdgpu_atpx_dgpu_req_power_for_displays(void)
93+
{
9094
return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays;
9195
}
9296

9397
#if defined(CONFIG_ACPI)
94-
void *amdgpu_atpx_get_dhandle(void) {
98+
void *amdgpu_atpx_get_dhandle(void)
99+
{
95100
return amdgpu_atpx_priv.dhandle;
96101
}
97102
#endif
@@ -113,6 +118,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
113118
union acpi_object atpx_arg_elements[2];
114119
struct acpi_object_list atpx_arg;
115120
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
121+
struct acpi_device *adev = container_of(handle, struct acpi_device, handle);
122+
struct device *dev = &adev->dev;
116123

117124
atpx_arg.count = 2;
118125
atpx_arg.pointer = &atpx_arg_elements[0];
@@ -134,8 +141,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
134141

135142
/* Fail only if calling the method fails and ATPX is supported */
136143
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
137-
printk("failed to evaluate ATPX got %s\n",
138-
acpi_format_exception(status));
144+
dev_err(dev, "failed to evaluate ATPX got %s\n",
145+
acpi_format_exception(status));
139146
kfree(buffer.pointer);
140147
return NULL;
141148
}
@@ -176,6 +183,8 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas
176183
static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
177184
{
178185
u32 valid_bits = 0;
186+
struct acpi_device *adev = container_of(atpx->handle, struct acpi_device, handle);
187+
struct device *dev = &adev->dev;
179188

180189
if (atpx->functions.px_params) {
181190
union acpi_object *info;
@@ -190,7 +199,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
190199

191200
size = *(u16 *) info->buffer.pointer;
192201
if (size < 10) {
193-
printk("ATPX buffer is too small: %zu\n", size);
202+
dev_err(dev, "ATPX buffer is too small: %zu\n", size);
194203
kfree(info);
195204
return -EINVAL;
196205
}
@@ -223,11 +232,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
223232
atpx->is_hybrid = false;
224233
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
225234
if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) {
226-
printk("ATPX Hybrid Graphics, forcing to ATPX\n");
235+
dev_info(dev, "ATPX Hybrid Graphics, forcing to ATPX\n");
227236
atpx->functions.power_cntl = true;
228237
atpx->is_hybrid = false;
229238
} else {
230-
printk("ATPX Hybrid Graphics\n");
239+
dev_info(dev, "ATPX Hybrid Graphics\n");
231240
/*
232241
* Disable legacy PM methods only when pcie port PM is usable,
233242
* otherwise the device might fail to power off or power on.
@@ -260,6 +269,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
260269
struct atpx_verify_interface output;
261270
size_t size;
262271
int err = 0;
272+
struct acpi_device *adev = container_of(atpx->handle, struct acpi_device, handle);
273+
struct device *dev = &adev->dev;
263274

264275
info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL);
265276
if (!info)
@@ -278,8 +289,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
278289
memcpy(&output, info->buffer.pointer, size);
279290

280291
/* TODO: check version? */
281-
printk("ATPX version %u, functions 0x%08x\n",
282-
output.version, output.function_bits);
292+
dev_info(dev, "ATPX version %u, functions 0x%08x\n",
293+
output.version, output.function_bits);
283294

284295
amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits);
285296

0 commit comments

Comments
 (0)