• Home
  • Raw
  • Download

Lines Matching refs:pp

108 static inline void pp_enable_irq(struct pp_struct *pp)  in pp_enable_irq()  argument
110 struct parport *port = pp->pdev->port; in pp_enable_irq()
119 struct pp_struct *pp = file->private_data; in pp_read() local
125 if (!(pp->flags & PP_CLAIMED)) { in pp_read()
138 pport = pp->pdev->port; in pp_read()
141 parport_set_timeout(pp->pdev, in pp_read()
144 pp->default_inactivity); in pp_read()
154 if (pp->flags & PP_W91284PIC) in pp_read()
156 if (pp->flags & PP_FASTREAD) in pp_read()
183 parport_set_timeout(pp->pdev, pp->default_inactivity); in pp_read()
189 pp_enable_irq(pp); in pp_read()
197 struct pp_struct *pp = file->private_data; in pp_write() local
204 if (!(pp->flags & PP_CLAIMED)) { in pp_write()
214 pport = pp->pdev->port; in pp_write()
217 parport_set_timeout(pp->pdev, in pp_write()
220 pp->default_inactivity); in pp_write()
230 if ((pp->flags & PP_FASTWRITE) && (mode == IEEE1284_MODE_EPP)) { in pp_write()
240 wrote = parport_write(pp->pdev->port, kbuffer, n); in pp_write()
263 parport_set_timeout(pp->pdev, pp->default_inactivity); in pp_write()
266 pp_enable_irq(pp); in pp_write()
272 struct pp_struct *pp = private; in pp_irq() local
274 if (pp->irqresponse) { in pp_irq()
275 parport_write_control(pp->pdev->port, pp->irqctl); in pp_irq()
276 pp->irqresponse = 0; in pp_irq()
279 atomic_inc(&pp->irqc); in pp_irq()
280 wake_up_interruptible(&pp->irq_wait); in pp_irq()
283 static int register_device(int minor, struct pp_struct *pp) in register_device() argument
305 ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; in register_device()
306 ppdev_cb.private = pp; in register_device()
317 pp->pdev = pdev; in register_device()
318 pp->index = index; in register_device()
355 struct pp_struct *pp = file->private_data; in pp_do_ioctl() local
371 if (pp->flags & PP_CLAIMED) { in pp_do_ioctl()
372 dev_dbg(&pp->pdev->dev, "you've already got it!\n"); in pp_do_ioctl()
377 if (!pp->pdev) { in pp_do_ioctl()
378 int err = register_device(minor, pp); in pp_do_ioctl()
384 ret = parport_claim_or_block(pp->pdev); in pp_do_ioctl()
388 pp->flags |= PP_CLAIMED; in pp_do_ioctl()
392 pp_enable_irq(pp); in pp_do_ioctl()
395 info = &pp->pdev->port->ieee1284; in pp_do_ioctl()
396 pp->saved_state.mode = info->mode; in pp_do_ioctl()
397 pp->saved_state.phase = info->phase; in pp_do_ioctl()
398 info->mode = pp->state.mode; in pp_do_ioctl()
399 info->phase = pp->state.phase; in pp_do_ioctl()
400 pp->default_inactivity = parport_set_timeout(pp->pdev, 0); in pp_do_ioctl()
401 parport_set_timeout(pp->pdev, pp->default_inactivity); in pp_do_ioctl()
406 if (pp->pdev) { in pp_do_ioctl()
407 dev_dbg(&pp->pdev->dev, in pp_do_ioctl()
409 if (pp->flags & PP_EXCL) in pp_do_ioctl()
418 pp->flags |= PP_EXCL; in pp_do_ioctl()
427 pp->state.mode = mode; in pp_do_ioctl()
428 pp->state.phase = init_phase(mode); in pp_do_ioctl()
430 if (pp->flags & PP_CLAIMED) { in pp_do_ioctl()
431 pp->pdev->port->ieee1284.mode = mode; in pp_do_ioctl()
432 pp->pdev->port->ieee1284.phase = pp->state.phase; in pp_do_ioctl()
441 if (pp->flags & PP_CLAIMED) in pp_do_ioctl()
442 mode = pp->pdev->port->ieee1284.mode; in pp_do_ioctl()
444 mode = pp->state.mode; in pp_do_ioctl()
458 pp->state.phase = phase; in pp_do_ioctl()
460 if (pp->flags & PP_CLAIMED) in pp_do_ioctl()
461 pp->pdev->port->ieee1284.phase = phase; in pp_do_ioctl()
469 if (pp->flags & PP_CLAIMED) in pp_do_ioctl()
470 phase = pp->pdev->port->ieee1284.phase; in pp_do_ioctl()
472 phase = pp->state.phase; in pp_do_ioctl()
497 pp->flags &= ~PP_FLAGMASK; in pp_do_ioctl()
498 pp->flags |= (uflags & PP_FLAGMASK); in pp_do_ioctl()
505 uflags = pp->flags & PP_FLAGMASK; in pp_do_ioctl()
514 if ((pp->flags & PP_CLAIMED) == 0) { in pp_do_ioctl()
519 port = pp->pdev->port; in pp_do_ioctl()
537 parport_yield_blocking(pp->pdev); in pp_do_ioctl()
542 info = &pp->pdev->port->ieee1284; in pp_do_ioctl()
543 pp->state.mode = info->mode; in pp_do_ioctl()
544 pp->state.phase = info->phase; in pp_do_ioctl()
545 info->mode = pp->saved_state.mode; in pp_do_ioctl()
546 info->phase = pp->saved_state.phase; in pp_do_ioctl()
547 parport_release(pp->pdev); in pp_do_ioctl()
548 pp->flags &= ~PP_CLAIMED; in pp_do_ioctl()
594 pp_enable_irq(pp); in pp_do_ioctl()
603 pp->irqctl = reg; in pp_do_ioctl()
604 pp->irqresponse = 1; in pp_do_ioctl()
608 ret = atomic_read(&pp->irqc); in pp_do_ioctl()
611 atomic_sub(ret, &pp->irqc); in pp_do_ioctl()
621 return pp_set_timeout(pp->pdev, time32[0], time32[1]); in pp_do_ioctl()
633 return pp_set_timeout(pp->pdev, time64[0], time64[1]); in pp_do_ioctl()
636 jiffies_to_timespec64(pp->pdev->timeout, &ts); in pp_do_ioctl()
646 jiffies_to_timespec64(pp->pdev->timeout, &ts); in pp_do_ioctl()
659 dev_dbg(&pp->pdev->dev, "What? (cmd=0x%x)\n", cmd); in pp_do_ioctl()
680 struct pp_struct *pp; in pp_open() local
685 pp = kmalloc(sizeof(struct pp_struct), GFP_KERNEL); in pp_open()
686 if (!pp) in pp_open()
689 pp->state.mode = IEEE1284_MODE_COMPAT; in pp_open()
690 pp->state.phase = init_phase(pp->state.mode); in pp_open()
691 pp->flags = 0; in pp_open()
692 pp->irqresponse = 0; in pp_open()
693 atomic_set(&pp->irqc, 0); in pp_open()
694 init_waitqueue_head(&pp->irq_wait); in pp_open()
700 pp->pdev = NULL; in pp_open()
701 file->private_data = pp; in pp_open()
709 struct pp_struct *pp = file->private_data; in pp_release() local
713 if (!(pp->flags & PP_CLAIMED) && pp->pdev && in pp_release()
714 (pp->state.mode != IEEE1284_MODE_COMPAT)) { in pp_release()
718 parport_claim_or_block(pp->pdev); in pp_release()
719 pp->flags |= PP_CLAIMED; in pp_release()
720 info = &pp->pdev->port->ieee1284; in pp_release()
721 pp->saved_state.mode = info->mode; in pp_release()
722 pp->saved_state.phase = info->phase; in pp_release()
723 info->mode = pp->state.mode; in pp_release()
724 info->phase = pp->state.phase; in pp_release()
726 } else if ((pp->flags & PP_CLAIMED) && pp->pdev && in pp_release()
727 (pp->pdev->port->ieee1284.mode != IEEE1284_MODE_COMPAT)) { in pp_release()
731 parport_negotiate(pp->pdev->port, IEEE1284_MODE_COMPAT); in pp_release()
732 dev_dbg(&pp->pdev->dev, in pp_release()
736 if ((pp->flags & PP_CLAIMED) && pp->pdev) { in pp_release()
739 info = &pp->pdev->port->ieee1284; in pp_release()
740 pp->state.mode = info->mode; in pp_release()
741 pp->state.phase = info->phase; in pp_release()
742 info->mode = pp->saved_state.mode; in pp_release()
743 info->phase = pp->saved_state.phase; in pp_release()
744 parport_release(pp->pdev); in pp_release()
751 if (pp->pdev) { in pp_release()
752 parport_unregister_device(pp->pdev); in pp_release()
753 ida_simple_remove(&ida_index, pp->index); in pp_release()
754 pp->pdev = NULL; in pp_release()
758 kfree(pp); in pp_release()
766 struct pp_struct *pp = file->private_data; in pp_poll() local
769 poll_wait(file, &pp->irq_wait, wait); in pp_poll()
770 if (atomic_read(&pp->irqc)) in pp_poll()