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

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

[PATCH] isdn4linux: Siemens Gigaset drivers: logging usage



With Hansjoerg Lipp <hjlipp@web.de>

Improve error reporting of the Gigaset drivers, by using the
dev_err/dev_warn/dev_info macros from device.h instead of err/warn/info from
usb.h whereever possible.

Also rename the private dbg macro to gig_dbg in order to avoid confusion with
the macro of the same name in usb.h.

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 ec81b5e6
Loading
Loading
Loading
Loading
+43 −37
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
	for (;;) {
		cs->respdata[cbytes] = c;
		if (c == 10 || c == 13) {
			dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
			gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
				__func__, cbytes);
			cs->cbytes = cbytes;
			gigaset_handle_modem_response(cs); /* can change
@@ -68,7 +68,7 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
			if (cbytes < MAX_RESP_SIZE - 1)
				cbytes++;
			else
				warn("response too large");
				dev_warn(cs->dev, "response too large\n");
		}

		if (!numbytes)
@@ -154,39 +154,37 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
			c ^= PPP_TRANS;
#ifdef CONFIG_GIGASET_DEBUG
			if (unlikely(!muststuff(c)))
				dbg(DEBUG_HDLC,
				    "byte stuffed: 0x%02x", c);
				gig_dbg(DEBUG_HDLC, "byte stuffed: 0x%02x", c);
#endif
		} else if (unlikely(c == PPP_FLAG)) {
			if (unlikely(inputstate & INS_skip_frame)) {
				if (!(inputstate & INS_have_data)) { /* 7E 7E */
					//dbg(DEBUG_HDLC, "(7e)7e------------------------");
#ifdef CONFIG_GIGASET_DEBUG
					++bcs->emptycount;
#endif
				} else
					dbg(DEBUG_HDLC,
					gig_dbg(DEBUG_HDLC,
					    "7e----------------------------");

				/* end of frame */
				error = 1;
				gigaset_rcv_error(NULL, cs, bcs);
			} else if (!(inputstate & INS_have_data)) { /* 7E 7E */
				//dbg(DEBUG_HDLC, "(7e)7e------------------------");
#ifdef CONFIG_GIGASET_DEBUG
				++bcs->emptycount;
#endif
				break;
			} else {
				dbg(DEBUG_HDLC,
				gig_dbg(DEBUG_HDLC,
					"7e----------------------------");

				/* end of frame */
				error = 0;

				if (unlikely(fcs != PPP_GOODFCS)) {
					err("Packet checksum at %lu failed, "
					    "packet is corrupted (%u bytes)!",
					dev_err(cs->dev,
					    "Packet checksum at %lu failed, "
					    "packet is corrupted (%u bytes)!\n",
					    bcs->rcvbytes, skb->len);
					compskb = NULL;
					gigaset_rcv_error(compskb, cs, bcs);
@@ -200,9 +198,11 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
						skb = NULL;
						inputstate |= INS_skip_frame;
						if (l == 1) {
							err("invalid packet size (1)!");
							dev_err(cs->dev,
						  "invalid packet size (1)!\n");
							error = 1;
							gigaset_rcv_error(NULL, cs, bcs);
							gigaset_rcv_error(NULL,
								cs, bcs);
						}
					}
					if (likely(!(error ||
@@ -225,7 +225,8 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
			} else if (likely((skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)) {
				skb_reserve(skb, HW_HDR_LEN);
			} else {
				warn("could not allocate new skb");
				dev_warn(cs->dev,
					 "could not allocate new skb\n");
				inputstate |= INS_skip_frame;
			}

@@ -233,7 +234,7 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
#ifdef CONFIG_GIGASET_DEBUG
		} else if (unlikely(muststuff(c))) {
			/* Should not happen. Possible after ZDLE=1<CR><LF>. */
			dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
			gig_dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
#endif
		}

@@ -241,8 +242,8 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,

#ifdef CONFIG_GIGASET_DEBUG
		if (unlikely(!(inputstate & INS_have_data))) {
			dbg(DEBUG_HDLC,
			    "7e (%d x) ================", bcs->emptycount);
			gig_dbg(DEBUG_HDLC, "7e (%d x) ================",
				bcs->emptycount);
			bcs->emptycount = 0;
		}
#endif
@@ -251,7 +252,7 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,

		if (likely(!(inputstate & INS_skip_frame))) {
			if (unlikely(skb->len == SBUFSIZE)) {
				warn("received packet too long");
				dev_warn(cs->dev, "received packet too long\n");
				dev_kfree_skb_any(skb);
				skb = NULL;
				inputstate |= INS_skip_frame;
@@ -307,7 +308,7 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
		if (likely(!(inputstate & INS_skip_frame))) {
			if (unlikely(skb->len == SBUFSIZE)) {
				//FIXME just pass skb up and allocate a new one
				warn("received packet too long");
				dev_warn(cs->dev, "received packet too long\n");
				dev_kfree_skb_any(skb);
				skb = NULL;
				inputstate |= INS_skip_frame;
@@ -341,7 +342,7 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
				  != NULL)) {
			skb_reserve(skb, HW_HDR_LEN);
		} else {
			warn("could not allocate new skb");
			dev_warn(cs->dev, "could not allocate new skb\n");
			inputstate |= INS_skip_frame;
		}
	}
@@ -362,13 +363,13 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)

	head = atomic_read(&inbuf->head);
	tail = atomic_read(&inbuf->tail);
	dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
	gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);

	if (head != tail) {
		cs = inbuf->cs;
		src = inbuf->data + head;
		numbytes = (head > tail ? RBUFSIZE : tail) - head;
		dbg(DEBUG_INTR, "processing %u bytes", numbytes);
		gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);

		while (numbytes) {
			if (atomic_read(&cs->mstate) == MS_LOCKED) {
@@ -400,13 +401,14 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)

					src += procbytes;
					numbytes -= procbytes;
				} else {  /* DLE-char */
				} else {  /* DLE char */
					inbuf->inputstate &= ~INS_DLE_char;
					switch (c) {
					case 'X': /*begin of command*/
#ifdef CONFIG_GIGASET_DEBUG
						if (inbuf->inputstate & INS_command)
							err("received <DLE> 'X' in command mode");
							dev_err(cs->dev,
					"received <DLE> 'X' in command mode\n");
#endif
						inbuf->inputstate |=
							INS_command | INS_DLE_command;
@@ -414,7 +416,8 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
					case '.': /*end of command*/
#ifdef CONFIG_GIGASET_DEBUG
						if (!(inbuf->inputstate & INS_command))
							err("received <DLE> '.' in hdlc mode");
							dev_err(cs->dev,
					"received <DLE> '.' in hdlc mode\n");
#endif
						inbuf->inputstate &= cs->dle ?
							~(INS_DLE_command|INS_command)
@@ -422,7 +425,9 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
						break;
					//case DLE_FLAG: /*DLE_FLAG in data stream*/ /* schon oben behandelt! */
					default:
						err("received 0x10 0x%02x!", (int) c);
						dev_err(cs->dev,
						      "received 0x10 0x%02x!\n",
							(int) c);
						/* FIXME: reset driver?? */
					}
				}
@@ -441,7 +446,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
			}
		}

		dbg(DEBUG_INTR, "setting head to %u", head);
		gig_dbg(DEBUG_INTR, "setting head to %u", head);
		atomic_set(&inbuf->head, head);
	}
}
@@ -483,7 +488,6 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb, int head, int tail)
	 */
	hdlc_skb = dev_alloc_skb(skb->len + stuf_cnt + 6 + tail + head);
	if (!hdlc_skb) {
		err("unable to allocate memory for HDLC encoding!");
		dev_kfree_skb(skb);
		return NULL;
	}
