From nobody Mon Feb 9 14:32:34 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=1607477885; cv=none; d=zohomail.com; s=zohoarc; b=CDvnrglsZVtKlD0x4a86mn9mHTgnC+H0uNrQWTY6D29H9RAGmNeRvrCXcqQSHcFdhaNq6uHQGeijxm1x1uIrTr5hhINabAVObPP9JLPF4VuNHyPrfazb3eZ5wtmKxih9hyf88Yotx1W5X8PbHYa7WsN+evl3joPyr6Wl5fHHYNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607477885; 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=SwLpD5NqkdXY1AYIKGCuq8JUTymUN7TIYykMLAnFkmY=; b=gPBrhdF/uppE0beYWGn0Ok/4QFyCmBwFO9he7XZ1hMLegj2wfD3DWu+NsmG286TlJloBjqyjKOn6asvn4fEvPLr/9sIsSGPltjpAWvrVQBByJqmM/uqlZGIr7MTOJ8GkRKj+Lhh1jeQ0PBULYU+pZKRTEocz89Bb2rJbZnjd1Lk= 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 1607477885504849.6168709997629; Tue, 8 Dec 2020 17:38:05 -0800 (PST) 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-438-5RKnfIvxPjad_ifICm51Vg-1; Tue, 08 Dec 2020 20:38:02 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E399618C89CF; Wed, 9 Dec 2020 01:37:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9476B19C78; Wed, 9 Dec 2020 01:37:55 +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 DD4524A7C6; Wed, 9 Dec 2020 01:37:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B91bqHH007397 for ; Tue, 8 Dec 2020 20:37:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 093E25D6D5; Wed, 9 Dec 2020 01:37:52 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-50.phx2.redhat.com [10.3.112.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id C53855D6AB for ; Wed, 9 Dec 2020 01:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607477884; 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=SwLpD5NqkdXY1AYIKGCuq8JUTymUN7TIYykMLAnFkmY=; b=AYBV9SB6z2+pyuUWoi7098+pgjB7aX4EntRArpsAwcnEWInIG189sHCVBb8Gp892c7XhzD MH/Z6bOC6KGmYfdYht9WjPDVQN349Tq3ACBP7+hPMmaftvXexx7MG5is1KZCaZdoADM77d t4KR+M8wnSlLv42x0AmiMAdkLX69LZc= X-MC-Unique: 5RKnfIvxPjad_ifICm51Vg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 3/7] util: simplify call to virPCIDeviceDetectPowerManagementReset() Date: Tue, 8 Dec 2020 20:37:41 -0500 Message-Id: <20201209013745.599662-4-laine@redhat.com> In-Reply-To: <20201209013745.599662-1-laine@redhat.com> References: <20201209013745.599662-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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" This function returned an int, but would only return 0 or 1, and the one place it was called would just use !! to convert that value to a bool. Change the function to directly return bool instead. Signed-off-by: Laine Stump --- src/util/virpci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 403ef1ec8e..31622cddfa 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -608,7 +608,7 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) * and that a D3hot->D0 transition will results in a full * internal reset, not just a soft reset. */ -static unsigned int +static bool virPCIDeviceDetectPowerManagementReset(virPCIDevicePtr dev, int cfgfd) { if (dev->pci_pm_cap_pos) { @@ -618,13 +618,13 @@ virPCIDeviceDetectPowerManagementReset(virPCIDevicePt= r dev, int cfgfd) ctl =3D virPCIDeviceRead32(dev, cfgfd, dev->pci_pm_cap_pos + PCI_P= M_CTRL); if (!(ctl & PCI_PM_CTRL_NO_SOFT_RESET)) { VIR_DEBUG("%s %s: detected PM reset capability", dev->id, dev-= >name); - return 1; + return true; } } =20 VIR_DEBUG("%s %s: no PM reset capability found", dev->id, dev->name); =20 - return 0; + return false; } =20 /* Any active devices on the same domain/bus ? */ @@ -888,7 +888,7 @@ virPCIDeviceInit(virPCIDevicePtr dev, int cfgfd) dev->pcie_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_EXP); dev->pci_pm_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_PM); dev->has_flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); - dev->has_pm_reset =3D !!virPCIDeviceDetectPowerManagementReset(dev, cf= gfd); + dev->has_pm_reset =3D virPCIDeviceDetectPowerManagementReset(dev, cfgf= d); =20 return 0; } --=20 2.28.0