From 535e16c8a4295b039563ad55b43403331be6dea9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 25 Nov 2012 00:05:15 +0100 Subject: qmimodem: Fix debug printing of messages --- drivers/qmimodem/qmi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index b7b6198e..566242d5 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -444,6 +444,7 @@ static void __debug_msg(const char dir, const void *buf, size_t len, const void *ptr; uint16_t offset; char strbuf[72 + 16], *str; + bool pending_print = false; if (!function || !len) return; @@ -547,17 +548,21 @@ static void __debug_msg(const char dir, const void *buf, size_t len, tlv_length); } - if (str - strbuf > 72) { + if (str - strbuf > 60) { function(strbuf, user_data); str = strbuf; str += sprintf(str, " "); - } + + pending_print = false; + } else + pending_print = true; offset += QMI_TLV_HDR_SIZE + tlv_length; } - function(strbuf, user_data); + if (pending_print) + function(strbuf, user_data); } static void __debug_device(struct qmi_device *device, -- cgit v1.2.3