Received: by 10.192.165.148 with SMTP id m20csp567663imm; Fri, 20 Apr 2018 11:20:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/d/K5oNTWGaeuznUai1eBTJvwua6jLhah2zxYwdl5st8CUicVEnwNpSjEbsv4bR/lyHt39 X-Received: by 10.101.93.14 with SMTP id e14mr9351054pgr.353.1524248416940; Fri, 20 Apr 2018 11:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524248416; cv=none; d=google.com; s=arc-20160816; b=UsY4xE7hLgxZ0zSsVokaOYSDtpJGb/GmU+BPp6+9it/iRundkZpizObpC0bGGtlAkH OdxTJ6lRycNP9mKn0FFkdcmL2Oc6ZdekbcTBLFCWtiswCbg+NGaTfExz919p8CTXj+g1 rcBEj2Oc8UaM3BQv2l/Xfm1HTrd6RSZYqF+U5SfLMIyKqfqF9D7OWe/a2BiIElr2AyTd t8erhAwg65sisvPfMSa+8OYSnnUjjvWWaNXuEl/OlREaRHkXeGOhlLmBQOmC5X1/kp9s Xo22jTzGA1VG/BP5636E+98ulqUsamU4nbrVKG2bOyt0UjArzr0nKrlhXQGaU36laEdB hkXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Uiv/XOpcfAUsdumQ+aiIEb3JZHM0cUyi4cfPRDOpbRE=; b=fMcIDTWoty2yuH54ppgWPrLteMYNP2dEKT3HTpVzrmEpwGiMR3QijLbw6dDP6uf7Wn dyDrzpcSy174BhQwOMrtNthPfNtOsjJXSxUwPAOxZG7294fb0BMCCW20o4EqlrWYFJuZ n3OHNuD+yuZPffdz9q9pLTwt5osyXW02VnYhyiLWiyxde3rA5jKgX26zgqeshdKHpYY9 jWMrG0HBOfDbOMhiSApc2ZFkNSAoCJvGuok6/tM0o8BdRstLn0n1XjLlmUH6pqZ0n3q+ GDh45x+CNrdOadG0OWSSuu2ZnRgM3q44rIwQ3hn1c3n3Jxc1cIYJCvr9ry4brTpf0poK 9zqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si5303086pga.128.2018.04.20.11.20.02; Fri, 20 Apr 2018 11:20:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753818AbeDTSSG (ORCPT + 99 others); Fri, 20 Apr 2018 14:18:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753706AbeDTSSD (ORCPT ); Fri, 20 Apr 2018 14:18:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C30DAEC004; Fri, 20 Apr 2018 18:18:02 +0000 (UTC) Received: from redhat.com (ovpn-126-37.rdu2.redhat.com [10.10.126.37]) by smtp.corp.redhat.com (Postfix) with SMTP id 521812026DFD; Fri, 20 Apr 2018 18:18:02 +0000 (UTC) Date: Fri, 20 Apr 2018 21:18:02 +0300 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Amit Shah , Arnd Bergmann , Greg Kroah-Hartman , virtualization@lists.linux-foundation.org, stable@vger.kernel.org, Tiwei Bie , Jason Wang Subject: [PATCH 2/6] virtio: add ability to iterate over vqs Message-ID: <1524248223-393618-3-git-send-email-mst@redhat.com> References: <1524248223-393618-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524248223-393618-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 20 Apr 2018 18:18:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 20 Apr 2018 18:18:02 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For cleanup it's helpful to be able to simply scan all vqs and discard all data. Add an iterator to do that. Signed-off-by: Michael S. Tsirkin --- include/linux/virtio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 988c735..fa1b5da 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -157,6 +157,9 @@ int virtio_device_freeze(struct virtio_device *dev); int virtio_device_restore(struct virtio_device *dev); #endif +#define virtio_device_for_each_vq(vdev, vq) \ + list_for_each_entry(vq, &vdev->vqs, list) + /** * virtio_driver - operations for a virtio I/O driver * @driver: underlying device driver (populate name and owner). -- MST