* [PATCH 1/9] libata: change debugging macros/adjust dbg levels
@ 2006-06-29 16:09 Borislav Petkov
2006-06-29 16:27 ` Tejun Heo
0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2006-06-29 16:09 UTC (permalink / raw)
To: linux-ide; +Cc: Jeff Garzik, Tejun Heo
change debugging macros ata_(port|dev)_printk and adjust debugging levels
Signed-off-by: <petkov@math.uni-muenster.de>
--- libata-dev/include/linux/libata.h 2006-06-29 17:17:50.000000000 +0200
+++ libata-dev/include/linux/libata.h.new 2006-06-28 17:23:30.000000000 +0200
@@ -67,24 +67,26 @@
#define HAVE_LIBATA_MSG 1
enum {
- ATA_MSG_DRV = 0x0001,
- ATA_MSG_INFO = 0x0002,
- ATA_MSG_PROBE = 0x0004,
- ATA_MSG_WARN = 0x0008,
- ATA_MSG_MALLOC = 0x0010,
- ATA_MSG_CTL = 0x0020,
- ATA_MSG_INTR = 0x0040,
- ATA_MSG_ERR = 0x0080,
-};
-
-#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
-#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
-#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
-#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
-#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
-#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
-#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
-#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
+ ATA_MSG_ERR = 0x0001,
+ ATA_MSG_WARN = 0x0002,
+ ATA_MSG_DRV = 0x0004,
+ ATA_MSG_INFO = 0x0008, /* revalidation messages, EH progress */
+ ATA_MSG_VDEBUG = 0x0010, /* verbose hot path */
+ ATA_MSG_CMD = 0x0020, /* issue / completion */
+ ATA_MSG_SG = 0x0040, /* SG map/unmap handling */
+ ATA_MSG_TRACE = 0x0080, /* function tracing, e.g. enter/exit */
+};
+
+const char *__ata_msg_lvs[] = {
+ [ATA_MSG_ERR] = KERN_ERR,
+ [ATA_MSG_WARN] = KERN_WARNING,
+ [ATA_MSG_DRV] = KERN_INFO,
+ [ATA_MSG_INFO] = KERN_INFO,
+ [ATA_MSG_VDEBUG] = KERN_DEBUG,
+ [ATA_MSG_CMD] = KERN_DEBUG,
+ [ATA_MSG_SG] = KERN_DEBUG,
+ [ATA_MSG_TRACE] = KERN_DEBUG
+};
static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
{
@@ -805,11 +807,16 @@ extern void ata_do_eh(struct ata_port *a
/*
* printk helpers
*/
-#define ata_port_printk(ap, lv, fmt, args...) \
- printk(lv"ata%u: "fmt, (ap)->id , ##args)
+#define ata_port_printk(ap, lv, fmt, args...) do { \
+ if (unlikely((ap)->msg_enable & (0xFF & (lv)))) \
+ printk("%sata%u: "fmt, __ata_msg_lvs[lv], (ap)->id , ##args); \
+} while (0)
-#define ata_dev_printk(dev, lv, fmt, args...) \
- printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args)
+#define ata_dev_printk(dev, lv, fmt, args...) do { \
+ if (unlikely((dev->ap)->msg_enable & (0xFF & (lv)))) \
+ printk("%sata%u.%02u: "fmt, __ata_msg_lvs[lv], \
+ (dev)->ap->id, (dev)->devno , ##args); \
+} while (0)
/*
* ata_eh_info helpers
@@ -997,9 +1004,8 @@ static inline u8 ata_wait_idle(struct at
if (status & (ATA_BUSY | ATA_DRQ)) {
unsigned long l = ap->ioaddr.status_addr;
- if (ata_msg_warn(ap))
- printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
- status, l);
+ ata_port_printk(ap, ATA_MSG_WARN,
+ "ATA: abnormal status 0x%X on port 0x%lX\n", status, l);
}
return status;
@@ -1109,8 +1115,7 @@ static inline u8 ata_irq_ack(struct ata_
status = ata_busy_wait(ap, bits, 1000);
if (status & bits)
- if (ata_msg_err(ap))
- printk(KERN_ERR "abnormal status 0x%X\n", status);
+ ata_port_printk(ap, ATA_MSG_ERR, "abnormal status 0x%X\n", status);
/* get controller status; clear intr, err bits */
if (ap->flags & ATA_FLAG_MMIO) {
@@ -1128,10 +1133,10 @@ static inline u8 ata_irq_ack(struct ata_
post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
}
- if (ata_msg_intr(ap))
- printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
- __FUNCTION__,
- host_stat, post_stat, status);
+ ata_port_printk(ap, ATA_MSG_VDEBUG,
+ "%s: irq ack: host_stat 0x%X, new host_stat 0x%X,"
+ "drv_stat 0x%X\n",
+ __FUNCTION__, host_stat, post_stat, status);
return status;
}
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 16:09 [PATCH 1/9] libata: change debugging macros/adjust dbg levels Borislav Petkov
@ 2006-06-29 16:27 ` Tejun Heo
2006-06-29 17:27 ` Borislav Petkov
0 siblings, 1 reply; 8+ messages in thread
From: Tejun Heo @ 2006-06-29 16:27 UTC (permalink / raw)
To: Borislav Petkov; +Cc: linux-ide, Jeff Garzik
Hello,
Generally looks good to me. Just a few comments.
Borislav Petkov wrote:
> change debugging macros ata_(port|dev)_printk and adjust debugging levels
>
> Signed-off-by: <petkov@math.uni-muenster.de>
>
>
> --- libata-dev/include/linux/libata.h 2006-06-29 17:17:50.000000000 +0200
> +++ libata-dev/include/linux/libata.h.new 2006-06-28 17:23:30.000000000 +0200
> @@ -67,24 +67,26 @@
> #define HAVE_LIBATA_MSG 1
>
> enum {
> - ATA_MSG_DRV = 0x0001,
> - ATA_MSG_INFO = 0x0002,
> - ATA_MSG_PROBE = 0x0004,
> - ATA_MSG_WARN = 0x0008,
> - ATA_MSG_MALLOC = 0x0010,
> - ATA_MSG_CTL = 0x0020,
> - ATA_MSG_INTR = 0x0040,
> - ATA_MSG_ERR = 0x0080,
> -};
> -
> -#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
> -#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
> -#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
> -#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
> -#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
> -#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
> -#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
> -#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
> + ATA_MSG_ERR = 0x0001,
> + ATA_MSG_WARN = 0x0002,
> + ATA_MSG_DRV = 0x0004,
Comment for ATA_MSG_DRV please. Also, I'm not sure we need separate DRV
from INFO.
> + ATA_MSG_INFO = 0x0008, /* revalidation messages, EH progress */
> + ATA_MSG_VDEBUG = 0x0010, /* verbose hot path */
> + ATA_MSG_CMD = 0x0020, /* issue / completion */
> + ATA_MSG_SG = 0x0040, /* SG map/unmap handling */
> + ATA_MSG_TRACE = 0x0080, /* function tracing, e.g. enter/exit */
> +};
> +
> +const char *__ata_msg_lvs[] = {
> + [ATA_MSG_ERR] = KERN_ERR,
> + [ATA_MSG_WARN] = KERN_WARNING,
> + [ATA_MSG_DRV] = KERN_INFO,
> + [ATA_MSG_INFO] = KERN_INFO,
> + [ATA_MSG_VDEBUG] = KERN_DEBUG,
> + [ATA_MSG_CMD] = KERN_DEBUG,
> + [ATA_MSG_SG] = KERN_DEBUG,
> + [ATA_MSG_TRACE] = KERN_DEBUG
> +};
Please declare the array here and define it in libata-core.c.
> static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
> {
> @@ -805,11 +807,16 @@ extern void ata_do_eh(struct ata_port *a
> /*
> * printk helpers
> */
> -#define ata_port_printk(ap, lv, fmt, args...) \
> - printk(lv"ata%u: "fmt, (ap)->id , ##args)
> +#define ata_port_printk(ap, lv, fmt, args...) do { \
> + if (unlikely((ap)->msg_enable & (0xFF & (lv)))) \
^^^^why?
> + printk("%sata%u: "fmt, __ata_msg_lvs[lv], (ap)->id , ##args); \
> +} while (0)
>
> -#define ata_dev_printk(dev, lv, fmt, args...) \
> - printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args)
> +#define ata_dev_printk(dev, lv, fmt, args...) do { \
> + if (unlikely((dev->ap)->msg_enable & (0xFF & (lv)))) \
^^^^ditto
> + printk("%sata%u.%02u: "fmt, __ata_msg_lvs[lv], \
> + (dev)->ap->id, (dev)->devno , ##args); \
> +} while (0)
>
> /*
> * ata_eh_info helpers
> @@ -997,9 +1004,8 @@ static inline u8 ata_wait_idle(struct at
>
> if (status & (ATA_BUSY | ATA_DRQ)) {
> unsigned long l = ap->ioaddr.status_addr;
> - if (ata_msg_warn(ap))
> - printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
> - status, l);
> + ata_port_printk(ap, ATA_MSG_WARN,
> + "ATA: abnormal status 0x%X on port 0x%lX\n", status, l);
^^^^^ you can drop the header.
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 16:27 ` Tejun Heo
@ 2006-06-29 17:27 ` Borislav Petkov
2006-06-29 18:09 ` Tejun Heo
0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2006-06-29 17:27 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Jeff Garzik
On Fri, Jun 30, 2006 at 01:27:30AM +0900, Tejun Heo wrote:
<snip>
> >@@ -805,11 +807,16 @@ extern void ata_do_eh(struct ata_port *a
> > /*
> > * printk helpers
> > */
> >-#define ata_port_printk(ap, lv, fmt, args...) \
> >- printk(lv"ata%u: "fmt, (ap)->id , ##args)
> >+#define ata_port_printk(ap, lv, fmt, args...) do { \
> >+ if (unlikely((ap)->msg_enable & (0xFF & (lv)))) \
> ^^^^why?
Because the decimal value of ATA_MSG_TRACE, for example, is 128 (hex 0x80) and
when i shift a 1 128 time to the left, the datatype, in our case an int, i
think (dunno what gcc does exactly here) is too small for the shift. Besides,
ap->msg_enable is an u32 so that if would never be true for something bigger
than 0x20.
> >+ printk("%sata%u: "fmt, __ata_msg_lvs[lv], (ap)->id ,
> >##args); \
> >+} while (0)
> >
> >-#define ata_dev_printk(dev, lv, fmt, args...) \
> >- printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args)
> >+#define ata_dev_printk(dev, lv, fmt, args...) do { \
> >+ if (unlikely((dev->ap)->msg_enable & (0xFF & (lv)))) \
> ^^^^ditto
>
> >+ printk("%sata%u.%02u: "fmt, __ata_msg_lvs[lv], \
> >+ (dev)->ap->id, (dev)->devno , ##args); \
> >+} while (0)
> >
> > /*
> > * ata_eh_info helpers
> >@@ -997,9 +1004,8 @@ static inline u8 ata_wait_idle(struct at
> >
> > if (status & (ATA_BUSY | ATA_DRQ)) {
> > unsigned long l = ap->ioaddr.status_addr;
> >- if (ata_msg_warn(ap))
> >- printk(KERN_WARNING "ATA: abnormal status 0x%X on
> >port 0x%lX\n",
> >- status, l);
> >+ ata_port_printk(ap, ATA_MSG_WARN,
> >+ "ATA: abnormal status 0x%X on port 0x%lX\n", status,
> >l);
> ^^^^^ you can drop the header.
will do.
Regards,
Boris.
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 17:27 ` Borislav Petkov
@ 2006-06-29 18:09 ` Tejun Heo
2006-06-29 20:53 ` Borislav Petkov
0 siblings, 1 reply; 8+ messages in thread
From: Tejun Heo @ 2006-06-29 18:09 UTC (permalink / raw)
To: Borislav Petkov; +Cc: linux-ide, Jeff Garzik
Borislav Petkov wrote:
> On Fri, Jun 30, 2006 at 01:27:30AM +0900, Tejun Heo wrote:
> <snip>
>>> @@ -805,11 +807,16 @@ extern void ata_do_eh(struct ata_port *a
>>> /*
>>> * printk helpers
>>> */
>>> -#define ata_port_printk(ap, lv, fmt, args...) \
>>> - printk(lv"ata%u: "fmt, (ap)->id , ##args)
>>> +#define ata_port_printk(ap, lv, fmt, args...) do { \
>>> + if (unlikely((ap)->msg_enable & (0xFF & (lv)))) \
>> ^^^^why?
> Because the decimal value of ATA_MSG_TRACE, for example, is 128 (hex 0x80) and
> when i shift a 1 128 time to the left, the datatype, in our case an int, i
> think (dunno what gcc does exactly here) is too small for the shift. Besides,
> ap->msg_enable is an u32 so that if would never be true for something bigger
> than 0x20.
Please make
+ ATA_MSG_ERR = 0,
+ ATA_MSG_WARN = 1,
+ ATA_MSG_DRV = 2,
+ ATA_MSG_INFO = 3, /* revalidation messages, EH progress */
+ ATA_MSG_VDEBUG = 4, /* verbose hot path */
+ ATA_MSG_CMD = 5, /* issue / completion */
+ ATA_MSG_SG = 6, /* SG map/unmap handling */
+ ATA_MSG_TRACE = 7, /* function tracing, e.g. enter/exit */
And test for msg_enable & (1 << (lv)). Otherwise the array will be
unnecessarily large.
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 18:09 ` Tejun Heo
@ 2006-06-29 20:53 ` Borislav Petkov
2006-06-29 21:19 ` Tejun Heo
0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2006-06-29 20:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Jeff Garzik
On Fri, Jun 30, 2006 at 03:09:16AM +0900, Tejun Heo wrote:
> Please make
>
> + ATA_MSG_ERR = 0,
> + ATA_MSG_WARN = 1,
> + ATA_MSG_DRV = 2,
> + ATA_MSG_INFO = 3, /* revalidation messages, EH progress */
> + ATA_MSG_VDEBUG = 4, /* verbose hot path */
> + ATA_MSG_CMD = 5, /* issue / completion */
> + ATA_MSG_SG = 6, /* SG map/unmap handling */
> + ATA_MSG_TRACE = 7, /* function tracing, e.g. enter/exit */
>
> And test for msg_enable & (1 << (lv)). Otherwise the array will be
> unnecessarily large.
Yeah, but this won't work:
imagine default level is:
msg_enable = ATA_MSG_INFO;
which, if done with subsequent numbers will yield 3 decimal and 0011 binary.
So if i do (1 << lv) and level is currently ATA_MSG_INFO = 3, it will
be decimal 4, and binary 0100. My msg_enable level is 0011 binary so if I do
msg_enable & (1 << lv) it will end up doing 0100 & 0011 and this is 0 although the
message levels are both INFO. In other words, with ATA_MSG_* I need the single
bits set and not consecutive numbers for the unary-and test.
Regards,
Boris.
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 20:53 ` Borislav Petkov
@ 2006-06-29 21:19 ` Tejun Heo
2006-06-29 21:22 ` Tejun Heo
0 siblings, 1 reply; 8+ messages in thread
From: Tejun Heo @ 2006-06-29 21:19 UTC (permalink / raw)
To: Borislav Petkov; +Cc: linux-ide, Jeff Garzik
Borislav Petkov wrote:
> On Fri, Jun 30, 2006 at 03:09:16AM +0900, Tejun Heo wrote:
>> Please make
>>
>> + ATA_MSG_ERR = 0,
>> + ATA_MSG_WARN = 1,
>> + ATA_MSG_DRV = 2,
>> + ATA_MSG_INFO = 3, /* revalidation messages, EH progress */
>> + ATA_MSG_VDEBUG = 4, /* verbose hot path */
>> + ATA_MSG_CMD = 5, /* issue / completion */
>> + ATA_MSG_SG = 6, /* SG map/unmap handling */
>> + ATA_MSG_TRACE = 7, /* function tracing, e.g. enter/exit */
>>
>> And test for msg_enable & (1 << (lv)). Otherwise the array will be
>> unnecessarily large.
> Yeah, but this won't work:
> imagine default level is:
> msg_enable = ATA_MSG_INFO;
You can do "msg_enable |= (1 << ATA_MSG_INFO)" or keep ATA_MSG_*'s as
bit masks and use fls() to index into level array. Just make sure that
the level array isn't 512 entries long.
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/9] libata: change debugging macros/adjust dbg levels
2006-06-29 21:19 ` Tejun Heo
@ 2006-06-29 21:22 ` Tejun Heo
0 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2006-06-29 21:22 UTC (permalink / raw)
To: Borislav Petkov; +Cc: linux-ide, Jeff Garzik
Tejun Heo wrote:
> Borislav Petkov wrote:
>> On Fri, Jun 30, 2006 at 03:09:16AM +0900, Tejun Heo wrote:
>>> Please make
>>>
>>> + ATA_MSG_ERR = 0,
>>> + ATA_MSG_WARN = 1,
>>> + ATA_MSG_DRV = 2,
>>> + ATA_MSG_INFO = 3, /* revalidation messages, EH progress */
>>> + ATA_MSG_VDEBUG = 4, /* verbose hot path */
>>> + ATA_MSG_CMD = 5, /* issue / completion */
>>> + ATA_MSG_SG = 6, /* SG map/unmap handling */
>>> + ATA_MSG_TRACE = 7, /* function tracing, e.g. enter/exit */
>>>
>>> And test for msg_enable & (1 << (lv)). Otherwise the array will be
>>> unnecessarily large.
>> Yeah, but this won't work:
>> imagine default level is:
>> msg_enable = ATA_MSG_INFO;
>
> You can do "msg_enable |= (1 << ATA_MSG_INFO)" or keep ATA_MSG_*'s as
> bit masks and use fls() to index into level array. Just make sure that
> the level array isn't 512 entries long.
>
Oh, one more thing, in libata, when specifying bit mask, we use
ATA_MSG_WARN = (1 << 1), instead of ATA_MSG_ERR = 0x02. Just a style
thing. :-)
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/9] libata: change debugging macros/adjust dbg levels
@ 2006-06-30 6:45 Borislav Petkov
0 siblings, 0 replies; 8+ messages in thread
From: Borislav Petkov @ 2006-06-30 6:45 UTC (permalink / raw)
To: linux-ide; +Cc: Jeff Garzik, Tejun Heo
change debugging macros ata_(port|dev)_printk and adjust debugging levels
Signed-off-by: <petkov@math.uni-muenster.de>
diff --git a/include/linux/libata.h b/include/linux/libata.h
index f4284bf..8c67f1e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -67,24 +67,17 @@ #define BPRINTK(fmt, args...) if (ap->fl
#define HAVE_LIBATA_MSG 1
enum {
- ATA_MSG_DRV = 0x0001,
- ATA_MSG_INFO = 0x0002,
- ATA_MSG_PROBE = 0x0004,
- ATA_MSG_WARN = 0x0008,
- ATA_MSG_MALLOC = 0x0010,
- ATA_MSG_CTL = 0x0020,
- ATA_MSG_INTR = 0x0040,
- ATA_MSG_ERR = 0x0080,
+ ATA_MSG_ERR = 0,
+ ATA_MSG_WARN = 1,
+ ATA_MSG_INFO = 2, /* revalidation messages, EH progress */
+ ATA_MSG_DEBUG = 3, /* non-frequent debug messages */
+ ATA_MSG_VDEBUG = 4, /* verbose hot path */
+ ATA_MSG_CMD = 5, /* issue / completion */
+ ATA_MSG_SG = 6, /* SG map/unmap handling */
+ ATA_MSG_TRACE = 7, /* function tracing, e.g. enter/exit */
};
-#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
-#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
-#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
-#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
-#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
-#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
-#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
-#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
+const char *__ata_msg_lvs[8];
static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
{
@@ -805,11 +798,16 @@ extern void ata_do_eh(struct ata_port *a
/*
* printk helpers
*/
-#define ata_port_printk(ap, lv, fmt, args...) \
- printk(lv"ata%u: "fmt, (ap)->id , ##args)
+#define ata_port_printk(ap, lv, fmt, args...) do { \
+ if (unlikely((ap)->msg_enable & (1 << (lv)))) \
+ printk("%sata%u: "fmt, __ata_msg_lvs[lv], (ap)->id , ##args); \
+} while (0)
-#define ata_dev_printk(dev, lv, fmt, args...) \
- printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args)
+#define ata_dev_printk(dev, lv, fmt, args...) do { \
+ if (unlikely((dev->ap)->msg_enable & (1 << (lv)))) \
+ printk("%sata%u.%02u: "fmt, __ata_msg_lvs[lv], \
+ (dev)->ap->id, (dev)->devno , ##args); \
+} while (0)
/*
* ata_eh_info helpers
@@ -997,9 +995,8 @@ static inline u8 ata_wait_idle(struct at
if (status & (ATA_BUSY | ATA_DRQ)) {
unsigned long l = ap->ioaddr.status_addr;
- if (ata_msg_warn(ap))
- printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
- status, l);
+ ata_port_printk(ap, ATA_MSG_WARN,
+ "abnormal status 0x%X on port 0x%lX\n", status, l);
}
return status;
@@ -1109,8 +1106,7 @@ static inline u8 ata_irq_ack(struct ata_
status = ata_busy_wait(ap, bits, 1000);
if (status & bits)
- if (ata_msg_err(ap))
- printk(KERN_ERR "abnormal status 0x%X\n", status);
+ ata_port_printk(ap, ATA_MSG_ERR, "abnormal status 0x%X\n", status);
/* get controller status; clear intr, err bits */
if (ap->flags & ATA_FLAG_MMIO) {
@@ -1128,10 +1124,10 @@ static inline u8 ata_irq_ack(struct ata_
post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
}
- if (ata_msg_intr(ap))
- printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
- __FUNCTION__,
- host_stat, post_stat, status);
+ ata_port_printk(ap, ATA_MSG_DEBUG,
+ "%s: irq ack: host_stat 0x%X, new host_stat 0x%X,"
+ "drv_stat 0x%X\n",
+ __FUNCTION__, host_stat, post_stat, status);
return status;
}
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-30 6:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 16:09 [PATCH 1/9] libata: change debugging macros/adjust dbg levels Borislav Petkov
2006-06-29 16:27 ` Tejun Heo
2006-06-29 17:27 ` Borislav Petkov
2006-06-29 18:09 ` Tejun Heo
2006-06-29 20:53 ` Borislav Petkov
2006-06-29 21:19 ` Tejun Heo
2006-06-29 21:22 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2006-06-30 6:45 Borislav Petkov
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).