motu-stream.c (9e796e7d59e71f8a556cfbdc2ffa3aff0555dd0e) | motu-stream.c (71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1) |
---|---|
1/* 2 * motu-stream.c - a part of driver for MOTU FireWire series 3 * 4 * Copyright (c) 2015-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp> 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 327 unchanged lines hidden (view full) --- 336void snd_motu_stream_destroy_duplex(struct snd_motu *motu) 337{ 338 destroy_stream(motu, AMDTP_IN_STREAM); 339 destroy_stream(motu, AMDTP_OUT_STREAM); 340 341 motu->playback_substreams = 0; 342 motu->capture_substreams = 0; 343} | 1/* 2 * motu-stream.c - a part of driver for MOTU FireWire series 3 * 4 * Copyright (c) 2015-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp> 5 * 6 * Licensed under the terms of the GNU General Public License, version 2. 7 */ 8 --- 327 unchanged lines hidden (view full) --- 336void snd_motu_stream_destroy_duplex(struct snd_motu *motu) 337{ 338 destroy_stream(motu, AMDTP_IN_STREAM); 339 destroy_stream(motu, AMDTP_OUT_STREAM); 340 341 motu->playback_substreams = 0; 342 motu->capture_substreams = 0; 343} |
344 345static void motu_lock_changed(struct snd_motu *motu) 346{ 347 motu->dev_lock_changed = true; 348 wake_up(&motu->hwdep_wait); 349} 350 351int snd_motu_stream_lock_try(struct snd_motu *motu) 352{ 353 int err; 354 355 spin_lock_irq(&motu->lock); 356 357 if (motu->dev_lock_count < 0) { 358 err = -EBUSY; 359 goto out; 360 } 361 362 if (motu->dev_lock_count++ == 0) 363 motu_lock_changed(motu); 364 err = 0; 365out: 366 spin_unlock_irq(&motu->lock); 367 return err; 368} 369 370void snd_motu_stream_lock_release(struct snd_motu *motu) 371{ 372 spin_lock_irq(&motu->lock); 373 374 if (WARN_ON(motu->dev_lock_count <= 0)) 375 goto out; 376 377 if (--motu->dev_lock_count == 0) 378 motu_lock_changed(motu); 379out: 380 spin_unlock_irq(&motu->lock); 381} |
|