Ticket #2930: takashi.patch

File takashi.patch, 2.1 KB (added by birdie, 7 years ago)
  • sound/usb/endpoint.c

    diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
    index d9de667..38830e2 100644
    a b  
    3535 
    3636#define EP_FLAG_ACTIVATED       0 
    3737#define EP_FLAG_RUNNING         1 
     38#define EP_FLAG_STOPPING        2 
    3839 
    3940/* 
    4041 * snd_usb_endpoint is a model that abstracts everything related to an 
    static int wait_clear_urbs(struct snd_usb_endpoint *ep) 
    502503        if (alive) 
    503504                snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", 
    504505                                        alive, ep->ep_num); 
     506        clear_bit(EP_FLAG_STOPPING, &ep->flags); 
    505507 
    506508        return 0; 
    507509} 
    508510 
     511/* wait until urbs are really dropped */ 
     512void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep) 
     513{ 
     514        if (test_bit(EP_FLAG_STOPPING, &ep->flags)) 
     515                wait_clear_urbs(ep); 
     516} 
     517 
     518 
    509519/* 
    510520 * unlink active urbs. 
    511521 */ 
    void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, 
    913923 
    914924                if (wait) 
    915925                        wait_clear_urbs(ep); 
     926                else 
     927                        set_bit(EP_FLAG_STOPPING, &ep->flags); 
    916928        } 
    917929} 
    918930 
  • sound/usb/endpoint.h

    diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
    index cbbbdf2..c1540a4 100644
    a b int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, 
    1616int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep); 
    1717void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, 
    1818                           int force, int can_sleep, int wait); 
     19void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep); 
    1920int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); 
    2021int  snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); 
    2122void snd_usb_endpoint_free(struct list_head *head); 
  • sound/usb/pcm.c

    diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
    index f782ce1..aee3ab0 100644
    a b static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) 
    546546        if (snd_BUG_ON(!subs->data_endpoint)) 
    547547                return -EIO; 
    548548 
     549        if (subs->sync_endpoint) 
     550                snd_usb_endpoint_sync_stop(subs->sync_endpoint); 
     551        if (subs->data_endpoint) 
     552                snd_usb_endpoint_sync_stop(subs->data_endpoint); 
     553 
    549554        /* some unit conversions in runtime */ 
    550555        subs->data_endpoint->maxframesize = 
    551556                bytes_to_frames(runtime, subs->data_endpoint->maxpacksize);