* [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer()
@ 2016-10-22 17:37 Andy Shevchenko
2016-10-26 21:27 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:37 UTC (permalink / raw)
To: Armin Schindler, netdev, Karsten Keil; +Cc: Andy Shevchenko
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer()
2016-10-22 17:37 [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer() Andy Shevchenko
@ 2016-10-26 21:27 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-10-26 21:27 UTC (permalink / raw)
To: andriy.shevchenko; +Cc: mac, netdev, isdn
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sat, 22 Oct 2016 20:37:05 +0300
> 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>
This adds a warning.
Really, if you're not even going to check if the compiler warns
when you try to "clean up" such ancient drivers like this one,
don't even bother.
drivers/isdn/hardware/eicon/message.c: In function ‘dump_c_ind_mask’:
drivers/isdn/hardware/eicon/message.c:1156:22: warning: passing argument 1 of ‘hex_dump_to_buffer’ makes pointer from integer without a cast [-Wint-conversion]
hex_dump_to_buffer(plci->c_ind_mask_table[i], j, 16, 4, buf, sizeof(buf), false);
^~~~
In file included from ./include/linux/kernel.h:13:0,
from ./include/linux/list.h:8,
from ./include/linux/module.h:9,
from drivers/isdn/hardware/eicon/platform.h:21,
from drivers/isdn/hardware/eicon/message.c:30:
./include/linux/printk.h:457:12: note: expected ‘const void *’ but argument is of type ‘u32 {aka unsigned int}’
extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
^~~~~~~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-26 21:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-22 17:37 [PATCH v1 1/1] ISDN: eicon: replace custom hex_dump_to_buffer() Andy Shevchenko
2016-10-26 21:27 ` David Miller
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).