Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13624529pxu; Sun, 3 Jan 2021 23:01:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5c9IX5fQSGwXWevLU5dMRJBzkLuSwmMGbR5mWS7Ac5vMBDzhBRhEwTbC8xuR91wcm4cw0 X-Received: by 2002:a17:906:1199:: with SMTP id n25mr63942307eja.293.1609743690172; Sun, 03 Jan 2021 23:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609743690; cv=none; d=google.com; s=arc-20160816; b=ESBfO9j9iEMZydXc9dVTdhtpmomjDWO3iAGVSwjIzROM29EXisDaHompYrVHJwqQqr sFRV1fgRpuc0Hri0cBBR0FfMIowMkaX+axHp8gxhNVi7AOreMvRkGMerWp1e9KxDElaR WXHYco6r6av5Sn1Y2iB76k5/+NrE8HYO2zMbNiXOCxhaSqrhzwEmuAr+2BZXeipwLpwR uG0uu3YclCiaW1kH0MgUuvaMqpu0gCO0IeRYRR+ghiLpZuthMP3IFDtD1o+/43vuTCm8 fpSa9q74jAqX0MbSKe/MOlnpMbFVkHR3Mdeqmz3h+Cg7tOwcDYAFqsoxuqb67OfovUcC u/7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zsLbOav7/E39nNDxLtrE61Pdclqr7iYbX9oecocZesI=; b=b5MQuBOSjSnQFdlmfdGVd14zqSrkVYiPHRpXHmhRq/uYYmnYGlllWl76Ak4Cii6Nyy B8O0SmUQbF0virp+dIuWGv2OGwt8l5jDLXqC3pu8PZsuunPe642x6/x5JESyeOIlbC3N jxHrSH1qq4z/GLZsupi3RU9o1kv6XlVQJuhkU2YCPUXkBhAR7r56F8+yHkhajAK6nauB ScWMs0n6Xrq9lPAazXfZRyBpgv3ot4Vbiv4zxdwqMQUbBr/L7qTT9vntjHzvbnLrzE6z qYNFjQTxvNrdSXoYZcm8Hh0Ths3NTRhGKLGlIzj5lycpE/vo1/yfPw48v64639l7dfrv 8SHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Eg1ttEPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa14si25362006ejb.54.2021.01.03.23.01.07; Sun, 03 Jan 2021 23:01:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Eg1ttEPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbhADG45 (ORCPT + 99 others); Mon, 4 Jan 2021 01:56:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46851 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728050AbhADG44 (ORCPT ); Mon, 4 Jan 2021 01:56:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609743330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zsLbOav7/E39nNDxLtrE61Pdclqr7iYbX9oecocZesI=; b=Eg1ttEPrKlUeKIM4GXhSSaVfvmiPev9FIBijj98VNXk9nr7njazmG56dYdLJ7O+QoJaEhU ejAWAx4rBkEYVNbcfYnQ7qgkKl+hc6IfzrXCaIha2dYkLT2O+hweS3CKSBtJAXTZYRyT1i b137+8bt6UD44AQ7nWu0RVGzewKrpw8= 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-583-n0WDfo1iMImY1CwnHcayjQ-1; Mon, 04 Jan 2021 01:55:25 -0500 X-MC-Unique: n0WDfo1iMImY1CwnHcayjQ-1 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 5C3B659; Mon, 4 Jan 2021 06:55:24 +0000 (UTC) Received: from jason-ThinkPad-X1-Carbon-6th.redhat.com (ovpn-13-91.pek2.redhat.com [10.72.13.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEBBA1002388; Mon, 4 Jan 2021 06:55:21 +0000 (UTC) From: Jason Wang To: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: shahafs@mellanox.com, lulu@redhat.com, sgarzare@redhat.com, rdunlap@infradead.org, Jason Wang Subject: [PATCH V3 04/19] virtio-pci-modern: introduce vp_modern_remove() Date: Mon, 4 Jan 2021 14:54:48 +0800 Message-Id: <20210104065503.199631-5-jasowang@redhat.com> In-Reply-To: <20210104065503.199631-1-jasowang@redhat.com> References: <20210104065503.199631-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces vp_modern_remove() doing device resources cleanup to make it can be used. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index 5d2d2ae0dfdb..4be9afad547e 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -873,9 +873,12 @@ int virtio_pci_modern_probe(struct virtio_pci_device *vp_dev) return 0; } -void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev) +/* + * vp_modern_probe: remove and cleanup the modern virtio pci device + * @mdev: the modern virtio-pci device + */ +static void vp_modern_remove(struct virtio_pci_modern_device *mdev) { - struct virtio_pci_modern_device *mdev = &vp_dev->mdev; struct pci_dev *pci_dev = mdev->pci_dev; if (mdev->device) @@ -886,3 +889,10 @@ void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev) pci_iounmap(pci_dev, mdev->common); pci_release_selected_regions(pci_dev, mdev->modern_bars); } + +void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev) +{ + struct virtio_pci_modern_device *mdev = &vp_dev->mdev; + + vp_modern_remove(mdev); +} -- 2.25.1