2021-01-20 19:09:41

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 4/6] ACPI: scan: Clean up printing messages

From: Rafael J. Wysocki <[email protected]>

Replace all of the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
in scan.c with acpi_handle_debug() and acpi_handle_info(), respectively,
and drop the _COMPONENT and ACPI_MODULE_NAME() definitions that
are not used any more.

While at it, drop the redundant "Memory allocation error" message
from acpi_add_single_object() and clean up the list of local variables
in that function.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/acpi/scan.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)

Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -19,8 +19,6 @@

#include "internal.h"

-#define _COMPONENT ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME("scan");
extern struct acpi_device *acpi_root;

#define ACPI_BUS_CLASS "system_bus"
@@ -265,8 +263,7 @@ static int acpi_scan_hot_remove(struct a
return error;
}

- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Hot-removing device %s...\n", dev_name(&device->dev)));
+ acpi_handle_debug(handle, "Ejecting\n");

acpi_bus_trim(device);

@@ -827,7 +824,8 @@ static int acpi_bus_extract_wakeup_devic
/* _PRW */
status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer);
if (ACPI_FAILURE(status)) {
- ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW"));
+ acpi_handle_info(handle, "_PRW evaluation failed: %s\n",
+ acpi_format_exception(status));
return err;
}

@@ -932,7 +930,7 @@ static void acpi_bus_get_wakeup_device_f

err = acpi_bus_extract_wakeup_device_power_package(device);
if (err) {
- dev_err(&device->dev, "_PRW evaluation error: %d\n", err);
+ dev_err(&device->dev, "Unable to extract wakeup power resources");
return;
}

@@ -1168,8 +1166,7 @@ acpi_backlight_cap_match(acpi_handle han

if (acpi_has_method(handle, "_BCM") &&
acpi_has_method(handle, "_BCL")) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
- "support\n"));
+ acpi_handle_debug(handle, "Found generic backlight support\n");
*cap |= ACPI_VIDEO_BACKLIGHT;
/* We have backlight support, no need to scan further */
return AE_CTRL_TERMINATE;
@@ -1660,17 +1657,15 @@ static int acpi_add_single_object(struct
acpi_handle handle, int type,
unsigned long long sta)
{
- int result;
- struct acpi_device *device;
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_device_info *info = NULL;
+ struct acpi_device *device;
+ int result;

if (handle != ACPI_ROOT_OBJECT && type == ACPI_BUS_TYPE_DEVICE)
acpi_get_object_info(handle, &info);

device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
if (!device) {
- printk(KERN_ERR PREFIX "Memory allocation error\n");
kfree(info);
return -ENOMEM;
}
@@ -1697,11 +1692,11 @@ static int acpi_add_single_object(struct

acpi_power_add_remove_device(device, true);
acpi_device_add_finalize(device);
- acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Added %s [%s] parent %s\n",
- dev_name(&device->dev), (char *) buffer.pointer,
- device->parent ? dev_name(&device->parent->dev) : "(null)"));
- kfree(buffer.pointer);
+
+ acpi_handle_debug(handle, "Added as %s, parent %s\n",
+ dev_name(&device->dev), device->parent ?
+ dev_name(&device->parent->dev) : "(null)");
+
*child = device;
return 0;
}




2021-01-21 21:27:12

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 4/6] ACPI: scan: Clean up printing messages

