[PATCH 3/5] ide: add a driver-wide debugging macro

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <Bartlomiej@...>, <Zolnierkiewicz@...>, <bzolnier@...>
Cc: <linux-kernel@...>, <linux-ide@...>, Borislav Petkov <petkovbb@...>
Date: Sunday, August 17, 2008 - 1:23 pm

Add __ide_debug_log() debugging macro which is controlled by drive->debug_mask.
The macro has to have the macro DRV_NAME defined in each driver before use.
Also, add different debugging levels depending on the functionality debugged.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 include/linux/ide.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/linux/ide.h b/include/linux/ide.h
index c161840..b6d714d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -925,6 +925,26 @@ static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *
 #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
 #endif
 
+enum {
+	/* enter/exit functions */
+	IDE_DBG_FUNC =			(1 << 0),
+	/* sense key/asc handling */
+	IDE_DBG_SENSE =			(1 << 1),
+	/* packet commands handling */
+	IDE_DBG_PC =			(1 << 2),
+	/* request handling */
+	IDE_DBG_RQ =			(1 << 3),
+	/* driver probing/setup */
+	IDE_DBG_PROBE =			(1 << 4),
+};
+
+/* DRV_NAME has to be defined in the driver before using the macro below */
+#define __ide_debug_log(lvl, fmt, args...)			\
+{								\
+	if (unlikely(drive->debug_mask & lvl))			\
+		printk(KERN_INFO DRV_NAME ": " fmt, ## args);	\
+}
+
 /*
  * Power Management step value (rq->pm->pm_step).
  *
-- 
1.5.5.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/5] ide debugging macros, Borislav Petkov, (Sun Aug 17, 1:23 pm)
Re: [PATCH 0/5] ide debugging macros, Bartlomiej Zolnierkiewicz..., (Mon Aug 18, 5:08 pm)
Re: [PATCH 0/5] ide debugging macros, Borislav Petkov, (Tue Aug 19, 2:23 am)
Re: [PATCH 0/5] ide debugging macros, Borislav Petkov, (Tue Aug 19, 2:15 am)
Re: [PATCH 0/5] ide debugging macros, Bartlomiej Zolnierkiewicz..., (Mon Aug 18, 5:29 pm)
[PATCH 5/5] ide-floppy: add a debug_mask module parameter, Borislav Petkov, (Sun Aug 17, 1:23 pm)
[PATCH 1/5] ide: unify conversion macros, Borislav Petkov, (Sun Aug 17, 1:23 pm)
[PATCH 3/5] ide: add a driver-wide debugging macro, Borislav Petkov, (Sun Aug 17, 1:23 pm)
Re: [PATCH 3/5] ide: add a driver-wide debugging macro, Joe Perches, (Sun Aug 17, 2:13 pm)
Re: [PATCH 3/5] ide: add a driver-wide debugging macro, Borislav Petkov, (Sun Aug 17, 2:24 pm)
[PATCH 2/5] ide: add drive-&gt;debug_mask switch, Borislav Petkov, (Sun Aug 17, 1:23 pm)