[07/22] m68k/mac: baboon - Modernize printing of kernel messages
diff mbox series

Message ID 1481123360-10978-8-git-send-email-geert@linux-m68k.org
State New, archived
Headers show
Series
  • m68k: Modernize printing of kernel messages
Related show

Commit Message

Geert Uytterhoeven Dec. 7, 2016, 3:09 p.m. UTC
- Introduce helpers for printing debug messages, incl. dummies for
    validating format strings when debugging is disabled,
  - Convert from printk() to pr_*(),
  - Drop superfluous casts.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/mac/baboon.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

Comments

Finn Thain Dec. 7, 2016, 10:54 p.m. UTC | #1
On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

>   - Introduce helpers for printing debug messages, incl. dummies for
>     validating format strings when debugging is disabled,
>   - Convert from printk() to pr_*(),
>   - Drop superfluous casts.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  arch/m68k/mac/baboon.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
> index f6f7d42713ec8b95..5dac92227654419b 100644
> --- a/arch/m68k/mac/baboon.c
> +++ b/arch/m68k/mac/baboon.c
> @@ -15,6 +15,11 @@
>  #include <asm/mac_baboon.h>
>  
>  /* #define DEBUG_IRQS */
> +#ifdef DEBUG_IRQS
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
>  

I'd prefer to drop the DEBUG_IRQS printk messages in this file.

Thanks.

>  int baboon_present;
>  static volatile struct baboon *baboon;
> @@ -38,7 +43,7 @@ void __init baboon_init(void)
>  	baboon = (struct baboon *) BABOON_BASE;
>  	baboon_present = 1;
>  
> -	printk("Baboon detected at %p\n", baboon);
> +	pr_info("Baboon detected at %p\n", baboon);
>  }
>  
>  /*
> @@ -50,11 +55,8 @@ static void baboon_irq(struct irq_desc *desc)
>  	int irq_bit, irq_num;
>  	unsigned char events;
>  
> -#ifdef DEBUG_IRQS
> -	printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
> -		(uint) baboon->mb_control, (uint) baboon->mb_ifr,
> -		(uint) baboon->mb_status);
> -#endif
> +	pr_irq("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
> +	       baboon->mb_control, baboon->mb_ifr, baboon->mb_status);
>  
>  	events = baboon->mb_ifr & 0x07;
>  	if (!events)
> @@ -97,18 +99,14 @@ void __init baboon_register_interrupts(void)
>  
>  void baboon_irq_enable(int irq)
>  {
> -#ifdef DEBUG_IRQUSE
> -	printk("baboon_irq_enable(%d)\n", irq);
> -#endif
> +	pr_irq("baboon_irq_enable(%d)\n", irq);
>  
>  	mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
>  }
>  
>  void baboon_irq_disable(int irq)
>  {
> -#ifdef DEBUG_IRQUSE
> -	printk("baboon_irq_disable(%d)\n", irq);
> -#endif
> +	pr_irq("baboon_irq_disable(%d)\n", irq);
>  
>  	mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
>  }
> 

--

Patch
diff mbox series

diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index f6f7d42713ec8b95..5dac92227654419b 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -15,6 +15,11 @@ 
 #include <asm/mac_baboon.h>
 
 /* #define DEBUG_IRQS */
+#ifdef DEBUG_IRQS
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
 
 int baboon_present;
 static volatile struct baboon *baboon;
@@ -38,7 +43,7 @@  void __init baboon_init(void)
 	baboon = (struct baboon *) BABOON_BASE;
 	baboon_present = 1;
 
-	printk("Baboon detected at %p\n", baboon);
+	pr_info("Baboon detected at %p\n", baboon);
 }
 
 /*
@@ -50,11 +55,8 @@  static void baboon_irq(struct irq_desc *desc)
 	int irq_bit, irq_num;
 	unsigned char events;
 
-#ifdef DEBUG_IRQS
-	printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
-		(uint) baboon->mb_control, (uint) baboon->mb_ifr,
-		(uint) baboon->mb_status);
-#endif
+	pr_irq("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
+	       baboon->mb_control, baboon->mb_ifr, baboon->mb_status);
 
 	events = baboon->mb_ifr & 0x07;
 	if (!events)
@@ -97,18 +99,14 @@  void __init baboon_register_interrupts(void)
 
 void baboon_irq_enable(int irq)
 {
-#ifdef DEBUG_IRQUSE
-	printk("baboon_irq_enable(%d)\n", irq);
-#endif
+	pr_irq("baboon_irq_enable(%d)\n", irq);
 
 	mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
 }
 
 void baboon_irq_disable(int irq)
 {
-#ifdef DEBUG_IRQUSE
-	printk("baboon_irq_disable(%d)\n", irq);
-#endif
+	pr_irq("baboon_irq_disable(%d)\n", irq);
 
 	mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
 }