Hi "Rafael,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[also build test ERROR on linux/master linus/master v5.11-rc4 next-20210121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Rafael-J-Wysocki/ACPI-Clean-up-printing-messages-in-some-source-files/20210121-030855
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-rhel (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/c8724c26fcedf4a30fdfa9213c38a2f94c4bc0ef
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafael-J-Wysocki/ACPI-Clean-up-printing-messages-in-some-source-files/20210121-030855
git checkout c8724c26fcedf4a30fdfa9213c38a2f94c4bc0ef
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from include/acpi/acpi.h:29,
from include/linux/acpi.h:22,
from drivers/acpi/scan.c:10:
drivers/acpi/scan.c: In function 'acpi_get_device_data':
>> include/acpi/acoutput.h:258:55: error: '_COMPONENT' undeclared (first use in this function)
258 | __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
| ^~~~~~~~~~
include/acpi/acoutput.h:281:44: note: in definition of macro 'ACPI_DO_WHILE0'
281 | #define ACPI_DO_WHILE0(a) do a while(0)
| ^
include/acpi/acoutput.h:299:7: note: in expansion of macro 'ACPI_IS_DEBUG_ENABLED'
299 | if (ACPI_IS_DEBUG_ENABLED (level, component)) \
| ^~~~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:306:2: note: in expansion of macro 'ACPI_DO_DEBUG_PRINT'
306 | ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \
| ^~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:313:41: note: in expansion of macro 'ACPI_ACTUAL_DEBUG'
313 | #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
| ^~~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:3: note: in expansion of macro 'ACPI_DEBUG_PRINT'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~~~~~
include/acpi/acoutput.h:107:46: note: in expansion of macro 'ACPI_DEBUG_PARAMETERS'
107 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
| ^~~~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:117:37: note: in expansion of macro 'ACPI_DEBUG_LEVEL'
117 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
| ^~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:21: note: in expansion of macro 'ACPI_DB_INFO'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~
include/acpi/acoutput.h:258:55: note: each undeclared identifier is reported only once for each function it appears in
258 | __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
| ^~~~~~~~~~
include/acpi/acoutput.h:281:44: note: in definition of macro 'ACPI_DO_WHILE0'
281 | #define ACPI_DO_WHILE0(a) do a while(0)
| ^
include/acpi/acoutput.h:299:7: note: in expansion of macro 'ACPI_IS_DEBUG_ENABLED'
299 | if (ACPI_IS_DEBUG_ENABLED (level, component)) \
| ^~~~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:306:2: note: in expansion of macro 'ACPI_DO_DEBUG_PRINT'
306 | ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \
| ^~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:313:41: note: in expansion of macro 'ACPI_ACTUAL_DEBUG'
313 | #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
| ^~~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:3: note: in expansion of macro 'ACPI_DEBUG_PRINT'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~~~~~
include/acpi/acoutput.h:107:46: note: in expansion of macro 'ACPI_DEBUG_PARAMETERS'
107 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
| ^~~~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:117:37: note: in expansion of macro 'ACPI_DEBUG_LEVEL'
117 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
| ^~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:21: note: in expansion of macro 'ACPI_DB_INFO'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~
>> include/acpi/acoutput.h:258:36: error: '_acpi_module_name' undeclared (first use in this function); did you mean 'quota_module_name'?
258 | __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
| ^~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:281:44: note: in definition of macro 'ACPI_DO_WHILE0'
281 | #define ACPI_DO_WHILE0(a) do a while(0)
| ^
include/acpi/acoutput.h:306:2: note: in expansion of macro 'ACPI_DO_DEBUG_PRINT'
306 | ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \
| ^~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:313:41: note: in expansion of macro 'ACPI_ACTUAL_DEBUG'
313 | #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
| ^~~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:3: note: in expansion of macro 'ACPI_DEBUG_PRINT'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~~~~~
include/acpi/acoutput.h:107:46: note: in expansion of macro 'ACPI_DEBUG_PARAMETERS'
107 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
| ^~~~~~~~~~~~~~~~~~~~~
include/acpi/acoutput.h:117:37: note: in expansion of macro 'ACPI_DEBUG_LEVEL'
117 | #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
| ^~~~~~~~~~~~~~~~
drivers/acpi/scan.c:591:21: note: in expansion of macro 'ACPI_DB_INFO'
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
| ^~~~~~~~~~~~


vim +/_COMPONENT +258 include/acpi/acoutput.h

50df4d8b0f6e1971 Bob Moore 2008-12-31 252
50df4d8b0f6e1971 Bob Moore 2008-12-31 253 /*
50df4d8b0f6e1971 Bob Moore 2008-12-31 254 * Common parameters used for debug output functions:
50df4d8b0f6e1971 Bob Moore 2008-12-31 255 * line number, function name, module(file) name, component ID
50df4d8b0f6e1971 Bob Moore 2008-12-31 256 */
ad5a06f296976305 Bob Moore 2012-12-31 257 #define ACPI_DEBUG_PARAMETERS \
ad5a06f296976305 Bob Moore 2012-12-31 @258 __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
50df4d8b0f6e1971 Bob Moore 2008-12-31 259

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (7.72 kB)
.config.gz (44.85 kB)
Download all attachments