Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4186757ybl; Mon, 9 Dec 2019 06:51:40 -0800 (PST) X-Google-Smtp-Source: APXvYqynMPmn/kLdB0YMdZv4TQi6sLlqW4jg5YLa/P6dG2eNlFlWeuoXpashd7XFYXuHzuOy1s3B X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr20952806otn.80.1575903100292; Mon, 09 Dec 2019 06:51:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575903100; cv=none; d=google.com; s=arc-20160816; b=UNbsSeASEuNlPTgmT4/LKROYikS3GY4UjguSIasqM3uGpztPdXBapcqc1AazVGlH8c 1JircIg7LojeXdpo+YA50ye+4OI71LIX0rmlsI/YGF4WmGzBdUUHx4qHNMVxAn5L9aUg E9FBGP1WM7+bFXm8UhN7NjpuU137gTnuiRVr0Z1cNrceN3mQ4rU6Qiodw3KZWdeON6dl 1W+JtlfMmhXZGB27eRxag/yQ4OtvDM/4kFjuvSaPxgvOo/znOKI8uzJb8uzGWlO9HYi8 e8lMMbGmHQRv5V42GnWsu7XtRJ6iEdqjsN9keFLsF76LNQ97R2u4046F61uP+zMfso3K Gdkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v6i9DrODxvVzc7sEu1n26IoTawSzw3EOrGL5427sW0Q=; b=GMS+huemcEBim2Y84bo8VQBpmqO4Z3gXY3oz5y99bCC23aXhkaOv5jnuTmGEuoo12g +O9dfQGOM/dAspcsp+2kv5RMnKVGdIHaxkVm8ch9laGaj3EOKBm5eeD+hIwyeLhdSQE1 3gjTZc/8FXG1iGgN94wqWW0/GAZwu06MQE8evRA3bNVpKCq5S9krbabPT8zk1eJtOM9P AbYBhjV29XDwtD0VzBXVEmllddF/cm916AAFjDDrk08/H8HLEbKBj/qfjVHbLFpK23pl E8Yfso9tmVsU/7dJ2jtQ8E7X1peezJyNS9rLmTTo5TZDCcS5Hhgs+khJbuB/Fa33Z2DQ OcsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qMW40Gli; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si1002266otf.32.2019.12.09.06.51.28; Mon, 09 Dec 2019 06:51:40 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qMW40Gli; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726741AbfLIOu1 (ORCPT + 99 others); Mon, 9 Dec 2019 09:50:27 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45579 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfLIOuX (ORCPT ); Mon, 9 Dec 2019 09:50:23 -0500 Received: by mail-wr1-f68.google.com with SMTP id j42so16459240wrj.12 for ; Mon, 09 Dec 2019 06:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v6i9DrODxvVzc7sEu1n26IoTawSzw3EOrGL5427sW0Q=; b=qMW40Glimuk8RCsOpQuJ/pexDlbz4FJLVtFyjhBvedGJfjxS4yJweoEhUs42NkR8ym ceaQO7flrjft3Ema57FQ4RUg5SaisdUyht8l2r3bp27a3Yqvf9KqWMFIb5hcuQD0MDck 6aTI0aVh5Kx5Gs/FBgPYx3Vvu043B0vg+XvmlVjhhNE/JHmgzKamOdPGvIxNv21VtyoU YBqmv46iNclra+yjNW58pyG8B0uXyXVQM2HgfWVZlMvZMgNNKD8zTu5wRNc6W7Fsb2oH sL+3hR/RGv9m+EYzbye8FGIEJijiVk6ee10zp4cGSW8cLTfwtxrCZ41IRcihwAKbQ30G xo6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v6i9DrODxvVzc7sEu1n26IoTawSzw3EOrGL5427sW0Q=; b=gAdX1CrsE+izSrUQK9P9e9zXjCtl9y+Ky3pZ8/vfPyH+DkoXG4cgZLxr9IjcEQHal2 BLEyjf//Dyc0f21A+d/3m7q21cWC+YdeOd2ENEABsc4JGP/P/1uZkxgxCmhLkUZr1N7Z CH2Jl8ri+/pEmKBh7XVTc0/rJDvy7IHE1OeZCba3s2AIImURCBtMyyv9MgbMLJr5rMCM zLEIZbzsqBldpeoqtVfa3ZaN26XIaPOJYud2AM+mZodfy1ixzHwD2+oQQrvLey0ELA6A XlWJPAvm2zmpSZMk7w8+IE1CKamrfBLiESufWicLQ7v5BhvKTD6AbRbKZIV2QSAoTxfV BqOA== X-Gm-Message-State: APjAAAV6bKbd3YB6aNqMt56VRhWhlF4I9aTeIvsIoXpQJ0FaSUnwo7FR nXOZ2ZQrDHxvClPO6eKObuw= X-Received: by 2002:adf:f6c8:: with SMTP id y8mr2576924wrp.167.1575903020783; Mon, 09 Dec 2019 06:50:20 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id a16sm26990396wrt.37.2019.12.09.06.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 06:50:19 -0800 (PST) From: Thierry Reding To: Joerg Roedel Cc: Will Deacon , Robin Murphy , David Woodhouse , Jean-Philippe Brucker , Christoph Hellwig , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] iommu: virtio: Use iommu_put_resv_regions_simple() Date: Mon, 9 Dec 2019 15:50:07 +0100 Message-Id: <20191209145007.2433144-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191209145007.2433144-1-thierry.reding@gmail.com> References: <20191209145007.2433144-1-thierry.reding@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Reding Use the new standard function instead of open-coding it. Cc: Jean-Philippe Brucker Cc: virtualization@lists.linux-foundation.org Signed-off-by: Thierry Reding --- Changes in v2: - change subject prefix to 'iommu: virt:' to 'iommu: virtio:' drivers/iommu/virtio-iommu.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 315c7cc4f99d..834e56a28d4d 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -837,14 +837,6 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head) iommu_dma_get_resv_regions(dev, head); } -static void viommu_put_resv_regions(struct device *dev, struct list_head *head) -{ - struct iommu_resv_region *entry, *next; - - list_for_each_entry_safe(entry, next, head, list) - kfree(entry); -} - static struct iommu_ops viommu_ops; static struct virtio_driver virtio_iommu_drv; @@ -914,7 +906,7 @@ static int viommu_add_device(struct device *dev) err_unlink_dev: iommu_device_unlink(&viommu->iommu, dev); err_free_dev: - viommu_put_resv_regions(dev, &vdev->resv_regions); + iommu_put_resv_regions_simple(dev, &vdev->resv_regions); kfree(vdev); return ret; @@ -932,7 +924,7 @@ static void viommu_remove_device(struct device *dev) iommu_group_remove_device(dev); iommu_device_unlink(&vdev->viommu->iommu, dev); - viommu_put_resv_regions(dev, &vdev->resv_regions); + iommu_put_resv_regions_simple(dev, &vdev->resv_regions); kfree(vdev); } @@ -961,7 +953,7 @@ static struct iommu_ops viommu_ops = { .remove_device = viommu_remove_device, .device_group = viommu_device_group, .get_resv_regions = viommu_get_resv_regions, - .put_resv_regions = viommu_put_resv_regions, + .put_resv_regions = iommu_put_resv_regions_simple, .of_xlate = viommu_of_xlate, }; -- 2.23.0