]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide: add a driver-wide debugging macro
authorBorislav Petkov <petkovbb@googlemail.com>
Mon, 13 Oct 2008 19:39:35 +0000 (21:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 13 Oct 2008 19:39:35 +0000 (21:39 +0200)
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>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
include/linux/ide.h

index fcd98e1d186300189df9ddd24807d52992c6aea2..02c4c642e6a549d34505fda6b6515ccc23946fda 100644 (file)
@@ -927,6 +927,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).
  *