On Tue, Feb 15, 2011 at 4:44 PM, Russell King - ARM Linux
[off-list ref] wrote:
On Tue, Feb 15, 2011 at 04:36:26PM +0200, David Cohen wrote:
quoted
But pr_cont() would be wrong in case of DEBUG isn't set, isn't it?
Yes. ?One other solution you could do is:
? ? ? ?char buf[80], *p = buf;
? ? ? ?buf[0] = '\0';
? ? ? ?for (i = 0; i < ARRAY_SIZE(err_msg); i++)
? ? ? ? ? ? ? ?if (stat & (1 << i))
? ? ? ? ? ? ? ? ? ? ? ?p += scnprintf(p, sizeof(buf) - (p - buf),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?" %s", err_msg[i]);
? ? ? ?dev_dbg(obj->dev, "%s: da:%08x%s\n", __func__, da, buf);
which means that you're then printing the entire string in one go -
and there's no chance for another message to come in the middle of it.
Note that I've placed the ' ' at the beginning of the format string so
that we don't end up with useless trailing space in messages. ?Minor
point but it's easy to do here.
That could be my choice.
I'm not planing to resend this patch, but how good/bad it sounds to
you to have dev_dbg_cont() for such situation?
Br,
David