netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] defxx: Fix issues with debug printk calls
@ 2014-07-05 14:28 Maciej W. Rozycki
  2014-07-05 16:44 ` Joe Perches
  2014-07-08 22:32 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2014-07-05 14:28 UTC (permalink / raw)
  To: netdev

This fixes issues with debug printk calls across the driver, normally 
disabled; first compilation errors:

drivers/net/fddi/defxx.c:676:1: error: pasting "(" and ""In dfx_bus_init...\n"" does not give a valid preprocessing token
drivers/net/fddi/defxx.c:820:1: error: pasting "(" and ""In dfx_bus_uninit...\n"" does not give a valid preprocessing token

and so on, and then warnings:

drivers/net/fddi/defxx.c: In function 'dfx_driver_init':
drivers/net/fddi/defxx.c:1132: warning: format '%0X' expects type 'unsigned int', but argument 4 has type 'dma_addr_t'
drivers/net/fddi/defxx.c:1132: warning: format '%0X' expects type 'unsigned int', but argument 4 has type 'dma_addr_t'

etc.  Additionally casts are removed from virtual addresses and %p used.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
 Please apply,

  Maciej

linux-defxx-dbg-printk.patch
Index: linux-20140623-swarm64-eb/drivers/net/fddi/defxx.c
===================================================================
--- linux-20140623-swarm64-eb.orig/drivers/net/fddi/defxx.c
+++ linux-20140623-swarm64-eb/drivers/net/fddi/defxx.c
@@ -1127,17 +1127,16 @@ static int dfx_driver_init(struct net_de
 
 	/* Display virtual and physical addresses if debug driver */
 
-	DBG_printk("%s: Descriptor block virt = %0lX, phys = %0X\n",
-		   print_name,
-		   (long)bp->descr_block_virt, bp->descr_block_phys);
-	DBG_printk("%s: Command Request buffer virt = %0lX, phys = %0X\n",
-		   print_name, (long)bp->cmd_req_virt, bp->cmd_req_phys);
-	DBG_printk("%s: Command Response buffer virt = %0lX, phys = %0X\n",
-		   print_name, (long)bp->cmd_rsp_virt, bp->cmd_rsp_phys);
-	DBG_printk("%s: Receive buffer block virt = %0lX, phys = %0X\n",
-		   print_name, (long)bp->rcv_block_virt, bp->rcv_block_phys);
-	DBG_printk("%s: Consumer block virt = %0lX, phys = %0X\n",
-		   print_name, (long)bp->cons_block_virt, bp->cons_block_phys);
+	DBG_printk("%s: Descriptor block virt = %p, phys = %pad\n",
+		   print_name, bp->descr_block_virt, &bp->descr_block_phys);
+	DBG_printk("%s: Command Request buffer virt = %p, phys = %pad\n",
+		   print_name, bp->cmd_req_virt, &bp->cmd_req_phys);
+	DBG_printk("%s: Command Response buffer virt = %p, phys = %pad\n",
+		   print_name, bp->cmd_rsp_virt, &bp->cmd_rsp_phys);
+	DBG_printk("%s: Receive buffer block virt = %p, phys = %pad\n",
+		   print_name, bp->rcv_block_virt, &bp->rcv_block_phys);
+	DBG_printk("%s: Consumer block virt = %p, phys = %pad\n",
+		   print_name, bp->cons_block_virt, &bp->cons_block_phys);
 
 	return DFX_K_SUCCESS;
 }
Index: linux-20140623-swarm64-eb/drivers/net/fddi/defxx.h
===================================================================
--- linux-20140623-swarm64-eb.orig/drivers/net/fddi/defxx.h
+++ linux-20140623-swarm64-eb/drivers/net/fddi/defxx.h
@@ -1693,7 +1693,7 @@ typedef union
 /* Only execute special print call when debug driver was built */
 
 #ifdef DEFXX_DEBUG
-#define DBG_printk(args...) printk(## args)
+#define DBG_printk(args...) printk(args)
 #else
 #define DBG_printk(args...)
 #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] defxx: Fix issues with debug printk calls
  2014-07-05 14:28 [PATCH] defxx: Fix issues with debug printk calls Maciej W. Rozycki
@ 2014-07-05 16:44 ` Joe Perches
  2014-07-05 17:29   ` Maciej W. Rozycki
  2014-07-08 22:32 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-07-05 16:44 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: netdev

On Sat, 2014-07-05 at 15:28 +0100, Maciej W. Rozycki wrote:
[]
> +++ linux-20140623-swarm64-eb/drivers/net/fddi/defxx.h
> @@ -1693,7 +1693,7 @@ typedef union
>  /* Only execute special print call when debug driver was built */
>  
>  #ifdef DEFXX_DEBUG
> -#define DBG_printk(args...) printk(## args)
> +#define DBG_printk(args...) printk(args)
>  #else
>  #define DBG_printk(args...)
>  #endif

It'd be nicer to change this bit to

#ifdef DEFXX_DEBUG
#define DBG_printk(fmt, ...)					\
	printk(KERN_DEBUG fmt, ##__VA_ARGS__)
#else
#define DBG_printk(fmt, ...) 					\
	do (if (0) printk(KERN_DEBUG fmt, ##__VA_ARGS__); } while (0)
#endif

or just use pr_debug everywhere instead.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] defxx: Fix issues with debug printk calls
  2014-07-05 16:44 ` Joe Perches
@ 2014-07-05 17:29   ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2014-07-05 17:29 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev

On Sat, 5 Jul 2014, Joe Perches wrote:

> > +++ linux-20140623-swarm64-eb/drivers/net/fddi/defxx.h
> > @@ -1693,7 +1693,7 @@ typedef union
> >  /* Only execute special print call when debug driver was built */
> >  
> >  #ifdef DEFXX_DEBUG
> > -#define DBG_printk(args...) printk(## args)
> > +#define DBG_printk(args...) printk(args)
> >  #else
> >  #define DBG_printk(args...)
> >  #endif
> 
> It'd be nicer to change this bit to
> 
> #ifdef DEFXX_DEBUG
> #define DBG_printk(fmt, ...)					\
> 	printk(KERN_DEBUG fmt, ##__VA_ARGS__)
> #else
> #define DBG_printk(fmt, ...) 					\
> 	do (if (0) printk(KERN_DEBUG fmt, ##__VA_ARGS__); } while (0)
> #endif
> 
> or just use pr_debug everywhere instead.

 I plan to overhaul this driver to use pr_* or dev_* printk interfaces 
(depending on which of the two I'll find appropriate), but not at this 
stage, here are only strict bug fixes and I don't want to mix bug fixes 
with code quality improvements, so that'd have to be a separate follow-up 
patch anyway (removing DEFXX_DEBUG at the same time as no longer needed).  
This change is at least obviously correct.

 Thanks for your input.

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] defxx: Fix issues with debug printk calls
  2014-07-05 14:28 [PATCH] defxx: Fix issues with debug printk calls Maciej W. Rozycki
  2014-07-05 16:44 ` Joe Perches
@ 2014-07-08 22:32 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-08 22:32 UTC (permalink / raw)
  To: macro; +Cc: netdev

From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Sat, 5 Jul 2014 15:28:22 +0100 (BST)

> This fixes issues with debug printk calls across the driver, normally 
> disabled; first compilation errors:
> 
> drivers/net/fddi/defxx.c:676:1: error: pasting "(" and ""In dfx_bus_init...\n"" does not give a valid preprocessing token
> drivers/net/fddi/defxx.c:820:1: error: pasting "(" and ""In dfx_bus_uninit...\n"" does not give a valid preprocessing token
> 
> and so on, and then warnings:
> 
> drivers/net/fddi/defxx.c: In function 'dfx_driver_init':
> drivers/net/fddi/defxx.c:1132: warning: format '%0X' expects type 'unsigned int', but argument 4 has type 'dma_addr_t'
> drivers/net/fddi/defxx.c:1132: warning: format '%0X' expects type 'unsigned int', but argument 4 has type 'dma_addr_t'
> 
> etc.  Additionally casts are removed from virtual addresses and %p used.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-08 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-05 14:28 [PATCH] defxx: Fix issues with debug printk calls Maciej W. Rozycki
2014-07-05 16:44 ` Joe Perches
2014-07-05 17:29   ` Maciej W. Rozycki
2014-07-08 22:32 ` David Miller

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).