Lines Matching refs:epdata

276 	struct ep_data	*epdata = ep->driver_data;  in epio_complete()  local
281 epdata->status = req->status; in epio_complete()
283 epdata->status = req->actual; in epio_complete()
291 get_ready_ep (unsigned f_flags, struct ep_data *epdata, bool is_write) in get_ready_ep() argument
296 if (!mutex_trylock(&epdata->lock)) in get_ready_ep()
298 if (epdata->state != STATE_EP_ENABLED && in get_ready_ep()
299 (!is_write || epdata->state != STATE_EP_READY)) { in get_ready_ep()
300 mutex_unlock(&epdata->lock); in get_ready_ep()
308 val = mutex_lock_interruptible(&epdata->lock); in get_ready_ep()
312 switch (epdata->state) { in get_ready_ep()
324 shortname, epdata, epdata->state); in get_ready_ep()
326 mutex_unlock(&epdata->lock); in get_ready_ep()
331 ep_io (struct ep_data *epdata, void *buf, unsigned len) in ep_io() argument
336 spin_lock_irq (&epdata->dev->lock); in ep_io()
337 if (likely (epdata->ep != NULL)) { in ep_io()
338 struct usb_request *req = epdata->req; in ep_io()
344 value = usb_ep_queue (epdata->ep, req, GFP_ATOMIC); in ep_io()
347 spin_unlock_irq (&epdata->dev->lock); in ep_io()
352 spin_lock_irq (&epdata->dev->lock); in ep_io()
353 if (likely (epdata->ep != NULL)) { in ep_io()
354 DBG (epdata->dev, "%s i/o interrupted\n", in ep_io()
355 epdata->name); in ep_io()
356 usb_ep_dequeue (epdata->ep, epdata->req); in ep_io()
357 spin_unlock_irq (&epdata->dev->lock); in ep_io()
360 if (epdata->status == -ECONNRESET) in ep_io()
361 epdata->status = -EINTR; in ep_io()
363 spin_unlock_irq (&epdata->dev->lock); in ep_io()
365 DBG (epdata->dev, "endpoint gone\n"); in ep_io()
367 epdata->status = -ENODEV; in ep_io()
370 return epdata->status; in ep_io()
433 struct ep_data *epdata; member
446 struct ep_data *epdata; in ep_aio_cancel() local
450 epdata = priv->epdata; in ep_aio_cancel()
452 if (likely(epdata && epdata->ep && priv->req)) in ep_aio_cancel()
453 value = usb_ep_dequeue (epdata->ep, priv->req); in ep_aio_cancel()
487 struct ep_data *epdata = priv->epdata; in ep_aio_complete() local
490 spin_lock(&epdata->dev->lock); in ep_aio_complete()
492 priv->epdata = NULL; in ep_aio_complete()
508 DBG(epdata->dev, "%s fault %d len %d\n", in ep_aio_complete()
518 spin_unlock(&epdata->dev->lock); in ep_aio_complete()
519 put_ep(epdata); in ep_aio_complete()
524 struct ep_data *epdata, in ep_aio() argument
535 get_ep(epdata); in ep_aio()
536 priv->epdata = epdata; in ep_aio()
543 spin_lock_irq(&epdata->dev->lock); in ep_aio()
545 if (unlikely(epdata->ep == NULL)) in ep_aio()
548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC); in ep_aio()
558 value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC); in ep_aio()
560 usb_ep_free_request(epdata->ep, req); in ep_aio()
563 spin_unlock_irq(&epdata->dev->lock); in ep_aio()
567 spin_unlock_irq(&epdata->dev->lock); in ep_aio()
570 put_ep(epdata); in ep_aio()
578 struct ep_data *epdata = file->private_data; in ep_read_iter() local
583 if ((value = get_ready_ep(file->f_flags, epdata, false)) < 0) in ep_read_iter()
587 if (usb_endpoint_dir_in(&epdata->desc)) { in ep_read_iter()
588 if (usb_endpoint_xfer_isoc(&epdata->desc) || in ep_read_iter()
590 mutex_unlock(&epdata->lock); in ep_read_iter()
593 DBG (epdata->dev, "%s halt\n", epdata->name); in ep_read_iter()
594 spin_lock_irq(&epdata->dev->lock); in ep_read_iter()
595 if (likely(epdata->ep != NULL)) in ep_read_iter()
596 usb_ep_set_halt(epdata->ep); in ep_read_iter()
597 spin_unlock_irq(&epdata->dev->lock); in ep_read_iter()
598 mutex_unlock(&epdata->lock); in ep_read_iter()
604 mutex_unlock(&epdata->lock); in ep_read_iter()
608 value = ep_io(epdata, buf, len); in ep_read_iter()
621 value = ep_aio(iocb, priv, epdata, buf, len); in ep_read_iter()
627 mutex_unlock(&epdata->lock); in ep_read_iter()
637 struct ep_data *epdata = file->private_data; in ep_write_iter() local
643 if ((value = get_ready_ep(file->f_flags, epdata, true)) < 0) in ep_write_iter()
646 configured = epdata->state == STATE_EP_ENABLED; in ep_write_iter()
649 if (configured && !usb_endpoint_dir_in(&epdata->desc)) { in ep_write_iter()
650 if (usb_endpoint_xfer_isoc(&epdata->desc) || in ep_write_iter()
652 mutex_unlock(&epdata->lock); in ep_write_iter()
655 DBG (epdata->dev, "%s halt\n", epdata->name); in ep_write_iter()
656 spin_lock_irq(&epdata->dev->lock); in ep_write_iter()
657 if (likely(epdata->ep != NULL)) in ep_write_iter()
658 usb_ep_set_halt(epdata->ep); in ep_write_iter()
659 spin_unlock_irq(&epdata->dev->lock); in ep_write_iter()
660 mutex_unlock(&epdata->lock); in ep_write_iter()
666 mutex_unlock(&epdata->lock); in ep_write_iter()
676 value = ep_config(epdata, buf, len); in ep_write_iter()
678 value = ep_io(epdata, buf, len); in ep_write_iter()
683 value = ep_aio(iocb, priv, epdata, buf, len); in ep_write_iter()
690 mutex_unlock(&epdata->lock); in ep_write_iter()