@@ -543,7 +547,6 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
	/* worst case: every byte must be stuffed */
	iraw_skb = dev_alloc_skb(2*skb->len + tail + head);
	if (!iraw_skb) {
		err("unable to allocate memory for HDLC encoding!");
		dev_kfree_skb(skb);
		return NULL;
	}
@@ -584,8 +587,11 @@ int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
		skb = HDLC_Encode(skb, HW_HDR_LEN, 0);
	else
		skb = iraw_encode(skb, HW_HDR_LEN, 0);
	if (!skb)
	if (!skb) {
		dev_err(bcs->cs->dev,
			"unable to allocate memory for encoding!\n");
		return -ENOMEM;
	}

	skb_queue_tail(&bcs->squeue, skb);
	tasklet_schedule(&bcs->cs->write_tasklet);
+339 −272

File changed.

Preview size limit exceeded, changes collapsed.

+105 −92
Original line number Diff line number Diff line
@@ -32,9 +32,6 @@ MODULE_PARM_DESC(debug, "debug level");
  Prototypes of internal functions
 */

//static void gigaset_process_response(int resp_code, int parameter,
//                                     struct at_state_t *at_state,
//                                     unsigned char ** pstring);
static struct cardstate *alloc_cs(struct gigaset_driver *drv);
static void free_cs(struct cardstate *cs);
static void make_valid(struct cardstate *cs, unsigned mask);
@@ -86,6 +83,7 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
{
	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;
@@ -99,26 +97,38 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
		in = inbuf;
		if (copy_from_user(inbuf, (const unsigned char __user *) buf,
				   numin)) {
			strncpy(inbuf, "<FAULT>", sizeof inbuf);
			numin = sizeof "<FAULT>" - 1;
			gig_dbg(level, "%s (%u bytes) - copy_from_user failed",
				msg, (unsigned) len);
			return;
		}
	}

	for (; numin && space; --numin, ++in) {
		--space;
		if (*in >= 32)
			*out++ = *in;
		else {
			*out++ = '^';
			if (space) {
				*out++ = '@' + *in;
				--space;
	while (numin-- > 0) {
		c = *buf++;
		if (c == '~' || c == '^' || c == '\\') {
			if (space-- <= 0)
				break;
			*out++ = '\\';
		}
		if (c & 0x80) {
			if (space-- <= 0)
				break;
			*out++ = '~';
			c ^= 0x80;
		}
		if (c < 0x20 || c == 0x7f) {
			if (space-- <= 0)
				break;
			*out++ = '^';
			c ^= 0x40;
		}
		if (space-- <= 0)
			break;
		*out++ = c;
	}
	*out = 0;

	dbg(level, "%s (%u bytes): %s", msg, (unsigned) len, outbuf);
	gig_dbg(level, "%s (%u bytes): %s", msg, (unsigned) len, outbuf);
}
EXPORT_SYMBOL_GPL(gigaset_dbg_buffer);

@@ -171,7 +181,7 @@ int gigaset_enterconfigmode(struct cardstate *cs)
	return 0;

error:
	err("error %d on setuartbits!\n", -r);
	dev_err(cs->dev, "error %d on setuartbits\n", -r);
	cs->control_state = TIOCM_RTS|TIOCM_DTR; // FIXME is this a good value?
	cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR);

@@ -184,7 +194,7 @@ static int test_timeout(struct at_state_t *at_state)
		return 0;

	if (--at_state->timer_expires) {
		dbg(DEBUG_MCMD, "decreased timer of %p to %lu",
		gig_dbg(DEBUG_MCMD, "decreased timer of %p to %lu",
			at_state, at_state->timer_expires);
		return 0;
	}
@@ -221,7 +231,7 @@ static void timer_tick(unsigned long data)
	if (atomic_read(&cs->running)) {
		mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK));
		if (timeout) {
			dbg(DEBUG_CMD, "scheduling timeout");
			gig_dbg(DEBUG_CMD, "scheduling timeout");
			tasklet_schedule(&cs->event_tasklet);
		}
	}
