From patchwork Wed Oct 19 23:36:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9385589 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 9DD1660487 for ; Wed, 19 Oct 2016 23:44:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73EC728B55 for ; Wed, 19 Oct 2016 23:44:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 689BB29107; Wed, 19 Oct 2016 23:44:33 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 03F7828B55 for ; Wed, 19 Oct 2016 23:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932902AbcJSXoL (ORCPT ); Wed, 19 Oct 2016 19:44:11 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33466 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932777AbcJSXoH (ORCPT ); Wed, 19 Oct 2016 19:44:07 -0400 Received: by mail-pf0-f195.google.com with SMTP id i85so3686670pfa.0; Wed, 19 Oct 2016 16:44:07 -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=lcFVLCg8zFTNYo5Wn2QriVMGNp0afVNnTjhKJfVedyg=; b=ETMdMh5hkU1vJUADtPXQbaf0VmGhFWY17R3u+eYknf2TiiG9bGmzVMOgPhqM7IXqEz zmpkkJap/CCwjWFHfZr/ONL0VayCBVCrOy+XN7Ts0q0pB7WvpVPU16vWOx8sKz1gb1Fg NxSJtRbHYPyHLr2T1RRMSijy6+6JufdE4H3EfrL5nnr6R2XemI0cU8pdb//G9uPxnD2k zenmHFGkFLctkJWZeuYnjfXmWMugAg51FYvBSNxLC8irDh1jD+MJhp+MOWZMmbxA3h+6 0ZmFHAObTEuFMFxTbuFB9plXwwhn1SQWtBe6Kx8Bs41S/GbUIky83nwpzUztCMAj2DPB Wugw== 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=lcFVLCg8zFTNYo5Wn2QriVMGNp0afVNnTjhKJfVedyg=; b=BWRQ3JMdepceOtwqvUi4UIsHgRcZ+/aCmW/KyhmVq5+YASOQZHnyBr3WMh07L/RJs6 AWdfne1hCbP747vuvLLYLa/o8UuNxVDy6AYB26qUq1+zlVb2SnWZWsPabBJzMdhGNtIB 8VHHNZ7IAs8j6sMsKkjRhd6X9ajsr8vIzbb1F2cEry4npqUxxGPfUvANrVvl1ZrP4Pdk jJL2dro9WqkVE9CICUFCZPpXRBS7OmY13WDBSnVpfmCXgKO+vyRnQC9t6SLIH51I8dCQ DhyOUGJklLQpLLqX1iH/RzY4zXE2A/dvUge8XVXqzwu/NGWcRF02NF/h2av//cxCfIT3 HuwQ== X-Gm-Message-State: AA6/9Rl0xpk/cK7J6o0Py8iiKYFTdKmGv7dSIs48348/cQDVUwoGdulqzfjs8oA4N/B9rA== X-Received: by 10.99.117.91 with SMTP id f27mr12750940pgn.75.1476920646909; Wed, 19 Oct 2016 16:44:06 -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 p3sm5824818pfg.48.2016.10.19.16.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 16:44:05 -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: Thu, 20 Oct 2016 08:36:13 +0900 Message-Id: <20161019233613.10506.60821.sendpatchset@little-apple> In-Reply-To: <20161019233533.10506.16810.sendpatchset@little-apple> References: <20161019233533.10506.16810.sendpatchset@little-apple> Subject: [PATCH v6 04/07] 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 Reviewed-by: Joerg Roedel Reviewed-by: Laurent Pinchart --- Changes since V5: - None Changes since V4: - None Changes since V3: - None 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(-) --- 0008/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-09-20 21:56:59.220607110 +0900 @@ -507,13 +507,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; @@ -523,6 +520,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);