From nobody Mon Feb 9 00:30:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618308140; cv=none; d=zohomail.com; s=zohoarc; b=d4e9hJoBQkfbJbRMSgEp3Q5LCBRc4nSNucegYrQP+IMAuwOicl/uyYSzFhu1IDbJXQaVlO+pNhfgp2qAnsMh6wyCJjR9MDOplN0phLH2MhJ1IdvrmLe+d9Z2PtjJe0B9GY/IiMWL1exknRqT4+KgMIHIxo2+0cvKEUkJI8dF+dU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618308140; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FD6BqgaJK/m25Ynci2rHsqUkUZKgJGt9WGugY2DORkM=; b=AHRg2OIp49wnPJIAkIIHB+YWJLE4UdZgxouFZPMZkyfEOgmbXcCEPchlZaYCZLagd7IvE/ybdyy+PmygwaZj0CxbCaFKxk7yT3lAUbMfsl1wMB546yy+Tw0TN85EWcwD1Tqj1Tcd+Sw7hHUh9ZBJiRZza50LO0bJO+l7ZzsDuhc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1618308140094462.35194112886415; Tue, 13 Apr 2021 03:02:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-572-Uyw8yDBgM4G0wdO-E-nL2w-1; Tue, 13 Apr 2021 06:02:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E59AB881286; Tue, 13 Apr 2021 10:02:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFBCA5D9DE; Tue, 13 Apr 2021 10:02:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 753C11806D17; Tue, 13 Apr 2021 10:02:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13DA27KX011379 for ; Tue, 13 Apr 2021 06:02:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id E71FC1042A9C; Tue, 13 Apr 2021 10:02:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 693E810429F0 for ; Tue, 13 Apr 2021 10:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618308138; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FD6BqgaJK/m25Ynci2rHsqUkUZKgJGt9WGugY2DORkM=; b=TCVgs9cuMgKRLQfBxWmzKLY5WNRAhSBlefsixPolSix+uDyhc7tmuOAXSfX4hj3aqFg9Hk x4pHz8usEQjFOra6C2wNKViN7j0GJ5XaytueeOnWfwB1ug1V3Jq7/eprxneDZETUTtvZSa wU83tcqcP24GFnt6b2hRhX9GmJC1AFo= X-MC-Unique: Uyw8yDBgM4G0wdO-E-nL2w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/6] nodedev: Introduce nodeDeviceInitComplete() Date: Tue, 13 Apr 2021 12:01:55 +0200 Message-Id: <6e85181cfb34a61a226e079f5391df0df749135a.1618307981.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When the device enumeration thread finishes it sets the driver->initialized boolean and signals condition to wake up other threads that are waiting for the initialization to complete. Move this code into a separate function so that it can be re-used from other places too. Signed-off-by: Michal Privoznik --- src/node_device/node_device_driver.c | 10 ++++++++++ src/node_device/node_device_driver.h | 2 ++ src/node_device/node_device_udev.c | 5 +---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index bc8a758c1c..2bb83c19f2 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -157,6 +157,16 @@ nodeDeviceUnlock(void) } =20 =20 +void +nodeDeviceInitComplete(void) +{ + nodeDeviceLock(); + driver->initialized =3D true; + virCondBroadcast(&driver->initCond); + nodeDeviceUnlock(); +} + + static int nodeDeviceInitWait(void) { diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index 8a935ffed6..7160f551db 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -39,6 +39,8 @@ nodeDeviceLock(void); void nodeDeviceUnlock(void); =20 +void nodeDeviceInitComplete(void); + extern virNodeDeviceDriverStatePtr driver; =20 int diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 20a13211a0..68547c6986 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1984,10 +1984,7 @@ nodeStateInitializeEnumerate(void *opaque) if (nodeDeviceUpdateMediatedDevices() !=3D 0) goto error; =20 - nodeDeviceLock(); - driver->initialized =3D true; - virCondBroadcast(&driver->initCond); - nodeDeviceUnlock(); + nodeDeviceInitComplete(); =20 return; =20 --=20 2.26.3