From patchwork Wed May 17 10:06:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9730651 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 2ABBE60138 for ; Wed, 17 May 2017 10:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D810205AF for ; Wed, 17 May 2017 10:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11A282872D; Wed, 17 May 2017 10:11:36 +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=ham 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 039AA205AF for ; Wed, 17 May 2017 10:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754027AbdEQKLe (ORCPT ); Wed, 17 May 2017 06:11:34 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34205 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbdEQKLc (ORCPT ); Wed, 17 May 2017 06:11:32 -0400 Received: by mail-pf0-f193.google.com with SMTP id w69so1203206pfk.1; Wed, 17 May 2017 03:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=Lfl5iTt0xFzCrH00En4bHw4dSZDERD4hyZqTEAKu0VU=; b=j3CV4k6pQoxuvVi39ayXwYPVtvWkn8PWIDhi5nmrByQaNeJ92C2H6ZhSOvohzdgKcW 866y/MDWr5mg65GU0AUB/PwWzLU0M+LjrtiugIm3HiHsDl2KjMQImQ0ZNfO4E3p8BxO1 2oxljGkN2MQspE12nF0wQssxrnHqGTEV5LxXDxbQxoBNNH+y98k7HvjKCIOE/K6E6VY8 y8iv9GrVRp9/2C8HoqK0QuMHn3TjqVMVTJEDhjzZ0BezQRPmhmlLPpLPfSkjoe5wHJ6/ 66UP+YoJzVXduRxjQmuBwzWx+Pcr4UPn29J7WHogKeEOsLJ8ka8aGZZB6mh5vr7x1oI/ gmxg== 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:date:message-id:in-reply-to :references:subject; bh=Lfl5iTt0xFzCrH00En4bHw4dSZDERD4hyZqTEAKu0VU=; b=Q2BC9m1K6bhaPE6/dB0l3soNCWBtkCEzdCSZVQ2S8porIMVmBRm05tKU2uovpeCJfC LWlnduErxbskBZ6Cz1jT/z3WUM2Ed4NADYqOEHXt1b8f6RMOeG+WCFD3F2Ol1cz09h7W rfWSYzcEH4A1N8TrB97vk/ygUboqFWrwlm72Ko6duira3S33Hya9ibtXi4HSClX8KxWR uRGLC/5bDJr37CxCSbeKHLDXrPPhwrndL9ApLZ4bQ7uuKQqSwdQQ63+cw36zu9qwdvGs T9wu/zYvykxH1ynUX1CmF8p0fr3LQ6eNB3W2ypC2ux+qOyykbEskxkNntj0xXDWofDEI 4KXA== X-Gm-Message-State: AODbwcAdMkMQHKwjuShF3yEjxu1HOzGw+qud7VkgY5MJ3bn4M6Pbgy9z B5RAAl8cINbZCg== X-Received: by 10.84.149.102 with SMTP id b35mr3317892plh.151.1495015886731; Wed, 17 May 2017 03:11:26 -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 e71sm3071689pgc.17.2017.05.17.03.11.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 May 2017 03:11:25 -0700 (PDT) From: Magnus Damm To: joro@8bytes.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, sricharan@codeaurora.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, iommu@lists.linux-foundation.org, horms+renesas@verge.net.au, Magnus Damm , robin.murphy@arm.com, m.szyprowski@samsung.com Date: Wed, 17 May 2017 19:06:59 +0900 Message-Id: <149501561966.21593.14282344872401796559.sendpatchset@little-apple> In-Reply-To: <149501557669.21593.1017116915706613060.sendpatchset@little-apple> References: <149501557669.21593.1017116915706613060.sendpatchset@little-apple> Subject: [PATCH v8 04/08] 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: Geert Uytterhoeven --- Changes since V7: - Added Reviewed-by from Geert - Thanks! drivers/iommu/ipmmu-vmsa.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- 0006/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-05-17 16:39:05.380607110 +0900 @@ -509,13 +509,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; @@ -525,6 +522,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);