From patchwork Tue Jul 20 18:16:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 113042 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6KIeGQQ025476 for ; Tue, 20 Jul 2010 18:43:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758737Ab0GTSQX (ORCPT ); Tue, 20 Jul 2010 14:16:23 -0400 Received: from mail.perches.com ([173.55.12.10]:1985 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758654Ab0GTSQW (ORCPT ); Tue, 20 Jul 2010 14:16:22 -0400 Received: from [192.168.1.151] (Joe-Laptop.home [192.168.1.151]) by mail.perches.com (Postfix) with ESMTP id 0B87F24368; Tue, 20 Jul 2010 11:16:10 -0700 (PDT) Subject: Re: [PATCH net-next] drivers/acpi/acpica/utmisc.c: Use printk extension %pV From: Joe Perches To: Bjorn Helgaas Cc: Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, netdev , David Miller In-Reply-To: <201007201008.04496.bjorn.helgaas@hp.com> References: <1279602367.19374.20.camel@Joe-Laptop.home> <201007201008.04496.bjorn.helgaas@hp.com> Date: Tue, 20 Jul 2010 11:16:20 -0700 Message-ID: <1279649780.22947.38.camel@Joe-Laptop.home> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 20 Jul 2010 18:43:18 +0000 (UTC) diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index e8d0724..874e4d2 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c @@ -51,10 +51,45 @@ ACPI_MODULE_NAME("utmisc") /* - * Common suffix for messages + * Single line messages, adds a newline after message */ -#define ACPI_COMMON_MSG_SUFFIX \ - acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) + +static void ACPI_PRINTF_LIKE(5) +acpi_put_message(const char *module_name, u32 line_number, + const char *fmt, va_list *args, const char *message, ...) +{ +#ifdef __KERNEL__ + va_list message_args; + struct va_format vaf1; + struct va_format vaf2; + + va_start(message_args, message); + vaf1.fmt = message; + vaf1.va = &message_args; + vaf2.fmt = fmt; + vaf2.va = args; + if (module_name) + acpi_os_printf("%pV%pV (%8.8X/%s-%u)\n", + &vaf1, &vaf2, + ACPI_CA_VERSION, module_name, line_number); + else + acpi_os_printf("%pV%pV\n", &vaf1, &vaf2); + va_end(message_args); +#else + va_list message_args; + + va_start(message_args, message); + acpi_os_vprintf(message, message_args); + acpi_os_vprintf(fmt, *args); + if (module_name) + acpi_os_printf(" (%8.8X/%s-%u)\n", + ACPI_CA_VERSION, module_name, line_number); + else + acpi_os_printf("\n"); + va_end(message_args); +#endif +} + /******************************************************************************* * * FUNCTION: acpi_ut_validate_exception @@ -1064,11 +1099,9 @@ acpi_error(const char *module_name, u32 line_number, const char *format, ...) { va_list args; - acpi_os_printf("ACPI Error: "); - va_start(args, format); - acpi_os_vprintf(format, args); - ACPI_COMMON_MSG_SUFFIX; + acpi_put_message(module_name, line_number, format, &args, + "ACPI Error: "); va_end(args); } @@ -1078,11 +1111,9 @@ acpi_exception(const char *module_name, { va_list args; - acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); - va_start(args, format); - acpi_os_vprintf(format, args); - ACPI_COMMON_MSG_SUFFIX; + acpi_put_message(module_name, line_number, format, &args, + "ACPI Exception: %s, ", acpi_format_exception(status)); va_end(args); } @@ -1091,11 +1122,9 @@ acpi_warning(const char *module_name, u32 line_number, const char *format, ...) { va_list args; - acpi_os_printf("ACPI Warning: "); - va_start(args, format); - acpi_os_vprintf(format, args); - ACPI_COMMON_MSG_SUFFIX; + acpi_put_message(module_name, line_number, format, &args, + "ACPI Warning: "); va_end(args); } @@ -1104,11 +1133,8 @@ acpi_info(const char *module_name, u32 line_number, const char *format, ...) { va_list args; - acpi_os_printf("ACPI: "); - va_start(args, format); - acpi_os_vprintf(format, args); - acpi_os_printf("\n"); + acpi_put_message(NULL, 0, format, &args, "ACPI: "); va_end(args); } @@ -1152,11 +1178,9 @@ acpi_ut_predefined_warning(const char *module_name, return; } - acpi_os_printf("ACPI Warning for %s: ", pathname); - va_start(args, format); - acpi_os_vprintf(format, args); - ACPI_COMMON_MSG_SUFFIX; + acpi_put_message(module_name, line_number, format, &args, + "ACPI Warning for %s: ", pathname); va_end(args); } @@ -1194,10 +1218,8 @@ acpi_ut_predefined_info(const char *module_name, return; } - acpi_os_printf("ACPI Info for %s: ", pathname); - va_start(args, format); - acpi_os_vprintf(format, args); - ACPI_COMMON_MSG_SUFFIX; + acpi_put_message(module_name, line_number, format, &args, + "ACPI Info for %s: ", pathname); va_end(args); }