@@ -235,13 +245,14 @@ int gigaset_get_channel(struct bc_state *bcs)

	spin_lock_irqsave(&bcs->cs->lock, flags);
	if (bcs->use_count) {
		dbg(DEBUG_ANY, "could not allocate channel %d", bcs->channel);
		gig_dbg(DEBUG_ANY, "could not allocate channel %d",
			bcs->channel);
		spin_unlock_irqrestore(&bcs->cs->lock, flags);
		return 0;
	}
	++bcs->use_count;
	bcs->busy = 1;
	dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
	gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
	spin_unlock_irqrestore(&bcs->cs->lock, flags);
	return 1;
}
@@ -252,13 +263,13 @@ void gigaset_free_channel(struct bc_state *bcs)

	spin_lock_irqsave(&bcs->cs->lock, flags);
	if (!bcs->busy) {
		dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
		gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
		spin_unlock_irqrestore(&bcs->cs->lock, flags);
		return;
	}
	--bcs->use_count;
	bcs->busy = 0;
	dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
	gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
	spin_unlock_irqrestore(&bcs->cs->lock, flags);
}

@@ -271,14 +282,14 @@ int gigaset_get_channels(struct cardstate *cs)
	for (i = 0; i < cs->channels; ++i)
		if (cs->bcs[i].use_count) {
			spin_unlock_irqrestore(&cs->lock, flags);
			dbg(DEBUG_ANY, "could not allocated all channels");
			gig_dbg(DEBUG_ANY, "could not allocate all channels");
			return 0;
		}
	for (i = 0; i < cs->channels; ++i)
		++cs->bcs[i].use_count;
	spin_unlock_irqrestore(&cs->lock, flags);

	dbg(DEBUG_ANY, "allocated all channels");
	gig_dbg(DEBUG_ANY, "allocated all channels");

	return 1;
}
@@ -288,7 +299,7 @@ void gigaset_free_channels(struct cardstate *cs)
	unsigned long flags;
	int i;

	dbg(DEBUG_ANY, "unblocking all channels");
	gig_dbg(DEBUG_ANY, "unblocking all channels");
	spin_lock_irqsave(&cs->lock, flags);
	for (i = 0; i < cs->channels; ++i)
		--cs->bcs[i].use_count;
@@ -300,7 +311,7 @@ void gigaset_block_channels(struct cardstate *cs)
	unsigned long flags;
	int i;

	dbg(DEBUG_ANY, "blocking all channels");
	gig_dbg(DEBUG_ANY, "blocking all channels");
	spin_lock_irqsave(&cs->lock, flags);
	for (i = 0; i < cs->channels; ++i)
		++cs->bcs[i].use_count;
@@ -388,14 +399,14 @@ static void gigaset_freebcs(struct bc_state *bcs)
{
	int i;

	dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
	gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
	if (!bcs->cs->ops->freebcshw(bcs)) {
		dbg(DEBUG_INIT, "failed");
		gig_dbg(DEBUG_INIT, "failed");
	}

	dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
	gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
	clear_at_state(&bcs->at_state);
	dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
	gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);

	if (bcs->skb)
		dev_kfree_skb(bcs->skb);
@@ -432,7 +443,7 @@ void gigaset_freecs(struct cardstate *cs)
	default:
		gigaset_if_free(cs);

		dbg(DEBUG_INIT, "clearing hw");
		gig_dbg(DEBUG_INIT, "clearing hw");
		cs->ops->freecshw(cs);

		//FIXME cmdbuf
@@ -441,29 +452,29 @@ void gigaset_freecs(struct cardstate *cs)
	case 2: /* error in initcshw */
		/* Deregister from LL */
		make_invalid(cs, VALID_ID);
		dbg(DEBUG_INIT, "clearing iif");
		gig_dbg(DEBUG_INIT, "clearing iif");
		gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);

		/* fall through */
	case 1: /* error when regestering to LL */
		dbg(DEBUG_INIT, "clearing at_state");
		gig_dbg(DEBUG_INIT, "clearing at_state");
		clear_at_state(&cs->at_state);
		dealloc_at_states(cs);

		/* fall through */
	case 0: /* error in one call to initbcs */
		for (i = 0; i < cs->channels; ++i) {
			dbg(DEBUG_INIT, "clearing bcs[%d]", i);
			gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
			gigaset_freebcs(cs->bcs + i);
		}

		clear_events(cs);
		dbg(DEBUG_INIT, "freeing inbuf");
		gig_dbg(DEBUG_INIT, "freeing inbuf");
		kfree(cs->inbuf);
	}
f_bcs:	dbg(DEBUG_INIT, "freeing bcs[]");
f_bcs:	gig_dbg(DEBUG_INIT, "freeing bcs[]");
	kfree(cs->bcs);
