oxfw-stream.c (05588d340a128ff5c7b768c517150e31842a78aa) | oxfw-stream.c (8985f4ac1c42bd25799f294f4e87fa73064673c7) |
---|---|
1/* 2 * oxfw_stream.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) 2014 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 630 unchanged lines hidden (view full) --- 639 } 640 641 /* use iPCR[0] if exists */ 642 if (plugs[0] > 0) 643 err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_IN, 0); 644end: 645 return err; 646} | 1/* 2 * oxfw_stream.c - a part of driver for OXFW970/971 based devices 3 * 4 * Copyright (c) 2014 Takashi Sakamoto 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 630 unchanged lines hidden (view full) --- 639 } 640 641 /* use iPCR[0] if exists */ 642 if (plugs[0] > 0) 643 err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_IN, 0); 644end: 645 return err; 646} |
647 648void snd_oxfw_stream_lock_changed(struct snd_oxfw *oxfw) 649{ 650 oxfw->dev_lock_changed = true; 651 wake_up(&oxfw->hwdep_wait); 652} 653 654int snd_oxfw_stream_lock_try(struct snd_oxfw *oxfw) 655{ 656 int err; 657 658 spin_lock_irq(&oxfw->lock); 659 660 /* user land lock this */ 661 if (oxfw->dev_lock_count < 0) { 662 err = -EBUSY; 663 goto end; 664 } 665 666 /* this is the first time */ 667 if (oxfw->dev_lock_count++ == 0) 668 snd_oxfw_stream_lock_changed(oxfw); 669 err = 0; 670end: 671 spin_unlock_irq(&oxfw->lock); 672 return err; 673} 674 675void snd_oxfw_stream_lock_release(struct snd_oxfw *oxfw) 676{ 677 spin_lock_irq(&oxfw->lock); 678 679 if (WARN_ON(oxfw->dev_lock_count <= 0)) 680 goto end; 681 if (--oxfw->dev_lock_count == 0) 682 snd_oxfw_stream_lock_changed(oxfw); 683end: 684 spin_unlock_irq(&oxfw->lock); 685} |
|