From patchwork Sat May 16 10:05:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 24251 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4GA5xFj000427 for ; Sat, 16 May 2009 10:06:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755204AbZEPKGA (ORCPT ); Sat, 16 May 2009 06:06:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754382AbZEPKGA (ORCPT ); Sat, 16 May 2009 06:06:00 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:63079 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755204AbZEPKF7 (ORCPT ); Sat, 16 May 2009 06:05:59 -0400 Received: by mail-fx0-f158.google.com with SMTP id 2so2342832fxm.37 for ; Sat, 16 May 2009 03:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=I2gsikrOa+fok0PIFxYgvdJpvPJqlG2GXkvpFkGrYl4=; b=aCXlQ4iAnodUhJ3qGgeMH5ij51VQ1I8EUy35nQ0H1n+mPi13Bj4BmSIQtHpoZxh/J1 VvqrAJ/ybov+BRbNGRTHt7Bp3cpeWugCD9gLauZjAi5csn1hMaPDSBg4U+5wbDsyHIO9 ujexetEbdCvIk+zlVNhG6fC6O4VmzEhn2BADo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=qVYHlcDxE0neHWUK0QFRC9pqHbyU275WYU3+BaoRr438Ss2A9/7jRyOy9Ur/CkGel8 b1hezZrPYU5M0EZjHmKO5TmwcTqJ23+XjYHsiZ7/TR+7eVVx5frat732Iaj8D+4SmOC9 QQSnYZs5ayx2+y4l7xVd/763bruFEm6LmD77o= Received: by 10.86.1.18 with SMTP id 18mr962669fga.19.1242468359981; Sat, 16 May 2009 03:05:59 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id 4sm918657fge.28.2009.05.16.03.05.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 16 May 2009 03:05:58 -0700 (PDT) From: Felipe Contreras To: linux-omap@vger.kernel.org Cc: Hiroshi DOYU , Hari Kanigeri , linux-arm-kernel@lists.arm.linux.org.uk, Felipe Contreras Subject: [RFC/PATCH 3/3] omap3-iommu: remote registration Date: Sat, 16 May 2009 13:05:50 +0300 Message-Id: <1242468350-23190-4-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1242468350-23190-3-git-send-email-felipe.contreras@gmail.com> References: <1242468350-23190-1-git-send-email-felipe.contreras@gmail.com> <1242468350-23190-2-git-send-email-felipe.contreras@gmail.com> <1242468350-23190-3-git-send-email-felipe.contreras@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This allows devices to be registered only when they are used. The current dsp-bridge driver for example is not using iommu so registering the iommu iva2 device would conflict. By allowing remote registration the dsp-bridge can decide when the iommu iva2 device is registered. Signed-off-by: Felipe Contreras --- arch/arm/mach-omap2/omap3-iommu.c | 36 +----------------------------- arch/arm/plat-omap/include/mach/iommu.h | 2 + 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/arch/arm/mach-omap2/omap3-iommu.c b/arch/arm/mach-omap2/omap3-iommu.c index 149c624..8380cd5 100644 --- a/arch/arm/mach-omap2/omap3-iommu.c +++ b/arch/arm/mach-omap2/omap3-iommu.c @@ -41,11 +41,8 @@ static struct iommu_device devices[] = { }, }, }; -#define NR_IOMMU_DEVICES ARRAY_SIZE(omap3_iommu_pdata) -static struct platform_device *omap3_iommu_pdev[NR_IOMMU_DEVICES]; - -static struct platform_device *omap_iommu_add(const char *name) +struct platform_device *omap_iommu_add(const char *name) { struct platform_device *pdev; const struct iommu_device *d = NULL; @@ -91,36 +88,7 @@ err_out: platform_device_put(pdev); return NULL; } - -static int __init omap3_iommu_init(void) -{ - struct platform_device *pdev; - int i, err; - - for (i = 0; i < ARRAY_SIZE(devices); i++) { - pdev = omap_iommu_add(devices[i].pdata.name); - if (!pdev) - goto err_out; - omap3_iommu_pdev[i] = pdev; - } - - return 0; - -err_out: - while (i--) - platform_device_put(omap3_iommu_pdev[i]); - return err; -} -module_init(omap3_iommu_init); - -static void __exit omap3_iommu_exit(void) -{ - int i; - - for (i = 0; i < NR_IOMMU_DEVICES; i++) - platform_device_unregister(omap3_iommu_pdev[i]); -} -module_exit(omap3_iommu_exit); +EXPORT_SYMBOL_GPL(omap_iommu_add); MODULE_AUTHOR("Hiroshi DOYU"); MODULE_DESCRIPTION("omap iommu: omap3 device registration"); diff --git a/arch/arm/plat-omap/include/mach/iommu.h b/arch/arm/plat-omap/include/mach/iommu.h index 769b00b..e22a4a4 100644 --- a/arch/arm/plat-omap/include/mach/iommu.h +++ b/arch/arm/plat-omap/include/mach/iommu.h @@ -165,4 +165,6 @@ extern int foreach_iommu_device(void *data, extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf); extern size_t dump_tlb_entries(struct iommu *obj, char *buf); +struct platform_device *omap_iommu_add(const char *name); + #endif /* __MACH_IOMMU_H */