Lines Matching defs:bcs
167 if (test_timeout(&cs->bcs[channel].at_state))
188 int gigaset_get_channel(struct bc_state *bcs)
192 spin_lock_irqsave(&bcs->cs->lock, flags);
193 if (bcs->use_count || !try_module_get(bcs->cs->driver->owner)) {
195 bcs->channel);
196 spin_unlock_irqrestore(&bcs->cs->lock, flags);
199 ++bcs->use_count;
200 bcs->busy = 1;
201 gig_dbg(DEBUG_CHANNEL, "allocated channel %d", bcs->channel);
202 spin_unlock_irqrestore(&bcs->cs->lock, flags);
219 if (!cs->bcs[i].use_count) {
220 ++cs->bcs[i].use_count;
221 cs->bcs[i].busy = 1;
224 return cs->bcs + i;
232 void gigaset_free_channel(struct bc_state *bcs)
236 spin_lock_irqsave(&bcs->cs->lock, flags);
237 if (!bcs->busy) {
239 bcs->channel);
240 spin_unlock_irqrestore(&bcs->cs->lock, flags);
243 --bcs->use_count;
244 bcs->busy = 0;
245 module_put(bcs->cs->driver->owner);
246 gig_dbg(DEBUG_CHANNEL, "freed channel %d", bcs->channel);
247 spin_unlock_irqrestore(&bcs->cs->lock, flags);
257 if (cs->bcs[i].use_count) {
264 ++cs->bcs[i].use_count;
280 --cs->bcs[i].use_count;
292 ++cs->bcs[i].use_count;
386 static void gigaset_freebcs(struct bc_state *bcs)
390 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
391 bcs->cs->ops->freebcshw(bcs);
393 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
394 clear_at_state(&bcs->at_state);
395 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
396 dev_kfree_skb(bcs->rx_skb);
397 bcs->rx_skb = NULL;
400 kfree(bcs->commands[i]);
401 bcs->commands[i] = NULL;
482 gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
483 gigaset_freebcs(cs->bcs + i);
512 kfree(cs->bcs);
520 void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
540 at_state->bcs = bcs;
608 static int gigaset_initbcs(struct bc_state *bcs, struct cardstate *cs,
613 bcs->tx_skb = NULL;
615 skb_queue_head_init(&bcs->squeue);
617 bcs->corrupted = 0;
618 bcs->trans_down = 0;
619 bcs->trans_up = 0;
621 gig_dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel);
622 gigaset_at_init(&bcs->at_state, bcs, cs, -1);
625 bcs->emptycount = 0;
628 bcs->rx_bufsize = 0;
629 bcs->rx_skb = NULL;
630 bcs->rx_fcs = PPP_INITFCS;
631 bcs->inputstate = 0;
632 bcs->channel = channel;
633 bcs->cs = cs;
635 bcs->chstate = 0;
636 bcs->use_count = 1;
637 bcs->busy = 0;
638 bcs->ignore = cs->ignoreframes;
641 bcs->commands[i] = NULL;
643 spin_lock_init(&bcs->aplock);
644 bcs->ap = NULL;
645 bcs->apconnstate = 0;
647 gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel);
648 return cs->ops->initbcshw(bcs);
713 cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
715 if (!cs->bcs || !cs->inbuf) {
761 gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i);
762 if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) {
786 void gigaset_bcs_reinit(struct bc_state *bcs)
789 struct cardstate *cs = bcs->cs;
792 while ((skb = skb_dequeue(&bcs->squeue)) != NULL)
796 clear_at_state(&bcs->at_state);
797 bcs->at_state.ConState = 0;
798 bcs->at_state.timer_active = 0;
799 bcs->at_state.timer_expires = 0;
800 bcs->at_state.cid = -1; /* No CID defined */
803 bcs->inputstate = 0;
806 bcs->emptycount = 0;
809 bcs->rx_fcs = PPP_INITFCS;
810 bcs->chstate = 0;
812 bcs->ignore = cs->ignoreframes;
813 dev_kfree_skb(bcs->rx_skb);
814 bcs->rx_skb = NULL;
816 cs->ops->reinitbcshw(bcs);
856 gigaset_freebcs(cs->bcs + i);
857 if (gigaset_initbcs(cs->bcs + i, cs, i) < 0)