f_cs:	dbg(DEBUG_INIT, "freeing cs");
f_cs:	gig_dbg(DEBUG_INIT, "freeing cs");
	up(&cs->sem);
	free_cs(cs);
}
@@ -524,7 +535,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
	bcs->trans_down = 0;
	bcs->trans_up = 0;

	dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel);
	gig_dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel);
	gigaset_at_init(&bcs->at_state, bcs, cs, -1);

	bcs->rcvbytes = 0;
@@ -533,7 +544,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
	bcs->emptycount = 0;
#endif

	dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel);
	gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel);
	bcs->fcs = PPP_INITFCS;
	bcs->inputstate = 0;
	if (cs->ignoreframes) {
@@ -542,7 +553,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
	} else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
		skb_reserve(bcs->skb, HW_HDR_LEN);
	else {
		warn("could not allocate skb");
		dev_warn(cs->dev, "could not allocate skb\n");
		bcs->inputstate |= INS_skip_frame;
	}

@@ -557,13 +568,13 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
	for (i = 0; i < AT_NUM; ++i)
		bcs->commands[i] = NULL;

	dbg(DEBUG_INIT, "  setting up bcs[%d]->hw", channel);
	gig_dbg(DEBUG_INIT, "  setting up bcs[%d]->hw", channel);
	if (cs->ops->initbcshw(bcs))
		return bcs;

	dbg(DEBUG_INIT, "  failed");
	gig_dbg(DEBUG_INIT, "  failed");

	dbg(DEBUG_INIT, "  freeing bcs[%d]->skb", channel);
	gig_dbg(DEBUG_INIT, "  freeing bcs[%d]->skb", channel);
	if (bcs->skb)
		dev_kfree_skb(bcs->skb);

@@ -593,15 +604,15 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
	struct cardstate *cs = NULL;
	int i;

	dbg(DEBUG_INIT, "allocating cs");
	gig_dbg(DEBUG_INIT, "allocating cs");
	cs = alloc_cs(drv);
	if (!cs)
		goto error;
	dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
	gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
	cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
	if (!cs->bcs)
		goto error;
	dbg(DEBUG_INIT, "allocating inbuf");
	gig_dbg(DEBUG_INIT, "allocating inbuf");
	cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
	if (!cs->inbuf)
		goto error;
@@ -623,6 +634,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
	cs->cur_at_seq = 0;
	cs->gotfwver = -1;
	cs->open_count = 0;
	cs->dev = NULL;
	cs->tty = NULL;
	atomic_set(&cs->cidmode, cidmode != 0);

@@ -641,20 +653,20 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
	atomic_set(&cs->mstate, MS_UNINITIALIZED);

	for (i = 0; i < channels; ++i) {
		dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
		gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
		if (!gigaset_initbcs(cs->bcs + i, cs, i))
			goto error;
	}

	++cs->cs_init;

	dbg(DEBUG_INIT, "setting up at_state");
	gig_dbg(DEBUG_INIT, "setting up at_state");
	spin_lock_init(&cs->lock);
	gigaset_at_init(&cs->at_state, NULL, cs, 0);
	cs->dle = 0;
	cs->cbytes = 0;

	dbg(DEBUG_INIT, "setting up inbuf");
	gig_dbg(DEBUG_INIT, "setting up inbuf");
	if (onechannel) {			//FIXME distinction necessary?
		gigaset_inbuf_init(cs->inbuf, cs->bcs, cs, INS_command);
	} else
@@ -662,21 +674,21 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,

	atomic_set(&cs->connected, 0);

	dbg(DEBUG_INIT, "setting up cmdbuf");
	gig_dbg(DEBUG_INIT, "setting up cmdbuf");
	cs->cmdbuf = cs->lastcmdbuf = NULL;
	spin_lock_init(&cs->cmdlock);
	cs->curlen = 0;
	cs->cmdbytes = 0;

	dbg(DEBUG_INIT, "setting up iif");
	gig_dbg(DEBUG_INIT, "setting up iif");
	if (!gigaset_register_to_LL(cs, modulename)) {
		err("register_isdn=>error");
		err("register_isdn failed");
		goto error;
	}

	make_valid(cs, VALID_ID);
	++cs->cs_init;
	dbg(DEBUG_INIT, "setting up hw");
	gig_dbg(DEBUG_INIT, "setting up hw");
	if (!cs->ops->initcshw(cs))
		goto error;

@@ -691,13 +703,13 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
	 * Same problem(?) with mod_timer() in timer_tick(). */
	add_timer(&cs->timer);

	dbg(DEBUG_INIT, "cs initialized!");
	gig_dbg(DEBUG_INIT, "cs initialized");
	up(&cs->sem);
	return cs;

error:	if (cs)
		up(&cs->sem);
	dbg(DEBUG_INIT, "failed");
	gig_dbg(DEBUG_INIT, "failed");
	gigaset_freecs(cs);
	return NULL;
}
@@ -816,7 +828,7 @@ int gigaset_start(struct cardstate *cs)
		goto error;
	}

	dbg(DEBUG_CMD, "scheduling START");
	gig_dbg(DEBUG_CMD, "scheduling START");
	gigaset_schedule_event(cs);

	wait_event(cs->waitqueue, !cs->waiting);
@@ -841,11 +853,11 @@ void gigaset_shutdown(struct cardstate *cs)
		goto exit;
	}

	dbg(DEBUG_CMD, "scheduling SHUTDOWN");
	gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
	gigaset_schedule_event(cs);

	if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
		warn("aborted");
		warn("%s: aborted", __func__);
		//FIXME
	}

