Lines Matching refs:bcs

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