From patchwork Thu Jun 2 15:55:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9150835 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7841760221 for ; Thu, 2 Jun 2016 16:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6972028310 for ; Thu, 2 Jun 2016 16:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CB2A28319; Thu, 2 Jun 2016 16:06:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E049720410 for ; Thu, 2 Jun 2016 16:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161296AbcFBQG2 (ORCPT ); Thu, 2 Jun 2016 12:06:28 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:36276 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161260AbcFBQGZ (ORCPT ); Thu, 2 Jun 2016 12:06:25 -0400 Received: by mail-pa0-f68.google.com with SMTP id fg1so3654693pad.3; Thu, 02 Jun 2016 09:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=MZxXHe12A9/E+OHRFb8GF7fBJssMpkOinCJkYtD8K7g=; b=AOOpkXTLWu2UnTUH0zoDL9mlm1acyvW1nB+XRqiwq/aMfJ6Y32bOf2FfmQZWH7/QEP AN2sZDNbqoi5VmlNqfrrwkJTLa1wasc+cuhnkWCxZw+evggdNG/EZ5OSFhCI0vjpXKaD CeydQEA6YdyeZLRNFdZSSxS93x2ErN3lCjpZKn8pt4GywK5Oy7qa70MZKbwPeBa/dIee e0RBprizm4yPwB68B3jNqyVk8lP6xbA/NvYoLvSJ5wKxoDmEj8N28/phQo0X+peJJxLe cyO6yYkqLFqHWqtKpVg+fbSlo0wy5QPRCHGBnx5Hvbhi3C6nVJtfCLIUjayLSIXbt2EV wycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=MZxXHe12A9/E+OHRFb8GF7fBJssMpkOinCJkYtD8K7g=; b=lC8V1DKlcvkNiFHK8PvGdD0Jo3Z082uH/WEdKCdHC6jNStZmqx8/w/B5jRSHROOXyx laOAvpxeuomGD+kYs5n0nQi7vzrNSM7yMdQdYKHPRp6wHNDR54YuXn2wZZuBVrP/kRma cIfX/ibJTbuSiW8+QPKAPqVOsTR7MbyPL4fcRLJo2K1MjxPS41ML7NED4nMGcNwwqEv9 rbAfkH2p9NyWH9X+DOM8aRtyrSempLCNqDT1ygySwoVAm/QjL7XwLbvUckaghW7Jsq7S RxHTOBRJqSkSx374goURs19+PnNdtq6NOD+9S3c7el13LGWshkLg9qk9ee9e7+Xiymxm siHw== X-Gm-Message-State: ALyK8tK2/L2AfDxwlL4f0Y187ocTLDoJipnJi6/zLjwRI9BLpdxDx2FDHCmeh9OiVuTVRA== X-Received: by 10.66.123.69 with SMTP id ly5mr6496699pab.57.1464883584222; Thu, 02 Jun 2016 09:06:24 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id j3sm1826813pfk.94.2016.06.02.09.06.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 09:06:23 -0700 (PDT) From: Magnus Damm To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm , robin.murphy@arm.com, m.szyprowski@samsung.com Date: Fri, 03 Jun 2016 00:55:59 +0900 Message-Id: <20160602155559.31018.23972.sendpatchset@little-apple> In-Reply-To: <20160602155519.31018.59925.sendpatchset@little-apple> References: <20160602155519.31018.59925.sendpatchset@little-apple> Subject: [PATCH v3 04/06] iommu/ipmmu-vmsa: Break out domain allocation code Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Break out the domain allocation code into a separate function. This is preparation for future code sharing. Signed-off-by: Magnus Damm --- Changes since V2: - Included this new patch as-is from the following series: [PATCH 00/04] iommu/ipmmu-vmsa: IPMMU CONFIG_IOMMU_DMA update drivers/iommu/ipmmu-vmsa.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- 0005/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-02 20:58:41.820607110 +0900 @@ -506,13 +506,10 @@ static irqreturn_t ipmmu_irq(int irq, vo * IOMMU Operations */ -static struct iommu_domain *ipmmu_domain_alloc(unsigned type) +static struct iommu_domain *__ipmmu_domain_alloc(unsigned type) { struct ipmmu_vmsa_domain *domain; - if (type != IOMMU_DOMAIN_UNMANAGED) - return NULL; - domain = kzalloc(sizeof(*domain), GFP_KERNEL); if (!domain) return NULL; @@ -522,6 +519,14 @@ static struct iommu_domain *ipmmu_domain return &domain->io_domain; } +static struct iommu_domain *ipmmu_domain_alloc(unsigned type) +{ + if (type != IOMMU_DOMAIN_UNMANAGED) + return NULL; + + return __ipmmu_domain_alloc(type); +} + static void ipmmu_domain_free(struct iommu_domain *io_domain) { struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);