s390/qdio: fix truncated debug output of hex values
authorJan Glauber <jang@linux.vnet.ibm.com>
Tue, 11 Sep 2012 11:42:06 +0000 (13:42 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 26 Sep 2012 13:45:18 +0000 (15:45 +0200)
Calling debug_event the s390 debug feature only logs up to buf_size
bytes of the debug view. If debug_event is called with more bytes
than buf_size the additional data is ignored and not logged in the
debug view.

Use multiple calls to debug_event if the length exceeds buf_size.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/qdio_debug.h

index e1f6468..7f8b973 100644 (file)
@@ -37,10 +37,14 @@ static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
                debug_text_event(qdio_dbf_setup, DBF_ERR, debug_buffer); \
        } while (0)
 
-#define DBF_HEX(addr, len) \
-       do { \
-               debug_event(qdio_dbf_setup, DBF_ERR, (void*)(addr), len); \
-       } while (0)
+static inline void DBF_HEX(void *addr, int len)
+{
+       while (len > 0) {
+               debug_event(qdio_dbf_setup, DBF_ERR, addr, len);
+               len -= qdio_dbf_setup->buf_size;
+               addr += qdio_dbf_setup->buf_size;
+       }
+}
 
 #define DBF_ERROR(text...) \
        do { \
@@ -49,11 +53,14 @@ static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
                debug_text_event(qdio_dbf_error, DBF_ERR, debug_buffer); \
        } while (0)
 
-#define DBF_ERROR_HEX(addr, len) \
-       do { \
-               debug_event(qdio_dbf_error, DBF_ERR, (void*)(addr), len); \
-       } while (0)
-
+static inline void DBF_ERROR_HEX(void *addr, int len)
+{
+       while (len > 0) {
+               debug_event(qdio_dbf_error, DBF_ERR, addr, len);
+               len -= qdio_dbf_error->buf_size;
+               addr += qdio_dbf_error->buf_size;
+       }
+}
 
 #define DBF_DEV_EVENT(level, device, text...) \
        do { \
@@ -64,10 +71,15 @@ static inline int qdio_dbf_passes(debug_info_t *dbf_grp, int level)
                } \
        } while (0)
 
-#define DBF_DEV_HEX(level, device, addr, len) \
-       do { \
-               debug_event(device->debug_area, level, (void*)(addr), len); \
-       } while (0)
+static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr,
+                              int len, int level)
+{
+       while (len > 0) {
+               debug_event(dev->debug_area, level, addr, len);
+               len -= dev->debug_area->buf_size;
+               addr += dev->debug_area->buf_size;
+       }
+}
 
 void qdio_allocate_dbf(struct qdio_initialize *init_data,
                       struct qdio_irq *irq_ptr);