From nobody Mon Feb 9 11:28:40 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=1607701747; cv=none; d=zohomail.com; s=zohoarc; b=C8XEUiFB+TKX9/ygaleSczaQ/Tahdp7rH6kTGmMxuJwVALqbaoAhLqOQdC4dnn1SYOV6xWHMIVw/iayhTGWjKKkcq9X7tAD814lb/YsZKFIGmDUop3QiEOi1dSN0SgZuXZTQoUAfCQ8KXW/CNscYenkuDvuF2qNFJc24XjbaKOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701747; 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=hBf5Y+GVH5ON8pMzto1xHTghC2xNmKBnhYfs9hkd4fQ3sFZoxGAJDBakArckiRePYqIeVwhuHbAWViJyfniyQZnz6yG3rsWv9uKUQcvv6ZpmWDC5YsFp7dnyHDIIqCbCiaQe+RFZSfD7aeT/4Sa4BohP+XCN0h4xDUAuUoz73nA= 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 1607701747032440.9167361995068; Fri, 11 Dec 2020 07:49:07 -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-405-zGEF6JenMl-wSZvbu8ivfA-1; Fri, 11 Dec 2020 10:48:07 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5AFA802B42; Fri, 11 Dec 2020 15:48:00 +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 AFF5C100239F; Fri, 11 Dec 2020 15:48:00 +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 6DF7C1809C9F; Fri, 11 Dec 2020 15:48:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlWd8013800 for ; Fri, 11 Dec 2020 10:47:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0642A60BFA; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id C217560BF1 for ; Fri, 11 Dec 2020 15:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701745; 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=gZ6RIRFyMNTLVYA+JN1rNv38oCdZSZrKBPVH8KRezdRyQp3ipkV7jKu1MJQdgO+mxcFCoe vKkorwLyLeu0iFVKNHKfi8uQeDv6zzwQGbPp55FCM6K1JO9JuIWG+G1FhA1ujQPS2lmDia CRUmVYitx/Bc6dTSFJ/lOcTGUuRWAdg= X-MC-Unique: zGEF6JenMl-wSZvbu8ivfA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/7] util: simplify call to virPCIDeviceDetectPowerManagementReset() Date: Fri, 11 Dec 2020 10:47:24 -0500 Message-Id: <20201211154728.1117948-4-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.22 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