From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Armin Schindler <mac@melware.de>,
netdev@vger.kernel.org, Karsten Keil <isdn@linux-pingi.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer()
Date: Sat, 22 Oct 2016 20:37:05 +0300 [thread overview]
Message-ID: <20161022173705.170520-1-andriy.shevchenko@linux.intel.com> (raw)
Instead of custom approach re-use generic helper to convert bytes to hex
format.
The output is slightly changed, namely string starts from the first dword
value.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/isdn/hardware/eicon/message.c | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 1a1d997..8684899 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1147,45 +1147,19 @@ static byte test_c_ind_mask_bit(PLCI *plci, word b)
static void dump_c_ind_mask(PLCI *plci)
{
- word i, j, k;
- dword d;
- char *p;
+ word i, j;
char buf[40];
for (i = 0; i < C_IND_MASK_DWORDS; i += 4)
{
- p = buf + 36;
- *p = '\0';
- for (j = 0; j < 4; j++)
- {
- if (i + j < C_IND_MASK_DWORDS)
- {
- d = plci->c_ind_mask_table[i + j];
- for (k = 0; k < 8; k++)
- {
- *(--p) = hex_asc_lo(d);
- d >>= 4;
- }
- }
- else if (i != 0)
- {
- for (k = 0; k < 8; k++)
- *(--p) = ' ';
- }
- *(--p) = ' ';
- }
- dbug(1, dprintf("c_ind_mask =%s", (char *) p));
+ j = min_t(word, C_IND_MASK_DWORDS - i, 4) * 4;
+ hex_dump_to_buffer(plci->c_ind_mask_table[i], j, 16, 4, buf, sizeof(buf), false);
+ dbug(1, dprintf("c_ind_mask =%s", buf));
}
}
-
-
-
-
#define dump_plcis(a)
-
-
/*------------------------------------------------------------------*/
/* translation function for each message */
/*------------------------------------------------------------------*/
--
2.9.3
next reply other threads:[~2016-10-22 17:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-22 17:37 Andy Shevchenko [this message]
2016-10-26 21:27 ` [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161022173705.170520-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=isdn@linux-pingi.de \
--cc=mac@melware.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).