From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756034AbcE0QAh (ORCPT ); Fri, 27 May 2016 12:00:37 -0400 Received: from smtprelay0191.hostedemail.com ([216.40.44.191]:48888 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754317AbcE0QAe (ORCPT ); Fri, 27 May 2016 12:00:34 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:69:355:379:541:800:960:966:968:973:988:989:1260:1345:1437:1534:1542:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3354:3868:3870:4250:4321:4385:4605:5007:6119:6261:6755:7903:8603:9163:10004:10848:11026:11473:11658:11914:12219:12296:12438:12517:12519:12555:12679:13095:13972:14181:14394:14721:21080:21433:30029:30034:30054:30074:30075:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: maid61_78d90d8524f54 X-Filterd-Recvd-Size: 3562 From: Joe Perches To: "Rafael J. Wysocki" , Len Brown Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] acpi: pci_slot: Use more common logging style Date: Fri, 27 May 2016 09:00:28 -0700 Message-Id: X-Mailer: git-send-email 2.8.0.rc4.16.g56331f8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use generic pr_ functions with pr_fmt for info and err. This also reduces object size a trivial bit: $ size drivers/acpi/pci_slot.o* text data bss dec hex filename 935 752 5 1692 69c drivers/acpi/pci_slot.o.new 1027 752 5 1784 6f8 drivers/acpi/pci_slot.o.old Miscellanea: o Remove unnecessary OOM message as k.alloc functions get a generic stack dump on OOM o Remove unnecessary embedded prefix from a dbg() message Signed-off-by: Joe Perches --- drivers/acpi/pci_slot.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index 7188e53..aa8f4c7 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c @@ -22,6 +22,8 @@ * General Public License for more details. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -48,14 +50,11 @@ module_param(debug, bool, 0644); #define _COMPONENT ACPI_PCI_COMPONENT ACPI_MODULE_NAME("pci_slot"); -#define MY_NAME "pci_slot" -#define err(format, arg...) pr_err("%s: " format , MY_NAME , ## arg) -#define info(format, arg...) pr_info("%s: " format , MY_NAME , ## arg) -#define dbg(format, arg...) \ - do { \ - if (debug) \ - pr_debug("%s: " format, MY_NAME , ## arg); \ - } while (0) +#define dbg(fmt, ...) \ +do { \ + if (debug) \ + pr_debug(fmt, ##__VA_ARGS__); \ +} while (0) #define SLOT_NAME_SIZE 21 /* Inspired by #define in acpiphp.h */ @@ -132,15 +131,13 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) } slot = kmalloc(sizeof(*slot), GFP_KERNEL); - if (!slot) { - err("%s: cannot allocate memory\n", __func__); + if (!slot) return AE_OK; - } snprintf(name, sizeof(name), "%llu", sun); pci_slot = pci_create_slot(pci_bus, device, name, NULL); if (IS_ERR(pci_slot)) { - err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot)); + pr_err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot)); kfree(slot); return AE_OK; } @@ -150,8 +147,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) get_device(&pci_bus->dev); - dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n", - pci_slot, pci_bus->number, device, name); + dbg("%p, pci_bus: %x, device: %d, name: %s\n", + pci_slot, pci_bus->number, device, name); return AE_OK; } @@ -186,7 +183,8 @@ void acpi_pci_slot_remove(struct pci_bus *bus) static int do_sta_before_sun(const struct dmi_system_id *d) { - info("%s detected: will evaluate _STA before calling _SUN\n", d->ident); + pr_info("%s detected: will evaluate _STA before calling _SUN\n", + d->ident); check_sta_before_sun = 1; return 0; } -- 2.8.0.rc4.16.g56331f8