All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: linux-arm <linux-arm-kernel@lists.infradead.org>,
	Hiroshi Doyu <hiroshi.doyu@nokia.com>,
	Tony Lindgren <tony@atomide.com>,
	Russell King <linux@arm.linux.org.uk>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v2 10/17] omap: mailbox: move more stuff to omap_mbox_init()
Date: Fri, 14 May 2010 18:01:43 +0300	[thread overview]
Message-ID: <1273849310-32169-11-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1273849310-32169-1-git-send-email-felipe.contreras@gmail.com>

Will be needed to split the platform_driver.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/mach-omap1/mailbox.c |   23 +++++++++++--------
 arch/arm/mach-omap2/mailbox.c |   49 +++++++++++++++--------------------------
 2 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 25f1f89..8c1b83f 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -169,14 +169,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
 
 	res = pdev->resource;
 
-	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
-	if (!mbox_base)
-		return -ENOMEM;
-
-	list = omap1_mboxes;
-
-	list[0]->irq = res[1].start;
-
 	for (i = 0; list[i]; i++) {
 		ret = omap_mbox_register(&pdev->dev, list[i]);
 		if (ret)
@@ -187,7 +179,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
 err_out:
 	while (i--)
 		omap_mbox_unregister(list[i]);
-	iounmap(mbox_base);
 	return ret;
 }
 
@@ -198,7 +189,6 @@ static int __devexit omap1_mbox_remove(struct platform_device *pdev)
 	for (i = 0; list[i]; i++)
 		omap_mbox_unregister(list[i]);
 
-	iounmap(mbox_base);
 	return 0;
 }
 
@@ -222,14 +212,20 @@ static int __init omap1_mbox_init(void)
 	else if (cpu_is_omap15xx()) {
 		res = omap1_mbox_resources;
 		num = ARRAY_SIZE(omap1_mbox_resources);
+		list = omap1_mboxes;
+
 		res[1].end += 0x23;
+		list[0]->irq = res[1].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
 	else if (cpu_is_omap16xx()) {
 		res = omap1_mbox_resources;
 		num = ARRAY_SIZE(omap1_mbox_resources);
+		list = omap1_mboxes;
+
 		res[1].end += 0x2f;
+		list[0]->irq = res[1].start;
 	}
 #endif
 	else {
@@ -251,6 +247,12 @@ static int __init omap1_mbox_init(void)
 	if (err)
 		goto err_out;
 
+	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
+	if (!mbox_base) {
+		platform_device_put(pdev);
+		return -ENOMEM;
+	}
+
 	return platform_driver_register(&omap1_mbox_driver);
 
 err_out:
@@ -260,6 +262,7 @@ err_out:
 static void __exit omap1_mbox_exit(void)
 {
 	platform_driver_unregister(&omap1_mbox_driver);
+	iounmap(mbox_base);
 }
 
 module_init(omap1_mbox_init);
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 59e85fd..4f3b84e 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -448,35 +448,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 
 	res = pdev->resource;
 
-	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
-	if (!mbox_base)
-		return -ENOMEM;
-
-	if (false);
-#if defined(CONFIG_ARCH_OMAP3430)
-	else if (cpu_is_omap3430()) {
-		list = omap3_mboxes;
-
-		list[0]->irq = res[1].start;
-	}
-#endif
-#if defined(CONFIG_ARCH_OMAP2420)
-	else if (cpu_is_omap2420()) {
-		list = omap2_mboxes;
-
-		list[0]->irq = res[1].start;
-		list[1]->irq = res[2].start;
-	}
-#endif
-#if defined(CONFIG_ARCH_OMAP4)
-	else if (cpu_is_omap44xx()) {
-		list = omap4_mboxes;
-
-		list[0]->irq = res[1].start;
-		list[1]->irq = res[1].start;
-	}
-#endif
-
 	for (i = 0; list[i]; i++) {
 		ret = omap_mbox_register(&pdev->dev, list[i]);
 		if (ret)
@@ -487,7 +458,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 err_out:
 	while (i--)
 		omap_mbox_unregister(list[i]);
-	iounmap(mbox_base);
 	return ret;
 }
 
@@ -498,7 +468,6 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
 	for (i = 0; list[i]; i++)
 		omap_mbox_unregister(list[i]);
 
-	iounmap(mbox_base);
 	return 0;
 }
 
@@ -522,18 +491,29 @@ static int __init omap2_mbox_init(void)
 	else if (cpu_is_omap3430()) {
 		res = omap3_mbox_resources;
 		num = ARRAY_SIZE(omap3_mbox_resources);
+		list = omap3_mboxes;
+
+		list[0]->irq = res[1].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP2420)
 	else if (cpu_is_omap2420()) {
 		res = omap2_mbox_resources;
 		num = ARRAY_SIZE(omap2_mbox_resources);
+		list = omap2_mboxes;
+
+		list[0]->irq = res[1].start;
+		list[1]->irq = res[2].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP4)
 	else if (cpu_is_omap44xx()) {
 		res = omap4_mbox_resources;
 		num = ARRAY_SIZE(omap4_mbox_resources);
+		list = omap4_mboxes;
+
+		list[0]->irq = res[1].start;
+		list[1]->irq = res[1].start;
 	}
 #endif
 	else {
@@ -555,6 +535,12 @@ static int __init omap2_mbox_init(void)
 	if (err)
 		goto err_out;
 
+	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
+	if (!mbox_base) {
+		platform_device_put(pdev);
+		return -ENOMEM;
+	}
+
 	return platform_driver_register(&omap2_mbox_driver);
 
 err_out:
@@ -564,6 +550,7 @@ err_out:
 static void __exit omap2_mbox_exit(void)
 {
 	platform_driver_unregister(&omap2_mbox_driver);
+	iounmap(mbox_base);
 }
 
 module_init(omap2_mbox_init);
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: felipe.contreras@gmail.com (Felipe Contreras)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 10/17] omap: mailbox: move more stuff to omap_mbox_init()
Date: Fri, 14 May 2010 18:01:43 +0300	[thread overview]
Message-ID: <1273849310-32169-11-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1273849310-32169-1-git-send-email-felipe.contreras@gmail.com>

Will be needed to split the platform_driver.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/mach-omap1/mailbox.c |   23 +++++++++++--------
 arch/arm/mach-omap2/mailbox.c |   49 +++++++++++++++--------------------------
 2 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 25f1f89..8c1b83f 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -169,14 +169,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
 
 	res = pdev->resource;
 
-	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
-	if (!mbox_base)
-		return -ENOMEM;
-
-	list = omap1_mboxes;
-
-	list[0]->irq = res[1].start;
-
 	for (i = 0; list[i]; i++) {
 		ret = omap_mbox_register(&pdev->dev, list[i]);
 		if (ret)
@@ -187,7 +179,6 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
 err_out:
 	while (i--)
 		omap_mbox_unregister(list[i]);
-	iounmap(mbox_base);
 	return ret;
 }
 
@@ -198,7 +189,6 @@ static int __devexit omap1_mbox_remove(struct platform_device *pdev)
 	for (i = 0; list[i]; i++)
 		omap_mbox_unregister(list[i]);
 
-	iounmap(mbox_base);
 	return 0;
 }
 
