* [PATCH] acpi: pci_slot: Use more common logging style
@ 2016-05-27 16:00 Joe Perches
2016-06-23 0:32 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2016-05-27 16:00 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel
Use generic pr_<level> 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 <joe@perches.com>
---
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 <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] acpi: pci_slot: Use more common logging style
2016-05-27 16:00 [PATCH] acpi: pci_slot: Use more common logging style Joe Perches
@ 2016-06-23 0:32 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2016-06-23 0:32 UTC (permalink / raw)
To: Joe Perches; +Cc: Len Brown, linux-acpi, linux-kernel
On Friday, May 27, 2016 09:00:28 AM Joe Perches wrote:
> Use generic pr_<level> 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 <joe@perches.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-23 0:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 16:00 [PATCH] acpi: pci_slot: Use more common logging style Joe Perches
2016-06-23 0:32 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).