From patchwork Tue Mar 7 03:17:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9608043 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 BCB9A60414 for ; Tue, 7 Mar 2017 03:32:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA9842832D for ; Tue, 7 Mar 2017 03:32:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F7DD2841A; Tue, 7 Mar 2017 03:32:07 +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 98E0928433 for ; Tue, 7 Mar 2017 03:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932310AbdCGDcG (ORCPT ); Mon, 6 Mar 2017 22:32:06 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34789 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754463AbdCGDcC (ORCPT ); Mon, 6 Mar 2017 22:32:02 -0500 Received: by mail-pg0-f68.google.com with SMTP id b5so4709400pgg.1; Mon, 06 Mar 2017 19:29:44 -0800 (PST) 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=oEcEgKR34CwEK45dYtRueJ/Vd2wEgJDXrnpzZF45S1A=; b=VHTmutneSWdEs+XR01pbbiocyWEXqDJqbvBYPaAEyQ0Q/VoUTc9zzo/n9RtOORif3J JyT1Je7LrAUNfll8M2tqW2Jml7KIgHCcRxZbLRXEO06SaU7WYTqBxXlowgHuPaaf0fgf VBNSp+G2Y5SexItsD9Cuxy/nrZPRoInMkTYS9uZc82ETdsf2uI3NR8EopdzhPg3pV23B OMkeKHEKIO6u6qgYckjpt4OnFqZc5HYRTbC7JJY+AS3ogGMS2VOmqrgg39Zlipt7jvRR MJIP0Plm3r3roWY61PlcEnYmCat0VX+//H/0LW5fo3hFDF7abSANWUIpefYiKkczSVrn Mhog== 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=oEcEgKR34CwEK45dYtRueJ/Vd2wEgJDXrnpzZF45S1A=; b=HKSeSFPkciu17k0jEFZBbO9ig+Z/zNdOTADVGw21TDHjxxxKZzp9mDkLeLzfG3crET iCYWV+kCFKYzc+msL3hs9yChMH012V/2aAq33UywCTPfykJUDgp63SUpJSnIklLJVlTM IiCj4jBywlxlwp3qCC+HaK8XiBpxkbqlEx1A+nardEIHuHTk1ZxPbYeZtMzIPQ4ao0c+ RcXeXoRudUxU7l24u4WbFuGoEPGq/S89FCPUazWBIce8y7TvJSs8WSLKwfhGEVQgoliL LfXmjL/HSJ8+uW4HFfS8HssO40QwDwZzEoJk4VqJZ+S+XnrpIDOrjOofWrNNPjHcIfUX JyUA== X-Gm-Message-State: AMke39n/7a4Xy/R3jhXSoMWXnKaCNJvRUzgcXzGDGZnZE61ffpxHpC/TuQF3cWEWpvfYiw== X-Received: by 10.84.214.129 with SMTP id j1mr32018139pli.23.1488856986634; Mon, 06 Mar 2017 19:23:06 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id g27sm35736276pgn.20.2017.03.06.19.23.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 19:23:05 -0800 (PST) From: Magnus Damm To: joro@8bytes.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, 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: Tue, 07 Mar 2017 12:17:23 +0900 Message-Id: <148885664390.28553.13152016302789412479.sendpatchset@little-apple> In-Reply-To: <148885660307.28553.995847796823338863.sendpatchset@little-apple> References: <148885660307.28553.995847796823338863.sendpatchset@little-apple> Subject: [PATCH v7 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: Geert Uytterhoeven --- Changes since V6: - None 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-03-06 18:34:59.520607110 +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);