From patchwork Tue Mar 15 17:05:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 8590501 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2406EC0553 for ; Tue, 15 Mar 2016 17:02:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A45B202FE for ; Tue, 15 Mar 2016 17:02:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E043A202F0 for ; Tue, 15 Mar 2016 17:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934848AbcCORBo (ORCPT ); Tue, 15 Mar 2016 13:01:44 -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 Received: by mail-pf0-f177.google.com with SMTP id n5so36216159pfn.2; Tue, 15 Mar 2016 10:01:40 -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=CglKkRrk10uOIma2oJH/f4NA8+81EroXwvza9VdwgPE=; b=nMw1R8YnluMZt3SIe5VqCYmAtbZAM+2dIRTKAk7CETWB5ym+Q94cJdjOdbjqYSCPIj XDUU3CbYEB6OcvU7OFgGhT664kcl/4NdccIe/+MakaJOzeDy+vAPHWuGJctAtsIqXy6B E46lGuzrROpKluWglqdrBDf1spQVyzOBDRQiiVb0S9qU0MyhMzvZZ5WEA3dXNuK+11dj Rz2jfzQwIkxBUr2DFgtBi415le78085TYPqMxbgTYhuR6OG7L5ONe+1QtLVtgcywX4sB 6dYvpgEr6G/MfxiEax3qH6sAplaLwFadlmq+jB3kRQ0UCRG636846yR22/E7egeWfjwh fOBw== 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=CglKkRrk10uOIma2oJH/f4NA8+81EroXwvza9VdwgPE=; b=irgrXbp5uDR/GHLGpci//fKcN4wnwD1Zem1Xm3cspjH66VNliKerrbzS10QzMfqL/+ qxV0jUsOtD3yxJpIvB1pVMnf1rv+QjD/TAmGsUmSeEvn67Z7Log0soqiUCRY+XfLadg6 HGdfwQ/5qLw+dUx1DepLdjvxQUgRc4uLJyEToHQUlZS3SkiGtuRM3V4HfbsivWeCejGS 2uRPhbX1wG44lIYTx1CepkwS77McYbtMbeRldTsrN70JiD5vX3o1raTqFCMOe1jjFzUy vMWu7D/DVgeZJf6RfirBlryYq8qEsl7jPGqvZMqZiFql/utIIRb/x7+pMR0a2wGP+uAF 0mLQ== X-Gm-Message-State: AD7BkJKaPKD1i6pQybO4jDXCqwtlF37mW4ZNYXEox1bMBjFSNB/dpX2okrw5g3o9JTkPQw== X-Received: by 10.66.102.104 with SMTP id fn8mr48363317pab.129.1458061300458; Tue, 15 Mar 2016 10:01:40 -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 i1sm40935987pfj.17.2016.03.15.10.01.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Mar 2016 10:01:39 -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: 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-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.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 --- 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);