• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/char/

Lines Matching refs:hp

101 	struct hvc_struct *hp;
106 list_for_each_entry(hp, &hvc_structs, next) {
107 spin_lock_irqsave(&hp->lock, flags);
108 if (hp->index == index) {
109 kref_get(&hp->kref);
110 spin_unlock_irqrestore(&hp->lock, flags);
112 return hp;
114 spin_unlock_irqrestore(&hp->lock, flags);
116 hp = NULL;
119 return hp;
231 struct hvc_struct *hp = container_of(kref, struct hvc_struct, kref);
236 spin_lock_irqsave(&hp->lock, flags);
237 list_del(&(hp->next));
238 spin_unlock_irqrestore(&hp->lock, flags);
242 kfree(hp);
253 struct hvc_struct *hp;
262 hp = hvc_get_by_index(index);
263 if (hp) {
264 kref_put(&hp->kref, destroy_hvc_struct);
305 struct hvc_struct *hp;
310 if (!(hp = hvc_get_by_index(tty->index)))
313 spin_lock_irqsave(&hp->lock, flags);
315 if (hp->count++ > 0) {
317 spin_unlock_irqrestore(&hp->lock, flags);
322 tty->driver_data = hp;
324 hp->tty = tty_kref_get(tty);
326 spin_unlock_irqrestore(&hp->lock, flags);
328 if (hp->ops->notifier_add)
329 rc = hp->ops->notifier_add(hp, hp->data);
338 spin_lock_irqsave(&hp->lock, flags);
339 hp->tty = NULL;
340 spin_unlock_irqrestore(&hp->lock, flags);
343 kref_put(&hp->kref, destroy_hvc_struct);
354 struct hvc_struct *hp;
368 hp = tty->driver_data;
370 spin_lock_irqsave(&hp->lock, flags);
372 if (--hp->count == 0) {
374 hp->tty = NULL;
375 spin_unlock_irqrestore(&hp->lock, flags);
377 if (hp->ops->notifier_del)
378 hp->ops->notifier_del(hp, hp->data);
381 cancel_work_sync(&hp->tty_resize);
390 if (hp->count < 0)
392 hp->vtermno, hp->count);
393 spin_unlock_irqrestore(&hp->lock, flags);
397 kref_put(&hp->kref, destroy_hvc_struct);
402 struct hvc_struct *hp = tty->driver_data;
406 if (!hp)
410 cancel_work_sync(&hp->tty_resize);
412 spin_lock_irqsave(&hp->lock, flags);
419 if (hp->count <= 0) {
420 spin_unlock_irqrestore(&hp->lock, flags);
424 temp_open_count = hp->count;
425 hp->count = 0;
426 hp->n_outbuf = 0;
427 hp->tty = NULL;
429 spin_unlock_irqrestore(&hp->lock, flags);
431 if (hp->ops->notifier_hangup)
432 hp->ops->notifier_hangup(hp, hp->data);
437 kref_put(&hp->kref, destroy_hvc_struct);
443 * on a blocked hypervisor. Call this function with hp->lock held.
445 static int hvc_push(struct hvc_struct *hp)
449 n = hp->ops->put_chars(hp->vtermno, hp->outbuf, hp->n_outbuf);
452 hp->do_wakeup = 1;
457 hp->n_outbuf = 0;
459 hp->n_outbuf -= n;
460 if (hp->n_outbuf > 0)
461 memmove(hp->outbuf, hp->outbuf + n, hp->n_outbuf);
463 hp->do_wakeup = 1;
470 struct hvc_struct *hp = tty->driver_data;
475 if (!hp)
478 if (hp->count <= 0)
481 spin_lock_irqsave(&hp->lock, flags);
484 if (hp->n_outbuf > 0)
485 hvc_push(hp);
487 while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) {
490 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize);
493 hp->n_outbuf += rsize;
495 hvc_push(hp);
497 spin_unlock_irqrestore(&hp->lock, flags);
502 if (hp->n_outbuf)
515 * Locking: hp->lock
519 struct hvc_struct *hp;
524 hp = container_of(work, struct hvc_struct, tty_resize);
526 spin_lock_irqsave(&hp->lock, hvc_flags);
527 if (!hp->tty) {
528 spin_unlock_irqrestore(&hp->lock, hvc_flags);
531 ws = hp->ws;
532 tty = tty_kref_get(hp->tty);
533 spin_unlock_irqrestore(&hp->lock, hvc_flags);
546 struct hvc_struct *hp = tty->driver_data;
548 if (!hp)
551 return hp->outbuf_size - hp->n_outbuf;
556 struct hvc_struct *hp = tty->driver_data;
558 if (!hp)
560 return hp->n_outbuf;
578 int hvc_poll(struct hvc_struct *hp)
587 spin_lock_irqsave(&hp->lock, flags);
590 if (hp->n_outbuf > 0)
591 written_total = hvc_push(hp);
594 if (hp->n_outbuf > 0) {
601 tty = tty_kref_get(hp->tty);
612 if (!hp->irq_requested)
625 n = hp->ops->get_chars(hp->vtermno, buf, count);
629 spin_unlock_irqrestore(&hp->lock, flags);
631 spin_lock_irqsave(&hp->lock, flags);
644 if (hp->index == hvc_console.index) {
666 if (hp->do_wakeup) {
667 hp->do_wakeup = 0;
671 spin_unlock_irqrestore(&hp->lock, flags);
689 * @hp: HVC console pointer
692 * Stores the specified window size information in the hvc structure of @hp.
695 * Locking: Locking free; the function MUST be called holding hp->lock
697 void __hvc_resize(struct hvc_struct *hp, struct winsize ws)
699 hp->ws = ws;
700 schedule_work(&hp->tty_resize);
712 struct hvc_struct *hp;
723 list_for_each_entry(hp, &hvc_structs, next) {
724 poll_mask |= hvc_poll(hp);
762 struct hvc_struct *hp;
772 hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
774 if (!hp)
777 hp->vtermno = vtermno;
778 hp->data = data;
779 hp->ops = ops;
780 hp->outbuf_size = outbuf_size;
781 hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))];
783 kref_init(&hp->kref);
785 INIT_WORK(&hp->tty_resize, hvc_set_winsz);
786 spin_lock_init(&hp->lock);
794 if (vtermnos[i] == hp->vtermno &&
795 cons_ops[i] == hp->ops)
802 hp->index = i;
804 list_add_tail(&(hp->next), &hvc_structs);
807 return hp;
811 int hvc_remove(struct hvc_struct *hp)
816 spin_lock_irqsave(&hp->lock, flags);
817 tty = tty_kref_get(hp->tty);
819 if (hp->index < MAX_NR_HVC_CONSOLES)
820 vtermnos[hp->index] = -1;
822 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */
824 spin_unlock_irqrestore(&hp->lock, flags);
832 kref_put(&hp->kref, destroy_hvc_struct);