Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965496AbcCORBp (ORCPT ); Tue, 15 Mar 2016 13:01:45 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35442 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932591AbcCORBl (ORCPT ); Tue, 15 Mar 2016 13:01:41 -0400 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: Wed, 16 Mar 2016 02:05:00 +0900 Message-Id: <20160315170500.20615.65801.sendpatchset@little-apple> In-Reply-To: <20160315170431.20615.30333.sendpatchset@little-apple> References: <20160315170431.20615.30333.sendpatchset@little-apple> Subject: [PATCH 03/04] iommu/ipmmu-vmsa: Break out domain allocation code Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 43 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 --- drivers/iommu/ipmmu-vmsa.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- 0014/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2015-12-14 19:23:22.210513000 +0900 @@ -457,13 +457,10 @@ static irqreturn_t ipmmu_domain_irq(int * 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; @@ -473,6 +470,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);