From 01371500b245ae63f542d74140a3d8ccb74d0318 Mon Sep 17 00:00:00 2001 From: Tilman Schmidt Date: Mon, 10 Apr 2006 22:55:11 -0700 Subject: [PATCH] isdn4linux: Siemens Gigaset drivers: eliminate from_user argument With Hansjoerg Lipp Eliminate the from_user argument from a debugging function, thus easing the job of sparse. Signed-off-by: Hansjoerg Lipp Signed-off-by: Tilman Schmidt Cc: Karsten Keil Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/isdn/gigaset/common.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'drivers/isdn/gigaset/common.c') diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 5155c5b07a06..e9bfcfd9f116 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -79,50 +79,34 @@ __u8 gigaset_invtab[256] = { EXPORT_SYMBOL_GPL(gigaset_invtab); void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, - size_t len, const unsigned char *buf, int from_user) + size_t len, const unsigned char *buf) { unsigned char outbuf[80]; - unsigned char inbuf[80 - 1]; unsigned char c; - size_t numin; - const unsigned char *in; size_t space = sizeof outbuf - 1; unsigned char *out = outbuf; + size_t numin = len; - if (!from_user) { - in = buf; - numin = len; - } else { - numin = len < sizeof inbuf ? len : sizeof inbuf; - in = inbuf; - if (copy_from_user(inbuf, (const unsigned char __user *) buf, - numin)) { - gig_dbg(level, "%s (%u bytes) - copy_from_user failed", - msg, (unsigned) len); - return; - } - } - - while (numin-- > 0) { + while (numin--) { c = *buf++; if (c == '~' || c == '^' || c == '\\') { - if (space-- <= 0) + if (!space--) break; *out++ = '\\'; } if (c & 0x80) { - if (space-- <= 0) + if (!space--) break; *out++ = '~'; c ^= 0x80; } if (c < 0x20 || c == 0x7f) { - if (space-- <= 0) + if (!space--) break; *out++ = '^'; c ^= 0x40; } - if (space-- <= 0) + if (!space--) break; *out++ = c; } -- cgit v1.2.3