@@ -222,14 +212,20 @@ static int __init omap1_mbox_init(void)
 	else if (cpu_is_omap15xx()) {
 		res = omap1_mbox_resources;
 		num = ARRAY_SIZE(omap1_mbox_resources);
+		list = omap1_mboxes;
+
 		res[1].end += 0x23;
+		list[0]->irq = res[1].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
 	else if (cpu_is_omap16xx()) {
 		res = omap1_mbox_resources;
 		num = ARRAY_SIZE(omap1_mbox_resources);
+		list = omap1_mboxes;
+
 		res[1].end += 0x2f;
+		list[0]->irq = res[1].start;
 	}
 #endif
 	else {
@@ -251,6 +247,12 @@ static int __init omap1_mbox_init(void)
 	if (err)
 		goto err_out;
 
+	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
+	if (!mbox_base) {
+		platform_device_put(pdev);
+		return -ENOMEM;
+	}
+
 	return platform_driver_register(&omap1_mbox_driver);
 
 err_out:
@@ -260,6 +262,7 @@ err_out:
 static void __exit omap1_mbox_exit(void)
 {
 	platform_driver_unregister(&omap1_mbox_driver);
+	iounmap(mbox_base);
 }
 
 module_init(omap1_mbox_init);
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 59e85fd..4f3b84e 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -448,35 +448,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 
 	res = pdev->resource;
 
-	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
-	if (!mbox_base)
-		return -ENOMEM;
-
-	if (false);
-#if defined(CONFIG_ARCH_OMAP3430)
-	else if (cpu_is_omap3430()) {
-		list = omap3_mboxes;
-
-		list[0]->irq = res[1].start;
-	}
-#endif
-#if defined(CONFIG_ARCH_OMAP2420)
-	else if (cpu_is_omap2420()) {
-		list = omap2_mboxes;
-
-		list[0]->irq = res[1].start;
-		list[1]->irq = res[2].start;
-	}
-#endif
-#if defined(CONFIG_ARCH_OMAP4)
-	else if (cpu_is_omap44xx()) {
-		list = omap4_mboxes;
-
-		list[0]->irq = res[1].start;
-		list[1]->irq = res[1].start;
-	}
-#endif
-
 	for (i = 0; list[i]; i++) {
 		ret = omap_mbox_register(&pdev->dev, list[i]);
 		if (ret)
@@ -487,7 +458,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 err_out:
 	while (i--)
 		omap_mbox_unregister(list[i]);
-	iounmap(mbox_base);
 	return ret;
 }
 
@@ -498,7 +468,6 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
 	for (i = 0; list[i]; i++)
 		omap_mbox_unregister(list[i]);
 
-	iounmap(mbox_base);
 	return 0;
 }
 
@@ -522,18 +491,29 @@ static int __init omap2_mbox_init(void)
 	else if (cpu_is_omap3430()) {
 		res = omap3_mbox_resources;
 		num = ARRAY_SIZE(omap3_mbox_resources);
+		list = omap3_mboxes;
+
+		list[0]->irq = res[1].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP2420)
 	else if (cpu_is_omap2420()) {
 		res = omap2_mbox_resources;
 		num = ARRAY_SIZE(omap2_mbox_resources);
+		list = omap2_mboxes;
+
+		list[0]->irq = res[1].start;
+		list[1]->irq = res[2].start;
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP4)
 	else if (cpu_is_omap44xx()) {
 		res = omap4_mbox_resources;
 		num = ARRAY_SIZE(omap4_mbox_resources);
+		list = omap4_mboxes;
+
+		list[0]->irq = res[1].start;
+		list[1]->irq = res[1].start;
 	}
 #endif
 	else {
@@ -555,6 +535,12 @@ static int __init omap2_mbox_init(void)
 	if (err)
 		goto err_out;
 
+	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
+	if (!mbox_base) {
+		platform_device_put(pdev);
+		return -ENOMEM;
+	}
+
 	return platform_driver_register(&omap2_mbox_driver);
 
 err_out:
@@ -564,6 +550,7 @@ err_out:
 static void __exit omap2_mbox_exit(void)
 {
 	platform_driver_unregister(&omap2_mbox_driver);
+	iounmap(mbox_base);
 }
 
 module_init(omap2_mbox_init);
-- 
1.7.1

  parent reply	other threads:[~2010-05-14 15:02 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 15:01 [PATCH v2 00/17] omap: mailbox: reorganize init Felipe Contreras
2010-05-14 15:01 ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 01/17] omap: mailbox: trivial whitespace cleanups Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 02/17] omap: mailbox: trivial cleanups Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 03/17] omap: mailbox: reorganize structures Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 04/17] omap: mailbox: 2420 should be detected at run-time Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 05/17] omap: mailbox: use correct config for omap1 Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 06/17] omap: mailbox: update omap1 probing Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 07/17] omap: mailbox: reorganize registering Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 08/17] omap: mailbox: only compile for configured archs Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 21:27   ` Kanigeri, Hari
2010-05-14 21:27     ` Kanigeri, Hari
2010-05-14 22:24     ` Felipe Contreras
2010-05-14 22:24       ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 09/17] omap: mailbox: reorganize omap platform_device Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` Felipe Contreras [this message]
2010-05-14 15:01   ` [PATCH v2 10/17] omap: mailbox: move more stuff to omap_mbox_init() Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 11/17] omap: mailbox: trivial sync between omap1 and 2 Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 12/17] omap: mailbox: split platform driver Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 13/17] omap: mailbox: always built-in platform data Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 14/17] omap: mailbox: reorganize headers Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 15/17] omap: mailbox: don't export unecessary symbols Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 16/17] omap: mailbox: mark some resources as __initdata Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:01 ` [PATCH v2 17/17] omap: mailbox: don't export register/unregister Felipe Contreras
2010-05-14 15:01   ` Felipe Contreras
2010-05-14 15:09 ` [PATCH v2 00/17] omap: mailbox: reorganize init Ohad Ben-Cohen
2010-05-14 15:09   ` Ohad Ben-Cohen
2010-05-14 19:03   ` Felipe Contreras
2010-05-14 19:03     ` Felipe Contreras
2010-05-15  8:36     ` Ohad Ben-Cohen
2010-05-15  8:36       ` Ohad Ben-Cohen
2010-05-18  8:46 ` Hiroshi DOYU
2010-05-18  8:46   ` Hiroshi DOYU
2010-05-18 12:03   ` Felipe Contreras
2010-05-18 12:03     ` Felipe Contreras
2010-05-18 13:31     ` Hiroshi DOYU
2010-05-18 13:31       ` Hiroshi DOYU
2010-05-18 16:57       ` Felipe Contreras
2010-05-18 16:57         ` Felipe Contreras
2010-05-18 19:58         ` Hiroshi DOYU
2010-05-18 19:58           ` Hiroshi DOYU
2010-05-19 10:03           ` Felipe Contreras
2010-05-19 10:03             ` Felipe Contreras
2010-05-19 18:13             ` Tony Lindgren
2010-05-19 18:13               ` Tony Lindgren
2010-05-21 21:51               ` Felipe Contreras
2010-05-21 21:51                 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273849310-32169-11-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=hiroshi.doyu@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.