From patchwork Tue Sep 20 13:44:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9341729 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 9D180607D0 for ; Tue, 20 Sep 2016 13:54:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F9F229778 for ; Tue, 20 Sep 2016 13:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84477296FA; Tue, 20 Sep 2016 13:54:57 +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 2C56D29720 for ; Tue, 20 Sep 2016 13:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755177AbcITNxN (ORCPT ); Tue, 20 Sep 2016 09:53:13 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34642 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753882AbcITNxJ (ORCPT ); Tue, 20 Sep 2016 09:53:09 -0400 Received: by mail-pf0-f195.google.com with SMTP id 21so1017619pfy.1; Tue, 20 Sep 2016 06:53:08 -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=BjezDKwan3uJuwLvUipd3Au2S7vRfElZSmfzgZy1LA8=; b=s5isUwwUWKNeTX4e3uKwoaE0kTTqp7GWt7Muc8vbSrGMeAYWrS9kV4d5MQoguq2a6b t/YK6et8Me3i72X0qhiirYKX8Cy2pc5KKzErPyE7mdnLxmwD+BvO2CwQAZDYwWkOIEwc T6erA/qmI2TBCovZGZVBhs6mAGH7AnrT9zaXb9FCrM1yct1BbCfJ2NIMbM5hGXBPp+d+ ECwdVruGjhzNOl1ofxkbLMeGVrpsRuLHBQ7sWcQ3b+b/S9XCGDDe9Elmviwep+gFUYp8 4jFzIMoLa9y2rVJF7Cdjo73dr7KO1AaAabQLtIZFc2lqy1+lgAFdKHeR9l7hgDI+EGD9 CCtw== 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=BjezDKwan3uJuwLvUipd3Au2S7vRfElZSmfzgZy1LA8=; b=ZLJQgCf/ziYZeiEq7f8QOzUzd0duqgTzjDA6jMVDwPjkA+qwUtXzb7mw5tiDDYTQz7 VjqOJhF8IUkMZnnJ8Zvlvq253gJK9NJ4N212ELQ+yfnnPteD6vierDj2H7Ohz8HIHivF 84+FLeCxDHcFgcaz2A4SCzGG1XLtpoPFrBweX/tOnrAm4qqbGUVaDI22M8N5SdZt3TL5 ytvQHNlkTOfM14/CtSXq4soWo2FF75Uej/QJZzlRCV2/OUvDFbRMpwdthgVUTd4pyOBd TS+H9wZP+cWjm9Yumxl6zWCaZ7CEqLHIiDRn7G3JIa16Evldse5z91UfOQgeXEx1CoJO noOQ== X-Gm-Message-State: AE9vXwPN41f8XqAb6s4lbnSGucCMo/y92mi9D/p/EEF/jhx6OAoh7NPEMNwhtLW3JHeH3Q== X-Received: by 10.98.75.4 with SMTP id y4mr56349702pfa.25.1474379588461; Tue, 20 Sep 2016 06:53:08 -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 u1sm77632117pfb.62.2016.09.20.06.53.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Sep 2016 06:53:07 -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: Tue, 20 Sep 2016 22:44:36 +0900 Message-Id: <20160920134436.25470.94761.sendpatchset@little-apple> In-Reply-To: <20160920134355.25470.93701.sendpatchset@little-apple> References: <20160920134355.25470.93701.sendpatchset@little-apple> Subject: [PATCH v5 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 --- 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);