aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-07-16 01:29:39 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-20 08:02:11 -0400
commitb64bbc39f2122a2276578e40144af69ef01decd4 (patch)
treebd760da68bc785490ecd31060d892eeb7123782d /drivers/ata/libata-eh.c
parent975530e8a33fdeb1ad80d82fde11d56bf9ed2760 (diff)
libata: improve EH report formatting
Requiring LLDs to format multiple error description messages properly doesn't work too well. Help LLDs a bit by making ata_ehi_push_desc() insert ", " on each invocation. __ata_ehi_push_desc() is the raw version without the automatic separator. While at it, make ehi_desc interface proper functions instead of macros. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 9aa62a0754f6..96b184ebf708 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -85,6 +85,71 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
85{ } 85{ }
86#endif /* CONFIG_PM */ 86#endif /* CONFIG_PM */
87 87
88static void __ata_ehi_pushv_desc(struct ata_eh_info *ehi, const char *fmt,
89 va_list args)
90{
91 ehi->desc_len += vscnprintf(ehi->desc + ehi->desc_len,
92 ATA_EH_DESC_LEN - ehi->desc_len,
93 fmt, args);
94}
95
96/**
97 * __ata_ehi_push_desc - push error description without adding separator
98 * @ehi: target EHI
99 * @fmt: printf format string
100 *
101 * Format string according to @fmt and append it to @ehi->desc.
102 *
103 * LOCKING:
104 * spin_lock_irqsave(host lock)
105 */
106void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
107{
108 va_list args;
109
110 va_start(args, fmt);
111 __ata_ehi_pushv_desc(ehi, fmt, args);
112 va_end(args);
113}
114
115/**
116 * ata_ehi_push_desc - push error description with separator
117 * @ehi: target EHI
118 * @fmt: printf format string
119 *
120 * Format string according to @fmt and append it to @ehi->desc.
121 * If @ehi->desc is not empty, ", " is added in-between.
122 *
123 * LOCKING:
124 * spin_lock_irqsave(host lock)
125 */
126void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
127{
128 va_list args;
129
130 if (ehi->desc_len)
131 __ata_ehi_push_desc(ehi, ", ");
132
133 va_start(args, fmt);
134 __ata_ehi_pushv_desc(ehi, fmt, args);
135 va_end(args);
136}
137
138/**
139 * ata_ehi_clear_desc - clean error description
140 * @ehi: target EHI
141 *
142 * Clear @ehi->desc.
143 *
144 * LOCKING:
145 * spin_lock_irqsave(host lock)
146 */
147void ata_ehi_clear_desc(struct ata_eh_info *ehi)
148{
149 ehi->desc[0] = '\0';
150 ehi->desc_len = 0;
151}
152
88static void ata_ering_record(struct ata_ering *ering, int is_io, 153static void ata_ering_record(struct ata_ering *ering, int is_io,
89 unsigned int err_mask) 154 unsigned int err_mask)
90{ 155{
@@ -1524,14 +1589,14 @@ static void ata_eh_report(struct ata_port *ap)
1524 ehc->i.err_mask, ap->sactive, ehc->i.serror, 1589 ehc->i.err_mask, ap->sactive, ehc->i.serror,
1525 ehc->i.action, frozen); 1590 ehc->i.action, frozen);
1526 if (desc) 1591 if (desc)
1527 ata_dev_printk(ehc->i.dev, KERN_ERR, "(%s)\n", desc); 1592 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc);
1528 } else { 1593 } else {
1529 ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x " 1594 ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x "
1530 "SAct 0x%x SErr 0x%x action 0x%x%s\n", 1595 "SAct 0x%x SErr 0x%x action 0x%x%s\n",
1531 ehc->i.err_mask, ap->sactive, ehc->i.serror, 1596 ehc->i.err_mask, ap->sactive, ehc->i.serror,
1532 ehc->i.action, frozen); 1597 ehc->i.action, frozen);
1533 if (desc) 1598 if (desc)
1534 ata_port_printk(ap, KERN_ERR, "(%s)\n", desc); 1599 ata_port_printk(ap, KERN_ERR, "%s\n", desc);
1535 } 1600 }
1536 1601
1537 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1602 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {