aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:11 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:50 -0400
commit01371500b245ae63f542d74140a3d8ccb74d0318 (patch)
tree8c758e86e3b6266c742b08111d53ac5bd21c0cbe /drivers
parent714e8236e5ea9d39169761c546274ceb7eeb765f (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')
-rw-r--r--drivers/isdn/gigaset/asyncdata.c2
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c2
-rw-r--r--drivers/isdn/gigaset/common.c30
-rw-r--r--drivers/isdn/gigaset/gigaset.h2
-rw-r--r--drivers/isdn/gigaset/interface.c7
-rw-r--r--drivers/isdn/gigaset/isocdata.c4
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
7 files changed, 18 insertions, 33 deletions
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index 8601b7a8f6a6..4f5dd9cf9e1b 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -98,7 +98,7 @@ static inline int lock_loop(unsigned char *src, int numbytes,
98 struct cardstate *cs = inbuf->cs; 98 struct cardstate *cs = inbuf->cs;
99 99
100 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", 100 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
101 numbytes, src, 0); 101 numbytes, src);
102 gigaset_if_receive(cs, src, numbytes); 102 gigaset_if_receive(cs, src, numbytes);
103 103
104 return numbytes; 104 return numbytes;
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index b75f2f37c355..8cfd51863136 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -1756,7 +1756,7 @@ static int gigaset_write_cmd(struct cardstate *cs,
1756 1756
1757 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? 1757 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
1758 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 1758 DEBUG_TRANSCMD : DEBUG_LOCKCMD,
1759 "CMD Transmit", len, buf, 0); 1759 "CMD Transmit", len, buf);
1760 1760
1761 if (unlikely(!atomic_read(&cs->connected))) { 1761 if (unlikely(!atomic_read(&cs->connected))) {
1762 err("%s: disconnected", __func__); 1762 err("%s: disconnected", __func__);
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] = {
79EXPORT_SYMBOL_GPL(gigaset_invtab); 79EXPORT_SYMBOL_GPL(gigaset_invtab);
80 80
81void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, 81void 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 }
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 446a078224a9..7a44caca8a17 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -154,7 +154,7 @@ enum debuglevel { /* up to 24 bits (atomic_t) */
154#endif 154#endif
155 155
156void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, 156void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
157 size_t len, const unsigned char *buf, int from_user); 157 size_t len, const unsigned char *buf);
158 158
159/* connection state */ 159/* connection state */
160#define ZSAU_NONE 0 160#define ZSAU_NONE 0
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index f3dce8c4831b..25750864d206 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -246,8 +246,6 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
246 break; 246 break;
247 case GIGASET_BRKCHARS: 247 case GIGASET_BRKCHARS:
248 //FIXME test if MS_LOCKED 248 //FIXME test if MS_LOCKED
249 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
250 6, (const unsigned char *) arg, 1);
251 if (!atomic_read(&cs->connected)) { 249 if (!atomic_read(&cs->connected)) {
252 gig_dbg(DEBUG_ANY, 250 gig_dbg(DEBUG_ANY,
253 "can't communicate with unplugged device"); 251 "can't communicate with unplugged device");
@@ -257,8 +255,11 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
257 retval = copy_from_user(&buf, 255 retval = copy_from_user(&buf,
258 (const unsigned char __user *) arg, 6) 256 (const unsigned char __user *) arg, 6)
259 ? -EFAULT : 0; 257 ? -EFAULT : 0;
260 if (retval >= 0) 258 if (retval >= 0) {
259 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
260 6, (const unsigned char *) arg);
261 retval = cs->ops->brkchars(cs, buf); 261 retval = cs->ops->brkchars(cs, buf);
262 }
262 break; 263 break;
263 case GIGASET_VERSION: 264 case GIGASET_VERSION:
264 retval = copy_from_user(version, 265 retval = copy_from_user(version,
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 0b7e5b610cc9..5f2f47fdc045 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -957,11 +957,11 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
957 957
958 if (atomic_read(&cs->mstate) == MS_LOCKED) { 958 if (atomic_read(&cs->mstate) == MS_LOCKED) {
959 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", 959 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
960 numbytes, src, 0); 960 numbytes, src);
961 gigaset_if_receive(inbuf->cs, src, numbytes); 961 gigaset_if_receive(inbuf->cs, src, numbytes);
962 } else { 962 } else {
963 gigaset_dbg_buffer(DEBUG_CMD, "received response", 963 gigaset_dbg_buffer(DEBUG_CMD, "received response",
964 numbytes, src, 0); 964 numbytes, src);
965 cmd_loop(src, numbytes, inbuf); 965 cmd_loop(src, numbytes, inbuf);
966 } 966 }
967 967
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index e1a3eeb3c21a..6ae5df5f2b6a 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -500,7 +500,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
500 500
501 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? 501 gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
502 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 502 DEBUG_TRANSCMD : DEBUG_LOCKCMD,
503 "CMD Transmit", len, buf, 0); 503 "CMD Transmit", len, buf);
504 504
505 if (!atomic_read(&cs->connected)) { 505 if (!atomic_read(&cs->connected)) {
506 err("%s: not connected", __func__); 506 err("%s: not connected", __func__);
@@ -559,7 +559,7 @@ static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6])
559#ifdef CONFIG_GIGASET_UNDOCREQ 559#ifdef CONFIG_GIGASET_UNDOCREQ
560 struct usb_device *udev = cs->hw.usb->udev; 560 struct usb_device *udev = cs->hw.usb->udev;
561 561
562 gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf, 0); 562 gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf);
563 memcpy(cs->hw.usb->bchars, buf, 6); 563 memcpy(cs->hw.usb->bchars, buf, 6);
564 return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41, 564 return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41,
565 0, 0, &buf, 6, 2000); 565 0, 0, &buf, 6, 2000);