]> err.no Git - linux-2.6/commitdiff
[PATCH] isdn4linux: Siemens Gigaset drivers: eliminate from_user argument
authorTilman Schmidt <tilman@imap.cc>
Tue, 11 Apr 2006 05:55:11 +0000 (22:55 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 11 Apr 2006 13:18:50 +0000 (06:18 -0700)
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>
drivers/isdn/gigaset/asyncdata.c
drivers/isdn/gigaset/bas-gigaset.c
drivers/isdn/gigaset/common.c
drivers/isdn/gigaset/gigaset.h
drivers/isdn/gigaset/interface.c
drivers/isdn/gigaset/isocdata.c
drivers/isdn/gigaset/usb-gigaset.c

index 8601b7a8f6a6bfb83f995778c42eb1f954fb6771..4f5dd9cf9e1bd1920f6944e3f9d367a80cd7697b 100644 (file)
@@ -98,7 +98,7 @@ static inline int lock_loop(unsigned char *src, int numbytes,
        struct cardstate *cs = inbuf->cs;
 
        gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
-                          numbytes, src, 0);
+                          numbytes, src);
        gigaset_if_receive(cs, src, numbytes);
 
        return numbytes;
index b75f2f37c3555606ddce60d625f9c1c57970e3ae..8cfd518631366f6109d565522d2770ee9e61a92b 100644 (file)
@@ -1756,7 +1756,7 @@ static int gigaset_write_cmd(struct cardstate *cs,
 
        gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
                             DEBUG_TRANSCMD : DEBUG_LOCKCMD,
-                          "CMD Transmit", len, buf, 0);
+                          "CMD Transmit", len, buf);
 
        if (unlikely(!atomic_read(&cs->connected))) {
                err("%s: disconnected", __func__);
index 5155c5b07a064834245500c4d7aeed6f3f33679d..e9bfcfd9f1168249828a79da64e3dcab1d6fdeec 100644 (file)
@@ -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;
        }
index 446a078224a91235353329a2ea3096c96c0d985d..7a44caca8a17d9034b24140defb1c7381a3e3a64 100644 (file)
@@ -154,7 +154,7 @@ enum debuglevel { /* up to 24 bits (atomic_t) */
 #endif
 
 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);
 
 /* connection state */
 #define ZSAU_NONE                      0
index f3dce8c4831b5933161134b44b90de5bcd900cfc..25750864d206be390d65f6c1799ca4c69fce42e2 100644 (file)
@@ -246,8 +246,6 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
                        break;
                case GIGASET_BRKCHARS:
                        //FIXME test if MS_LOCKED
-                       gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
-                                          6, (const unsigned char *) arg, 1);
                        if (!atomic_read(&cs->connected)) {
                                gig_dbg(DEBUG_ANY,
                                    "can't communicate with unplugged device");
@@ -257,8 +255,11 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
                        retval = copy_from_user(&buf,
                                        (const unsigned char __user *) arg, 6)
                                ? -EFAULT : 0;
-                       if (retval >= 0)
+                       if (retval >= 0) {
+                               gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
+                                               6, (const unsigned char *) arg);
                                retval = cs->ops->brkchars(cs, buf);
+                       }
                        break;
                case GIGASET_VERSION:
                        retval = copy_from_user(version,
index 0b7e5b610cc944e04d4631084c61839e95c7bffd..5f2f47fdc045f12c0059e081867ba2ff357a78fd 100644 (file)
@@ -957,11 +957,11 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
 
                if (atomic_read(&cs->mstate) == MS_LOCKED) {
                        gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
-                                          numbytes, src, 0);
+                                          numbytes, src);
                        gigaset_if_receive(inbuf->cs, src, numbytes);
                } else {
                        gigaset_dbg_buffer(DEBUG_CMD, "received response",
-                                          numbytes, src, 0);
+                                          numbytes, src);
                        cmd_loop(src, numbytes, inbuf);
                }
 
index e1a3eeb3c21a8e0eaad253b0216beefff3f29e6f..6ae5df5f2b6adfb4a15c741a5cc78bc7d46d0dad 100644 (file)
@@ -500,7 +500,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
 
        gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
                             DEBUG_TRANSCMD : DEBUG_LOCKCMD,
-                          "CMD Transmit", len, buf, 0);
+                          "CMD Transmit", len, buf);
 
        if (!atomic_read(&cs->connected)) {
                err("%s: not connected", __func__);
@@ -559,7 +559,7 @@ static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6])
 #ifdef CONFIG_GIGASET_UNDOCREQ
        struct usb_device *udev = cs->hw.usb->udev;
 
-       gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf, 0);
+       gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf);
        memcpy(cs->hw.usb->bchars, buf, 6);
        return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41,
                               0, 0, &buf, 6, 2000);