diff options
author | Tilman Schmidt <tilman@imap.cc> | 2006-04-11 01:55:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:50 -0400 |
commit | 01371500b245ae63f542d74140a3d8ccb74d0318 (patch) | |
tree | 8c758e86e3b6266c742b08111d53ac5bd21c0cbe /drivers/isdn/gigaset/common.c | |
parent | 714e8236e5ea9d39169761c546274ceb7eeb765f (diff) |
[PATCH] isdn4linux: Siemens Gigaset drivers: eliminate from_user argument
With Hansjoerg Lipp <hjlipp@web.de>
Eliminate the from_user argument from a debugging function, thus easing the
job of sparse.
Signed-off-by: Hansjoerg Lipp <hjlipp@web.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/common.c')
-rw-r--r-- | drivers/isdn/gigaset/common.c | 30 |
1 files changed, 7 insertions, 23 deletions
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] = { | |||
79 | EXPORT_SYMBOL_GPL(gigaset_invtab); | 79 | EXPORT_SYMBOL_GPL(gigaset_invtab); |
80 | 80 | ||
81 | void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | 81 | void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, |
82 | size_t len, const unsigned char *buf, int from_user) | 82 | size_t len, const unsigned char *buf) |
83 | { | 83 | { |
84 | unsigned char outbuf[80]; | 84 | unsigned char outbuf[80]; |
85 | unsigned char inbuf[80 - 1]; | ||
86 | unsigned char c; | 85 | unsigned char c; |
87 | size_t numin; | ||
88 | const unsigned char *in; | ||
89 | size_t space = sizeof outbuf - 1; | 86 | size_t space = sizeof outbuf - 1; |
90 | unsigned char *out = outbuf; | 87 | unsigned char *out = outbuf; |
88 | size_t numin = len; | ||
91 | 89 | ||
92 | if (!from_user) { | 90 | while (numin--) { |
93 | in = buf; | ||
94 | numin = len; | ||
95 | } else { | ||
96 | numin = len < sizeof inbuf ? len : sizeof inbuf; | ||
97 | in = inbuf; | ||
98 | if (copy_from_user(inbuf, (const unsigned char __user *) buf, | ||
99 | numin)) { | ||
100 | gig_dbg(level, "%s (%u bytes) - copy_from_user failed", | ||
101 | msg, (unsigned) len); | ||
102 | return; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | while (numin-- > 0) { | ||
107 | c = *buf++; | 91 | c = *buf++; |
108 | if (c == '~' || c == '^' || c == '\\') { | 92 | if (c == '~' || c == '^' || c == '\\') { |
109 | if (space-- <= 0) | 93 | if (!space--) |
110 | break; | 94 | break; |
111 | *out++ = '\\'; | 95 | *out++ = '\\'; |
112 | } | 96 | } |
113 | if (c & 0x80) { | 97 | if (c & 0x80) { |
114 | if (space-- <= 0) | 98 | if (!space--) |
115 | break; | 99 | break; |
116 | *out++ = '~'; | 100 | *out++ = '~'; |
117 | c ^= 0x80; | 101 | c ^= 0x80; |
118 | } | 102 | } |
119 | if (c < 0x20 || c == 0x7f) { | 103 | if (c < 0x20 || c == 0x7f) { |
120 | if (space-- <= 0) | 104 | if (!space--) |
121 | break; | 105 | break; |
122 | *out++ = '^'; | 106 | *out++ = '^'; |
123 | c ^= 0x40; | 107 | c ^= 0x40; |
124 | } | 108 | } |
125 | if (space-- <= 0) | 109 | if (!space--) |
126 | break; | 110 | break; |
127 | *out++ = c; | 111 | *out++ = c; |
128 | } | 112 | } |