Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01371500 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds
Browse files

[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: default avatarHansjoerg Lipp <hjlipp@web.de>
Signed-off-by: default avatarTilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 714e8236
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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__);
+7 −23
Original line number Diff line number Diff line
@@ -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;
	}
+1 −1
Original line number Diff line number Diff line
@@ -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
+4 −3
Original line number Diff line number Diff line
@@ -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,
Loading