All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: Bartlomiej@gollum.tnic, Zolnierkiewicz@gollum.tnic, bzolnier@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 3/5] ide: add a driver-wide debugging macro
Date: Sun, 17 Aug 2008 19:23:44 +0200	[thread overview]
Message-ID: <1218993826-4571-4-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1218993826-4571-1-git-send-email-petkovbb@gmail.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Borislav Petkov <petkovbb@googlemail.com>
To: Bartlomiej@gollum.tnic, Zolnierkiewicz@gollum.tnic, <bzolnier@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 3/5] ide: add a driver-wide debugging macro
Date: Sun, 17 Aug 2008 19:23:44 +0200	[thread overview]
Message-ID: <1218993826-4571-4-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1218993826-4571-1-git-send-email-petkovbb@gmail.com>

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


  parent reply	other threads:[~2008-08-17 17:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-17 17:23 [PATCH 0/5] ide debugging macros Borislav Petkov
2008-08-17 17:23 ` Borislav Petkov
2008-08-17 17:23 ` [PATCH 1/5] ide: unify conversion macros Borislav Petkov
2008-08-17 17:23   ` Borislav Petkov
2008-08-17 17:23 ` [PATCH 2/5] ide: add drive->debug_mask switch Borislav Petkov
2008-08-17 17:23   ` Borislav Petkov
2008-08-17 17:23 ` Borislav Petkov [this message]
2008-08-17 17:23   ` [PATCH 3/5] ide: add a driver-wide debugging macro Borislav Petkov
2008-08-17 18:13   ` Joe Perches
2008-08-17 18:24     ` Borislav Petkov
2008-08-17 17:23 ` [PATCH 4/5] ide-floppy: convert driver to the new " Borislav Petkov
2008-08-17 17:23   ` Borislav Petkov
2008-08-17 17:23 ` [PATCH 5/5] ide-floppy: add a debug_mask module parameter Borislav Petkov
2008-08-17 17:23   ` Borislav Petkov
2008-08-18 21:08 ` [PATCH 0/5] ide debugging macros Bartlomiej Zolnierkiewicz
2008-08-18 21:29   ` Bartlomiej Zolnierkiewicz
2008-08-19  6:15   ` Borislav Petkov
2008-08-19  6:23   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218993826-4571-4-git-send-email-petkovbb@gmail.com \
    --to=petkovbb@googlemail.com \
    --cc=Bartlomiej@gollum.tnic \
    --cc=Zolnierkiewicz@gollum.tnic \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.