• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/drivers/isdn/gigaset/

Lines Matching refs:cs

21 static int if_lock(struct cardstate *cs, int *arg)
25 gig_dbg(DEBUG_IF, "%u: if_lock (%d)", cs->minor_index, cmd);
31 *arg = atomic_read(&cs->mstate) == MS_LOCKED;
35 if (!cmd && atomic_read(&cs->mstate) == MS_LOCKED
36 && cs->connected) {
37 cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
38 cs->ops->baud_rate(cs, B115200);
39 cs->ops->set_line_ctrl(cs, CS8);
40 cs->control_state = TIOCM_DTR|TIOCM_RTS;
43 cs->waiting = 1;
44 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_LOCK,
46 cs->waiting = 0;
51 gigaset_schedule_event(cs);
53 wait_event(cs->waitqueue, !cs->waiting);
55 if (cs->cmd_result >= 0) {
56 *arg = cs->cmd_result;
60 return cs->cmd_result;
63 static int if_version(struct cardstate *cs, unsigned arg[4])
69 gig_dbg(DEBUG_IF, "%u: if_version (%d)", cs->minor_index, cmd);
79 cs->waiting = 1;
80 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_VER,
82 cs->waiting = 0;
87 gigaset_schedule_event(cs);
89 wait_event(cs->waitqueue, !cs->waiting);
91 if (cs->cmd_result >= 0)
94 return cs->cmd_result;
100 static int if_config(struct cardstate *cs, int *arg)
102 gig_dbg(DEBUG_IF, "%u: if_config (%d)", cs->minor_index, *arg);
107 if (atomic_read(&cs->mstate) != MS_LOCKED)
110 if (!cs->connected) {
116 return gigaset_enterconfigmode(cs);
153 struct cardstate *cs;
161 cs = gigaset_get_cs_by_tty(tty);
162 if (!cs)
165 if (mutex_lock_interruptible(&cs->mutex))
167 tty->driver_data = cs;
169 ++cs->open_count;
171 if (cs->open_count == 1) {
172 spin_lock_irqsave(&cs->lock, flags);
173 cs->tty = tty;
174 spin_unlock_irqrestore(&cs->lock, flags);
178 mutex_unlock(&cs->mutex);
184 struct cardstate *cs;
187 cs = (struct cardstate *) tty->driver_data;
188 if (!cs) {
189 err("cs==NULL in %s", __func__);
193 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
195 mutex_lock(&cs->mutex);
197 if (!cs->open_count)
200 if (!--cs->open_count) {
201 spin_lock_irqsave(&cs->lock, flags);
202 cs->tty = NULL;
203 spin_unlock_irqrestore(&cs->lock, flags);
207 mutex_unlock(&cs->mutex);
213 struct cardstate *cs;
219 cs = (struct cardstate *) tty->driver_data;
220 if (!cs) {
221 err("cs==NULL in %s", __func__);
225 gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd);
227 if (mutex_lock_interruptible(&cs->mutex))
230 if (!cs->open_count)
238 retval = if_lock(cs, &int_arg);
245 retval = if_config(cs, &int_arg);
250 if (!cs->connected) {
262 retval = cs->ops->brkchars(cs, buf);
270 retval = if_version(cs, version);
283 mutex_unlock(&cs->mutex);
290 struct cardstate *cs;
293 cs = (struct cardstate *) tty->driver_data;
294 if (!cs) {
295 err("cs==NULL in %s", __func__);
299 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
301 if (mutex_lock_interruptible(&cs->mutex))
304 retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR);
306 mutex_unlock(&cs->mutex);
314 struct cardstate *cs;
318 cs = (struct cardstate *) tty->driver_data;
319 if (!cs) {
320 err("cs==NULL in %s", __func__);
325 cs->minor_index, __func__, set, clear);
327 if (mutex_lock_interruptible(&cs->mutex))
330 if (!cs->connected) {
334 mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR);
335 retval = cs->ops->set_modem_ctrl(cs, cs->control_state, mc);
336 cs->control_state = mc;
339 mutex_unlock(&cs->mutex);
346 struct cardstate *cs;
349 cs = (struct cardstate *) tty->driver_data;
350 if (!cs) {
351 err("cs==NULL in %s", __func__);
355 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
357 if (mutex_lock_interruptible(&cs->mutex))
360 if (!cs->open_count)
362 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
365 } else if (!cs->connected) {
369 retval = cs->ops->write_cmd(cs, buf, count,
370 &cs->if_wake_tasklet);
373 mutex_unlock(&cs->mutex);
380 struct cardstate *cs;
383 cs = (struct cardstate *) tty->driver_data;
384 if (!cs) {
385 err("cs==NULL in %s", __func__);
389 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
391 if (mutex_lock_interruptible(&cs->mutex))
394 if (!cs->open_count)
396 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
399 } else if (!cs->connected) {
403 retval = cs->ops->write_room(cs);
405 mutex_unlock(&cs->mutex);
412 struct cardstate *cs;
415 cs = (struct cardstate *) tty->driver_data;
416 if (!cs) {
417 err("cs==NULL in %s", __func__);
421 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
423 if (mutex_lock_interruptible(&cs->mutex))
426 if (!cs->open_count)
428 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
431 } else if (!cs->connected) {
435 retval = cs->ops->chars_in_buffer(cs);
437 mutex_unlock(&cs->mutex);
444 struct cardstate *cs;
446 cs = (struct cardstate *) tty->driver_data;
447 if (!cs) {
448 err("cs==NULL in %s", __func__);
452 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
454 mutex_lock(&cs->mutex);
456 if (!cs->open_count)
461 mutex_unlock(&cs->mutex);
466 struct cardstate *cs;
468 cs = (struct cardstate *) tty->driver_data;
469 if (!cs) {
470 err("cs==NULL in %s", __func__);
474 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
476 mutex_lock(&cs->mutex);
478 if (!cs->open_count)
483 mutex_unlock(&cs->mutex);
488 struct cardstate *cs;
494 cs = (struct cardstate *) tty->driver_data;
495 if (!cs) {
496 err("cs==NULL in %s", __func__);
500 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
502 mutex_lock(&cs->mutex);
504 if (!cs->open_count) {
509 if (!cs->connected) {
519 cs->minor_index, iflag, cflag, old_cflag);
522 control_state = cs->control_state;
538 cs->minor_index,
540 cs->ops->set_modem_ctrl(cs, control_state, new_state);
544 cs->ops->baud_rate(cs, cflag & CBAUD);
548 gig_dbg(DEBUG_IF, "%u: to B0 - drop DTR/RTS", cs->minor_index);
550 cs->ops->set_modem_ctrl(cs, control_state, new_state);
558 cs->ops->set_line_ctrl(cs, cflag);
562 cs->control_state = control_state;
565 mutex_unlock(&cs->mutex);
572 struct cardstate *cs = (struct cardstate *) data;
574 if (cs->tty)
575 tty_wakeup(cs->tty);
580 void gigaset_if_init(struct cardstate *cs)
584 drv = cs->driver;
588 tasklet_init(&cs->if_wake_tasklet, &if_wake, (unsigned long) cs);
590 mutex_lock(&cs->mutex);
591 cs->tty_dev = tty_register_device(drv->tty, cs->minor_index, NULL);
593 if (!IS_ERR(cs->tty_dev))
594 dev_set_drvdata(cs->tty_dev, cs);
597 cs->tty_dev = NULL;
599 mutex_unlock(&cs->mutex);
602 void gigaset_if_free(struct cardstate *cs)
606 drv = cs->driver;
610 tasklet_disable(&cs->if_wake_tasklet);
611 tasklet_kill(&cs->if_wake_tasklet);
612 cs->tty_dev = NULL;
613 tty_unregister_device(drv->tty, cs->minor_index);
616 void gigaset_if_receive(struct cardstate *cs,
622 spin_lock_irqsave(&cs->lock, flags);
623 if ((tty = cs->tty) == NULL)
630 spin_unlock_irqrestore(&cs->lock, flags);