* [PATCH 0/2] powerpc: pci-ioda: Neatening
@ 2014-09-21 17:55 Joe Perches
2014-09-21 17:55 ` [PATCH 1/2] powerpc: pci-ioda: Remove unnecessary return value from printk Joe Perches
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Joe Perches @ 2014-09-21 17:55 UTC (permalink / raw)
To: linux-kernel
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, linuxppc-dev
printk calls should return void
Joe Perches (2):
powerpc: pci-ioda: Remove unnecessary return value from printk
powerpc: pci-ioda: Use a single function to emit logging messages
(compiled/untested)
arch/powerpc/platforms/powernv/pci-ioda.c | 61 +++++++++++++++----------------
1 file changed, 30 insertions(+), 31 deletions(-)
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] powerpc: pci-ioda: Remove unnecessary return value from printk
2014-09-21 17:55 [PATCH 0/2] powerpc: pci-ioda: Neatening Joe Perches
@ 2014-09-21 17:55 ` Joe Perches
2014-09-21 17:55 ` [PATCH 2/2] powerpc: pci-ioda: Use a single function to emit logging messages Joe Perches
2014-09-22 6:56 ` [PATCH 0/2] powerpc: pci-ioda: Neatening Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-09-21 17:55 UTC (permalink / raw)
To: linux-kernel
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, linuxppc-dev
The return value is unnecessary and unused, so make the functions
void instead of int.
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index df241b1..16bb93f 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -42,12 +42,11 @@
#include "pci.h"
#define define_pe_printk_level(func, kern_level) \
-static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
+static void func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
{ \
struct va_format vaf; \
va_list args; \
char pfix[32]; \
- int r; \
\
va_start(args, fmt); \
\
@@ -61,12 +60,10 @@ static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
sprintf(pfix, "%04x:%02x ", \
pci_domain_nr(pe->pbus), \
pe->pbus->number); \
- r = printk(kern_level "pci %s: [PE# %.3d] %pV", \
- pfix, pe->pe_number, &vaf); \
+ printk(kern_level "pci %s: [PE# %.3d] %pV", \
+ pfix, pe->pe_number, &vaf); \
\
va_end(args); \
- \
- return r; \
} \
define_pe_printk_level(pe_err, KERN_ERR);
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] powerpc: pci-ioda: Use a single function to emit logging messages
2014-09-21 17:55 [PATCH 0/2] powerpc: pci-ioda: Neatening Joe Perches
2014-09-21 17:55 ` [PATCH 1/2] powerpc: pci-ioda: Remove unnecessary return value from printk Joe Perches
@ 2014-09-21 17:55 ` Joe Perches
2014-09-22 6:56 ` [PATCH 0/2] powerpc: pci-ioda: Neatening Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-09-21 17:55 UTC (permalink / raw)
To: linux-kernel
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, linuxppc-dev
No need for 3 functions when a single one will do.
Modify the function declaring macros to call the single function.
Reduces object code size a little:
$ size arch/powerpc/platforms/powernv/pci-ioda.o*
text data bss dec hex filename
22303 1073 6680 30056 7568 arch/powerpc/platforms/powernv/pci-ioda.o.new
22840 1121 6776 30737 7811 arch/powerpc/platforms/powernv/pci-ioda.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 58 ++++++++++++++++---------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 16bb93f..b0d31083 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -41,34 +41,36 @@
#include "powernv.h"
#include "pci.h"
-#define define_pe_printk_level(func, kern_level) \
-static void func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \
-{ \
- struct va_format vaf; \
- va_list args; \
- char pfix[32]; \
- \
- va_start(args, fmt); \
- \
- vaf.fmt = fmt; \
- vaf.va = &args; \
- \
- if (pe->pdev) \
- strlcpy(pfix, dev_name(&pe->pdev->dev), \
- sizeof(pfix)); \
- else \
- sprintf(pfix, "%04x:%02x ", \
- pci_domain_nr(pe->pbus), \
- pe->pbus->number); \
- printk(kern_level "pci %s: [PE# %.3d] %pV", \
- pfix, pe->pe_number, &vaf); \
- \
- va_end(args); \
-} \
-
-define_pe_printk_level(pe_err, KERN_ERR);
-define_pe_printk_level(pe_warn, KERN_WARNING);
-define_pe_printk_level(pe_info, KERN_INFO);
+static void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
+ const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ char pfix[32];
+
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ if (pe->pdev)
+ strlcpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
+ else
+ sprintf(pfix, "%04x:%02x ",
+ pci_domain_nr(pe->pbus), pe->pbus->number);
+
+ printk("%spci %s: [PE# %.3d] %pV",
+ level, pfix, pe->pe_number, &vaf);
+
+ va_end(args);
+}
+
+#define pe_err(pe, fmt, ...) \
+ pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
+#define pe_warn(pe, fmt, ...) \
+ pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
+#define pe_info(pe, fmt, ...) \
+ pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
/*
* stdcix is only supposed to be used in hypervisor real mode as per
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] powerpc: pci-ioda: Neatening
2014-09-21 17:55 [PATCH 0/2] powerpc: pci-ioda: Neatening Joe Perches
2014-09-21 17:55 ` [PATCH 1/2] powerpc: pci-ioda: Remove unnecessary return value from printk Joe Perches
2014-09-21 17:55 ` [PATCH 2/2] powerpc: pci-ioda: Use a single function to emit logging messages Joe Perches
@ 2014-09-22 6:56 ` Michael Ellerman
2014-09-23 0:53 ` Gavin Shan
2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2014-09-22 6:56 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Benjamin Herrenschmidt, linuxppc-dev, shangw
On Sun, 2014-09-21 at 10:55 -0700, Joe Perches wrote:
> printk calls should return void
>
> Joe Perches (2):
> powerpc: pci-ioda: Remove unnecessary return value from printk
> powerpc: pci-ioda: Use a single function to emit logging messages
Patches look good to me.
Ben/Gavin, what do these macros give us over pr/dev_debug() ?
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] powerpc: pci-ioda: Neatening
2014-09-22 6:56 ` [PATCH 0/2] powerpc: pci-ioda: Neatening Michael Ellerman
@ 2014-09-23 0:53 ` Gavin Shan
0 siblings, 0 replies; 5+ messages in thread
From: Gavin Shan @ 2014-09-23 0:53 UTC (permalink / raw)
To: Michael Ellerman; +Cc: Joe Perches, linuxppc-dev, linux-kernel, shangw
On Mon, Sep 22, 2014 at 04:56:17PM +1000, Michael Ellerman wrote:
>On Sun, 2014-09-21 at 10:55 -0700, Joe Perches wrote:
>> printk calls should return void
>>
>> Joe Perches (2):
>> powerpc: pci-ioda: Remove unnecessary return value from printk
>> powerpc: pci-ioda: Use a single function to emit logging messages
>
>Patches look good to me.
>
Patches look good to me too.
>Ben/Gavin, what do these macros give us over pr/dev_debug() ?
>
Those macros prints unified mapping information between
PE number and PCI device/bus.
Thanks,
Gavin
>cheers
>
>
>_______________________________________________
>Linuxppc-dev mailing list
>Linuxppc-dev@lists.ozlabs.org
>https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-23 0:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-21 17:55 [PATCH 0/2] powerpc: pci-ioda: Neatening Joe Perches
2014-09-21 17:55 ` [PATCH 1/2] powerpc: pci-ioda: Remove unnecessary return value from printk Joe Perches
2014-09-21 17:55 ` [PATCH 2/2] powerpc: pci-ioda: Use a single function to emit logging messages Joe Perches
2014-09-22 6:56 ` [PATCH 0/2] powerpc: pci-ioda: Neatening Michael Ellerman
2014-09-23 0:53 ` Gavin Shan
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).