@@ -879,11 +891,11 @@ void gigaset_stop(struct cardstate *cs)
		goto exit;
	}

	dbg(DEBUG_CMD, "scheduling STOP");
	gig_dbg(DEBUG_CMD, "scheduling STOP");
	gigaset_schedule_event(cs);

	if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
		warn("aborted");
		warn("%s: aborted", __func__);
		//FIXME
	}

@@ -937,17 +949,18 @@ void gigaset_debugdrivers(void)

	spin_lock_irqsave(&driver_lock, flags);
	list_for_each_entry(drv, &drivers, list) {
		dbg(DEBUG_DRIVER, "driver %p", drv);
		gig_dbg(DEBUG_DRIVER, "driver %p", drv);
		spin_lock(&drv->lock);
		for (i = 0; i < drv->minors; ++i) {
			dbg(DEBUG_DRIVER, "  index %u", i);
			dbg(DEBUG_DRIVER, "    flags 0x%02x", drv->flags[i]);
			gig_dbg(DEBUG_DRIVER, "  index %u", i);
			gig_dbg(DEBUG_DRIVER, "    flags 0x%02x",
				drv->flags[i]);
			cs = drv->cs + i;
			dbg(DEBUG_DRIVER, "    cardstate %p", cs);
			dbg(DEBUG_DRIVER, "    minor_index %u",
			gig_dbg(DEBUG_DRIVER, "    cardstate %p", cs);
			gig_dbg(DEBUG_DRIVER, "    minor_index %u",
				cs->minor_index);
			dbg(DEBUG_DRIVER, "    driver %p", cs->driver);
			dbg(DEBUG_DRIVER, "    i4l id %d", cs->myid);
			gig_dbg(DEBUG_DRIVER, "    driver %p", cs->driver);
			gig_dbg(DEBUG_DRIVER, "    i4l id %d", cs->myid);
		}
		spin_unlock(&drv->lock);
	}
+138 −127
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ static int isdn_getnum(char *p)

	IFNULLRETVAL(p, -1);

	dbg(DEBUG_TRANSCMD, "string: %s", p);
	gig_dbg(DEBUG_TRANSCMD, "string: %s", p);

	while (*p >= '0' && *p <= '9')
		v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0');
@@ -463,7 +463,7 @@ static int isdn_gethex(char *p)

	IFNULLRETVAL(p, -1);

	dbg(DEBUG_TRANSCMD, "string: %s", p);
	gig_dbg(DEBUG_TRANSCMD, "string: %s", p);

	if (!*p)
		return -1;
@@ -537,11 +537,11 @@ void gigaset_handle_modem_response(struct cardstate *cs)
	len = cs->cbytes;
	if (!len) {
		/* ignore additional LFs/CRs (M10x config mode or cx100) */
		dbg(DEBUG_MCMD, "skipped EOL [%02X]", cs->respdata[len]);
		gig_dbg(DEBUG_MCMD, "skipped EOL [%02X]", cs->respdata[len]);
		return;
	}
	cs->respdata[len] = 0;
	dbg(DEBUG_TRANSCMD, "raw string: '%s'", cs->respdata);
	gig_dbg(DEBUG_TRANSCMD, "raw string: '%s'", cs->respdata);
	argv[0] = cs->respdata;
	params = 1;
	if (cs->at_state.getstring) {
@@ -557,7 +557,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
			case ',':
			case '=':
				if (params > MAX_REC_PARAMS) {
					warn("too many parameters in response");
					dev_warn(cs->dev,
					   "too many parameters in response\n");
					/* need last parameter (might be CID) */
					params--;
				}
@@ -575,14 +576,14 @@ void gigaset_handle_modem_response(struct cardstate *cs)
		for (j = 1; j < params; ++j)
			argv[j][-1] = 0;

		dbg(DEBUG_TRANSCMD, "CMD received: %s", argv[0]);
		gig_dbg(DEBUG_TRANSCMD, "CMD received: %s", argv[0]);
		if (cid) {
			--params;
			dbg(DEBUG_TRANSCMD, "CID: %s", argv[params]);
			gig_dbg(DEBUG_TRANSCMD, "CID: %s", argv[params]);
		}
		dbg(DEBUG_TRANSCMD, "available params: %d", params - 1);
		gig_dbg(DEBUG_TRANSCMD, "available params: %d", params - 1);
		for (j = 1; j < params; j++)
			dbg(DEBUG_TRANSCMD, "param %d: %s", j, argv[j]);
			gig_dbg(DEBUG_TRANSCMD, "param %d: %s", j, argv[j]);
	}

	spin_lock_irqsave(&cs->ev_lock, flags);
@@ -594,7 +595,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
	while (curarg < params) {
		next = (tail + 1) % MAX_EVENTS;
		if (unlikely(next == head)) {
			err("event queue full");
			dev_err(cs->dev, "event queue full\n");
			break;
		}

@@ -615,7 +616,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)

			if (!rt->response) {
				event->type = RSP_UNKNOWN;
				warn("unknown modem response: %s",
				dev_warn(cs->dev,
					 "unknown modem response: %s\n",
					 argv[curarg]);
				break;
			}
@@ -632,7 +634,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
			break;
		case RT_RING:
			if (!cid) {
				err("received RING without CID!");
				dev_err(cs->dev,
					"received RING without CID!\n");
				event->type = RSP_INVAL;
				abort = 1;
			} else {
@@ -660,27 +663,25 @@ void gigaset_handle_modem_response(struct cardstate *cs)
				event->parameter = ZSAU_DISCONNECT_REQ;
			else {
				event->parameter = ZSAU_UNKNOWN;
				warn("%s: unknown parameter %s after ZSAU",
				dev_warn(cs->dev,
					"%s: unknown parameter %s after ZSAU\n",
					 __func__, argv[curarg]);
			}
			++curarg;
			break;
		case RT_STRING:
			if (curarg < params) {
				len = strlen(argv[curarg]) + 1;
				event->ptr = kmalloc(len, GFP_ATOMIC);
				if (event->ptr)
					memcpy(event->ptr, argv[curarg], len);
				else
					err("no memory for string!");
				event->ptr = kstrdup(argv[curarg], GFP_ATOMIC);
				if (!event->ptr)
					dev_err(cs->dev, "out of memory\n");
				++curarg;
			}
#ifdef CONFIG_GIGASET_DEBUG
			if (!event->ptr)
				dbg(DEBUG_CMD, "string==NULL");
				gig_dbg(DEBUG_CMD, "string==NULL");
			else
				dbg(DEBUG_CMD,
				    "string==%s", (char *) event->ptr);
				gig_dbg(DEBUG_CMD, "string==%s",
					(char *) event->ptr);
#endif
			break;
		case RT_ZCAU:
@@ -708,7 +709,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
			} else
				event->parameter = -1;
#ifdef CONFIG_GIGASET_DEBUG
			dbg(DEBUG_CMD, "parameter==%d", event->parameter);
			gig_dbg(DEBUG_CMD, "parameter==%d", event->parameter);
#endif
			break;
		}
@@ -724,7 +725,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
	spin_unlock_irqrestore(&cs->ev_lock, flags);

	if (curarg != params)
		dbg(DEBUG_ANY, "invalid number of processed parameters: %d/%d",
		gig_dbg(DEBUG_ANY,
			"invalid number of processed parameters: %d/%d",
			curarg, params);
}
EXPORT_SYMBOL_GPL(gigaset_handle_modem_response);
@@ -750,7 +752,7 @@ static void disconnect(struct at_state_t **at_state_p)
	if (!atomic_read(&cs->cidmode)) {
		cs->at_state.pending_commands |= PC_UMMODE;
		atomic_set(&cs->commands_pending, 1); //FIXME
		dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
		gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
	}

	if (bcs) {
@@ -822,7 +824,7 @@ static void init_failed(struct cardstate *cs, int mode)
static void schedule_init(struct cardstate *cs, int state)
{
	if (cs->at_state.pending_commands & PC_INIT) {
		dbg(DEBUG_CMD, "not scheduling PC_INIT again");
		gig_dbg(DEBUG_CMD, "not scheduling PC_INIT again");
		return;
	}
	atomic_set(&cs->mstate, state);
@@ -830,7 +832,7 @@ static void schedule_init(struct cardstate *cs, int state)
	gigaset_block_channels(cs);
	cs->at_state.pending_commands |= PC_INIT;
	atomic_set(&cs->commands_pending, 1);
	dbg(DEBUG_CMD, "Scheduling PC_INIT");
	gig_dbg(DEBUG_CMD, "Scheduling PC_INIT");
}

/* Add "AT" to a command, add the cid, dle encode it, send the result to the
@@ -843,10 +845,17 @@ static void send_command(struct cardstate *cs, const char *cmd, int cid,

	cmdlen = strlen(cmd);
	buflen = 11 + cmdlen;
	if (unlikely(buflen <= cmdlen)) {
		dev_err(cs->dev, "integer overflow in buflen\n");
		return;
	}

	if (likely(buflen > cmdlen)) {
	cmdbuf = kmalloc(buflen, kmallocflags);
		if (likely(cmdbuf != NULL)) {
	if (unlikely(!cmdbuf)) {
		dev_err(cs->dev, "out of memory\n");
		return;
	}

	cmdpos = cmdbuf + 9;
	cmdtail = cmdpos + cmdlen;
	memcpy(cmdpos, cmd, cmdlen);
@@ -873,10 +882,6 @@ static void send_command(struct cardstate *cs, const char *cmd, int cid,

	cs->ops->write_cmd(cs, cmdpos, cmdlen, NULL);
	kfree(cmdbuf);
		} else
			err("no memory for command buffer");
	} else
		err("overflow in buflen");
}

static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
@@ -930,13 +935,14 @@ static void bchannel_up(struct bc_state *bcs)
	IFNULLRET(bcs);

	if (!(bcs->chstate & CHS_D_UP)) {
		notice("%s: D channel not up", __func__);
		dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
		bcs->chstate |= CHS_D_UP;
		gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
	}

	if (bcs->chstate & CHS_B_UP) {
		notice("%s: B channel already up", __func__);
		dev_notice(bcs->cs->dev, "%s: B channel already up\n",
			   __func__);
		return;
	}

@@ -962,13 +968,13 @@ static void start_dial(struct at_state_t *at_state, void *data, int seq_index)


	at_state->pending_commands |= PC_CID;
	dbg(DEBUG_CMD, "Scheduling PC_CID");
	gig_dbg(DEBUG_CMD, "Scheduling PC_CID");
	atomic_set(&cs->commands_pending, 1);
	return;

error:
	at_state->pending_commands |= PC_NOCID;
	dbg(DEBUG_CMD, "Scheduling PC_NOCID");
	gig_dbg(DEBUG_CMD, "Scheduling PC_NOCID");
	atomic_set(&cs->commands_pending, 1);
	return;
}
@@ -982,12 +988,12 @@ static void start_accept(struct at_state_t *at_state)

	if (retval == 0) {
		at_state->pending_commands |= PC_ACCEPT;
		dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
		gig_dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
		atomic_set(&cs->commands_pending, 1);
	} else {
		//FIXME
		at_state->pending_commands |= PC_HUP;
		dbg(DEBUG_CMD, "Scheduling PC_HUP");
		gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
		atomic_set(&cs->commands_pending, 1);
	}
}
@@ -1029,7 +1035,7 @@ static void do_shutdown(struct cardstate *cs)
		atomic_set(&cs->mstate, MS_SHUTDOWN);
		cs->at_state.pending_commands |= PC_SHUTDOWN;
		atomic_set(&cs->commands_pending, 1);
		dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
		gig_dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
	} else
		finish_shutdown(cs);
}
@@ -1059,9 +1065,11 @@ static int reinit_and_retry(struct cardstate *cs, int channel)
			return 0;

	if (channel < 0)
		warn("Could not enter cid mode. Reinit device and try again.");
		dev_warn(cs->dev,
		    "Could not enter cid mode. Reinit device and try again.\n");
	else {
		warn("Could not get a call id. Reinit device and try again.");
		dev_warn(cs->dev,
		    "Could not get a call id. Reinit device and try again.\n");
		cs->bcs[channel].at_state.pending_commands |= PC_CID;
	}
	schedule_init(cs, MS_INIT);
@@ -1106,7 +1114,7 @@ static void handle_icall(struct cardstate *cs, struct bc_state *bcs,
	case ICALL_ACCEPT:
		break;
	default:
		err("internal error: disposition=%d", retval);
		dev_err(cs->dev, "internal error: disposition=%d\n", retval);
		/* --v-- fall through --v-- */
	case ICALL_IGNORE:
	case ICALL_REJECT:
@@ -1201,10 +1209,10 @@ static void do_action(int action, struct cardstate *cs,
		}
		cs->at_state.pending_commands |= PC_CIDMODE;
		atomic_set(&cs->commands_pending, 1);
		dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
		gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
		break;
	case ACT_FAILINIT:
		warn("Could not initialize the device.");
		dev_warn(cs->dev, "Could not initialize the device.\n");
		cs->dle = 0;
		init_failed(cs, M_UNKNOWN);
		cs->cur_at_seq = SEQ_NONE;
@@ -1260,8 +1268,8 @@ static void do_action(int action, struct cardstate *cs,
		/* get fresh AT state structure for new CID */
		at_state2 = get_free_channel(cs, ev->parameter);
		if (!at_state2) {
			warn("RING ignored: "
			     "could not allocate channel structure");
			dev_warn(cs->dev,
			"RING ignored: could not allocate channel structure\n");
			break;
		}

@@ -1289,7 +1297,7 @@ static void do_action(int action, struct cardstate *cs,
		at_state = *p_at_state;
		break;
	case ACT_FAILSDOWN:
		warn("Could not shut down the device.");
		dev_warn(cs->dev, "Could not shut down the device.\n");
		/* fall through */
	case ACT_FAKESDOWN:
	case ACT_SDOWN:
@@ -1342,7 +1350,7 @@ static void do_action(int action, struct cardstate *cs,
		break;
	case ACT_ABORTHUP:
		cs->cur_at_seq = SEQ_NONE;
		warn("Could not hang up.");
		dev_warn(cs->dev, "Could not hang up.\n");
		at_state->cid = -1;
		if (bcs && cs->onechannel)
			at_state->pending_commands |= PC_DLE0;
@@ -1354,14 +1362,15 @@ static void do_action(int action, struct cardstate *cs,
		break;
	case ACT_FAILDLE0:
		cs->cur_at_seq = SEQ_NONE;
		warn("Could not leave DLE mode.");
		dev_warn(cs->dev, "Could not leave DLE mode.\n");
		at_state2 = &cs->bcs[cs->curchannel].at_state;
		disconnect(&at_state2);
		schedule_init(cs, MS_RECOVER);
		break;
	case ACT_FAILDLE1:
		cs->cur_at_seq = SEQ_NONE;
		warn("Could not enter DLE mode. Try to hang up.");
		dev_warn(cs->dev,
			 "Could not enter DLE mode. Trying to hang up.\n");
		channel = cs->curchannel;
		cs->bcs[channel].at_state.pending_commands |= PC_HUP;
		atomic_set(&cs->commands_pending, 1);
@@ -1382,7 +1391,8 @@ static void do_action(int action, struct cardstate *cs,
		cs->cur_at_seq = SEQ_NONE;
		channel = cs->curchannel;
		if (!reinit_and_retry(cs, channel)) {
			warn("Could not get a call id. Dialing not possible");
			dev_warn(cs->dev,
				 "Could not get a call ID. Cannot dial.\n");
			at_state2 = &cs->bcs[channel].at_state;
			disconnect(&at_state2);
		}
@@ -1457,7 +1467,7 @@ static void do_action(int action, struct cardstate *cs,
	case ACT_GOTVER:
		if (cs->gotfwver == 0) {
			cs->gotfwver = 1;
			dbg(DEBUG_ANY,
			gig_dbg(DEBUG_ANY,
				"firmware version %02d.%03d.%02d.%02d",
				cs->fwver[0], cs->fwver[1],
				cs->fwver[2], cs->fwver[3]);
@@ -1466,7 +1476,7 @@ static void do_action(int action, struct cardstate *cs,
		/* fall through */
	case ACT_FAILVER:
		cs->gotfwver = -1;
		err("could not read firmware version.");
		dev_err(cs->dev, "could not read firmware version.\n");
		break;
#ifdef CONFIG_GIGASET_DEBUG
	case ACT_ERROR:
@@ -1484,15 +1494,15 @@ static void do_action(int action, struct cardstate *cs,
		break;
#endif
	case ACT_DEBUG:
		dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d",
		gig_dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d",
			__func__, ev->type, at_state->ConState);
		break;
	case ACT_WARN:
		warn("%s: resp_code %d in ConState %d!",
		dev_warn(cs->dev, "%s: resp_code %d in ConState %d!\n",
			 __func__, ev->type, at_state->ConState);
		break;
	case ACT_ZCAU:
		warn("cause code %04x in connection state %d.",
		dev_warn(cs->dev, "cause code %04x in connection state %d.\n",
			 ev->parameter, at_state->ConState);
		break;

@@ -1504,14 +1514,14 @@ static void do_action(int action, struct cardstate *cs,
		start_accept(at_state);
		break;
	case ACT_PROTO_L2:
		dbg(DEBUG_CMD,
		    "set protocol to %u", (unsigned) ev->parameter);
		gig_dbg(DEBUG_CMD, "set protocol to %u",
			(unsigned) ev->parameter);
		at_state->bcs->proto2 = ev->parameter;
		break;
	case ACT_HUP:
		at_state->pending_commands |= PC_HUP;
		atomic_set(&cs->commands_pending, 1);
		dbg(DEBUG_CMD, "Scheduling PC_HUP");
		gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
		break;

	/* hotplug events */
@@ -1547,10 +1557,10 @@ static void do_action(int action, struct cardstate *cs,
			atomic_set(&cs->cidmode, ev->parameter);
			if (ev->parameter) {
				cs->at_state.pending_commands |= PC_CIDMODE;
				dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
				gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
			} else {
				cs->at_state.pending_commands |= PC_UMMODE;
				dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
				gig_dbg(DEBUG_CMD, "Scheduling PC_UMMODE");
			}
			atomic_set(&cs->commands_pending, 1);
		}
@@ -1578,7 +1588,7 @@ static void do_action(int action, struct cardstate *cs,
				*p_resp_code = RSP_NULL;
			}
		} else
			err("%s: action==%d!", __func__, action);
			dev_err(cs->dev, "%s: action==%d!\n", __func__, action);
	}
}

@@ -1610,14 +1620,14 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
	} else {
		at_state = ev->at_state;
		if (at_state_invalid(cs, at_state)) {
			dbg(DEBUG_ANY,
			    "event for invalid at_state %p", at_state);
			gig_dbg(DEBUG_ANY, "event for invalid at_state %p",
				at_state);
			return;
		}
	}

	dbg(DEBUG_CMD,
	    "connection state %d, event %d", at_state->ConState, ev->type);
	gig_dbg(DEBUG_CMD, "connection state %d, event %d",
		at_state->ConState, ev->type);

	bcs = at_state->bcs;
	sendcid = at_state->cid;
@@ -1630,11 +1640,11 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
		if (ev->parameter != atomic_read(&at_state->timer_index)
		    || !at_state->timer_active) {
			ev->type = RSP_NONE; /* old timeout */
			dbg(DEBUG_ANY, "old timeout");
			gig_dbg(DEBUG_ANY, "old timeout");
		} else if (!at_state->waiting)
			dbg(DEBUG_ANY, "timeout occured");
			gig_dbg(DEBUG_ANY, "timeout occurred");
		else
			dbg(DEBUG_ANY, "stopped waiting");
			gig_dbg(DEBUG_ANY, "stopped waiting");
	}

	/* if the response belongs to a variable in at_state->int_var[VAR_XXXX]
@@ -1657,10 +1667,10 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
	   constate */
	for (;; rep++) {
		rcode = rep->resp_code;
		/* dbg (DEBUG_ANY, "rcode %d", rcode); */
		if (rcode == RSP_LAST) {
			/* found nothing...*/
			warn("%s: rcode=RSP_LAST: resp_code %d in ConState %d!",
			dev_warn(cs->dev, "%s: rcode=RSP_LAST: "
					"resp_code %d in ConState %d!\n",
				 __func__, ev->type, at_state->ConState);
			return;
		}
@@ -1741,11 +1751,11 @@ static void process_command_flags(struct cardstate *cs)
	atomic_set(&cs->commands_pending, 0);

	if (cs->cur_at_seq) {
		dbg(DEBUG_CMD, "not searching scheduled commands: busy");
		gig_dbg(DEBUG_CMD, "not searching scheduled commands: busy");
		return;
	}

	dbg(DEBUG_CMD, "searching scheduled commands");
	gig_dbg(DEBUG_CMD, "searching scheduled commands");

	sequence = SEQ_NONE;

@@ -1884,7 +1894,7 @@ static void process_command_flags(struct cardstate *cs)
			switch (atomic_read(&cs->mode)) {
			case M_UNIMODEM:
				cs->at_state.pending_commands |= PC_CIDMODE;
				dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
				gig_dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
				atomic_set(&cs->commands_pending, 1);
				return;
#ifdef GIG_MAYINITONDIAL
@@ -1945,7 +1955,8 @@ static void process_events(struct cardstate *cs)
	}

	if (i == 2 * MAX_EVENTS) {
		err("infinite loop in process_events; aborting.");
		dev_err(cs->dev,
			"infinite loop in process_events; aborting.\n");
	}
}

@@ -1962,7 +1973,7 @@ void gigaset_handle_event(unsigned long data)

	/* handle incoming data on control/common channel */
	if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) {
		dbg(DEBUG_INTR, "processing new data");
		gig_dbg(DEBUG_INTR, "processing new data");
		cs->ops->handle_input(cs->inbuf);
	}

+95 −104

File changed.

Preview size limit exceeded, changes collapsed.

Loading