qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

audio/jack: simplify the re-init code path

Instead of checking for the audodev state in each code path, centralize
the check into the initialize function itself to make it safe to call it
at any time.

Signed-off-by: Geoffrey McRae <geoff@hostfission.com>
Message-id: 20200613040518.38172-7-geoff@hostfission.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Geoffrey McRae and committed by
Gerd Hoffmann
bc81e6e5 81e0efb2

+6 -6
+6 -6
audio/jackaudio.c
··· 395 395 char client_name[jack_client_name_size()]; 396 396 jack_options_t options = JackNullOption; 397 397 398 + if (c->state == QJACK_STATE_RUNNING) { 399 + return 0; 400 + } 401 + 398 402 c->connect_ports = true; 399 403 400 404 snprintf(client_name, sizeof(client_name), "%s-%s", ··· 485 489 QJackOut *jo = (QJackOut *)hw; 486 490 Audiodev *dev = (Audiodev *)drv_opaque; 487 491 488 - if (jo->c.state != QJACK_STATE_DISCONNECTED) { 489 - return 0; 490 - } 492 + qjack_client_fini(&jo->c); 491 493 492 494 jo->c.out = true; 493 495 jo->c.enabled = false; ··· 523 525 QJackIn *ji = (QJackIn *)hw; 524 526 Audiodev *dev = (Audiodev *)drv_opaque; 525 527 526 - if (ji->c.state != QJACK_STATE_DISCONNECTED) { 527 - return 0; 528 - } 528 + qjack_client_fini(&ji->c); 529 529 530 530 ji->c.out = false; 531 531 ji->c.enabled = false;